mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Relocate deploy-as-is cloned VM if does not end on the host receiving the start command and restore deployment logs
This commit is contained in:
parent
edfbed34ad
commit
acf872cdab
@ -1858,7 +1858,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
}
|
||||
String deployAsIsTemplate = deployAsIsInfo.getTemplatePath();
|
||||
String destDatastore = deployAsIsInfo.getDestStoragePool();
|
||||
vmMo = _storageProcessor.cloneVMFromTemplate(deployAsIsTemplate, vmInternalCSName, destDatastore);
|
||||
_storageProcessor.cloneVMFromTemplate(hyperHost, deployAsIsTemplate, vmInternalCSName, destDatastore);
|
||||
vmMo = hyperHost.findVmOnHyperHost(vmInternalCSName);
|
||||
if (vmMo == null) {
|
||||
s_logger.info("Cloned deploy-as-is VM " + vmInternalCSName + " is not in this host, relocating it");
|
||||
vmMo = takeVmFromOtherHyperHost(hyperHost, vmInternalCSName);
|
||||
}
|
||||
mapSpecDisksToClonedDisks(vmMo, vmInternalCSName, specDisks);
|
||||
} else {
|
||||
Pair<ManagedObjectReference, DatastoreMO> rootDiskDataStoreDetails = null;
|
||||
|
||||
@ -3729,10 +3729,9 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
/**
|
||||
* Return the cloned VM from the template
|
||||
*/
|
||||
public VirtualMachineMO cloneVMFromTemplate(String templateName, String cloneName, String templatePrimaryStoreUuid) {
|
||||
public VirtualMachineMO cloneVMFromTemplate(VmwareHypervisorHost hyperHost, String templateName, String cloneName, String templatePrimaryStoreUuid) {
|
||||
try {
|
||||
VmwareContext context = hostService.getServiceContext(null);
|
||||
VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, null);
|
||||
VmwareContext context = hyperHost.getContext();
|
||||
DatacenterMO dcMo = new DatacenterMO(context, hyperHost.getHyperHostDatacenter());
|
||||
VirtualMachineMO templateMo = dcMo.findVm(templateName);
|
||||
if (templateMo == null) {
|
||||
@ -3744,7 +3743,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
if (morDatastore == null) {
|
||||
throw new CloudRuntimeException("Unable to find datastore in vSphere");
|
||||
}
|
||||
s_logger.info("Cloning VM " + cloneName + " from template " + templatePrimaryStoreUuid);
|
||||
s_logger.info("Cloning VM " + cloneName + " from template " + templateName + " into datastore " + templatePrimaryStoreUuid);
|
||||
if (!_fullCloneFlag) {
|
||||
createVMLinkedClone(templateMo, dcMo, cloneName, morDatastore, morPool);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user