fix(host): compare desc cdrom (#14860)

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
This commit is contained in:
wanyaoqi
2022-08-29 17:23:04 +08:00
committed by GitHub
parent 872feb5484
commit a4413b92e1
2 changed files with 9 additions and 3 deletions
+3
View File
@@ -275,6 +275,9 @@ func (d *SGuestDiskSyncTask) onGetBlockInfo(blocks []monitor.QemuBlock) {
}
if len(cdName) > 0 {
d.changeCdromContent(cdName)
} else {
d.cdrom = nil
d.syncDisksConf()
}
}
+6 -3
View File
@@ -1543,12 +1543,15 @@ func (s *SKVMGuestInstance) compareDescIsolatedDevices(newDesc *desc.SGuestDesc,
}
func (s *SKVMGuestInstance) compareDescCdrom(newDesc *desc.SGuestDesc) *string {
if s.Desc.Cdrom == nil && newDesc.Cdrom == nil {
newCdromIsNil := newDesc.Cdrom == nil || newDesc.Cdrom.Path == ""
oldCdromIsNil := s.Desc.Cdrom == nil || s.Desc.Cdrom.Path == ""
if oldCdromIsNil && newCdromIsNil {
return nil
} else if s.Desc.Cdrom == nil && newDesc.Cdrom != nil {
} else if oldCdromIsNil && !newCdromIsNil {
cdromPath := newDesc.Cdrom.Path
return &cdromPath
} else if s.Desc.Cdrom != nil && newDesc.Cdrom == nil {
} else if !oldCdromIsNil && newCdromIsNil {
var res = ""
return &res
} else {