fix(region): managed vm migrate info (#21754)

This commit is contained in:
屈轩
2024-12-05 19:28:41 +08:00
committed by GitHub
parent c4c1f1c686
commit 713dc191e5
2 changed files with 4 additions and 3 deletions
+2 -3
View File
@@ -1417,9 +1417,8 @@ func (self *SManagedVirtualizedGuestDriver) requestMigrate(ctx context.Context,
return false, nil
}
hostId := iVM.GetIHostId()
log.Debugf("guest %s migrate from %s -> %s", guest.Name, hostExternalId, hostId)
if len(hostId) > 0 && hostId != hostExternalId {
hostExternalId = hostId
log.Debugf("guest %s migrate from %s -> %s", guest.Name, guest.HostId, host.Id)
if len(hostId) > 0 && hostId == hostExternalId {
return true, nil
}
return false, nil
+2
View File
@@ -357,6 +357,7 @@ func (self *SInstance) DetachDisk(ctx context.Context, diskId string) error {
func (self *SInstance) MigrateVM(hostId string) error {
input := api.GuestMigrateInput{}
input.PreferHost = hostId
input.PreferHostId = hostId
_, err := self.host.zone.region.perform(&modules.Servers, self.Id, "migrate", input)
return err
}
@@ -364,6 +365,7 @@ func (self *SInstance) MigrateVM(hostId string) error {
func (self *SInstance) LiveMigrateVM(hostId string) error {
input := api.GuestLiveMigrateInput{}
input.PreferHost = hostId
input.PreferHostId = hostId
skipCpuCheck := true
input.SkipCpuCheck = &skipCpuCheck
_, err := self.host.zone.region.perform(&modules.Servers, self.Id, "live-migrate", input)