mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Logging improvements on migration in the VmwareResource (#8300)
This commit is contained in:
parent
4e34e6b334
commit
56e0450526
@ -4766,7 +4766,13 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
final String vmName = cmd.getVmName();
|
||||
try {
|
||||
VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext());
|
||||
if (hyperHost == null) {
|
||||
throw new CloudRuntimeException("no hypervisor host found for migrate command");
|
||||
}
|
||||
ManagedObjectReference morDc = hyperHost.getHyperHostDatacenter();
|
||||
if (morDc == null) {
|
||||
throw new CloudRuntimeException("no Managed Object Reference for the Data Center found for migrate command");
|
||||
}
|
||||
|
||||
// find VM through datacenter (VM is not at the target host yet)
|
||||
VirtualMachineMO vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
|
||||
@ -4777,6 +4783,9 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
}
|
||||
|
||||
VmwareHypervisorHost destHyperHost = getTargetHyperHost(new DatacenterMO(hyperHost.getContext(), morDc), cmd.getDestinationIp());
|
||||
if (destHyperHost == null) {
|
||||
throw new CloudRuntimeException("no destination Hypervisor Host found for migrate command");
|
||||
}
|
||||
|
||||
ManagedObjectReference morTargetPhysicalHost = destHyperHost.findMigrationTarget(vmMo);
|
||||
if (morTargetPhysicalHost == null) {
|
||||
@ -4788,7 +4797,8 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
}
|
||||
|
||||
return new MigrateAnswer(cmd, true, "migration succeeded", null);
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
s_logger.info(String.format("migrate command for %s failed due to %s", vmName, e.getLocalizedMessage()));
|
||||
return new MigrateAnswer(cmd, false, createLogMessageException(e, cmd), null);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user