mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix: host set nil metadata (#18687)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -2563,10 +2563,10 @@ func (s *SKVMGuestInstance) optimizeOom() error {
|
||||
}
|
||||
|
||||
func (s *SKVMGuestInstance) SyncMetadata(meta *jsonutils.JSONDict) error {
|
||||
metaMap, _ := meta.GetMap()
|
||||
for k, v := range metaMap {
|
||||
s.Desc.Metadata[k] = v.String()
|
||||
if s.Desc.Metadata == nil {
|
||||
s.Desc.Metadata = make(map[string]string)
|
||||
}
|
||||
meta.Unmarshal(&s.Desc.Metadata)
|
||||
_, err := modules.Servers.SetMetadata(hostutils.GetComputeSession(context.Background()),
|
||||
s.Id, meta)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user