mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix(region): sync managed vm status (#21752)
This commit is contained in:
@@ -1367,6 +1367,7 @@ func (self *SManagedVirtualizedGuestDriver) requestMigrate(ctx context.Context,
|
||||
return false, err
|
||||
}
|
||||
vmStatus := iVM.GetStatus()
|
||||
log.Debugf("vm %s migrate status: %s", guest.Name, vmStatus)
|
||||
if vmStatus == api.VM_UNKNOWN || strings.Contains(vmStatus, "fail") {
|
||||
return false, errors.Wrapf(cloudprovider.ErrInvalidStatus, vmStatus)
|
||||
}
|
||||
@@ -1374,6 +1375,7 @@ 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
|
||||
return true, nil
|
||||
|
||||
@@ -80,7 +80,7 @@ func (self *GuestSyncstatusTask) OnGetStatusComplete(ctx context.Context, obj db
|
||||
// not change migrating when:
|
||||
// guest.Status is migrating and task not has parent task
|
||||
os := self.getOriginStatus()
|
||||
if os == api.VM_MIGRATING && statusStr == api.VM_RUNNING {
|
||||
if os == api.VM_MIGRATING && statusStr == api.VM_RUNNING && len(guest.ExternalId) == 0 {
|
||||
statusStr = os
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user