Skip to content

Commit

Permalink
fix(region): managed vm migrate info (#21754)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Dec 5, 2024
1 parent c4c1f1c commit 713dc19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/compute/guestdrivers/managedvirtual.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/mcclient/cloudpods/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,15 @@ 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
}

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)
Expand Down

0 comments on commit 713dc19

Please sign in to comment.