From 78aa3df440e6899724be4f805ddc2c65a46d506c Mon Sep 17 00:00:00 2001 From: nvazquez Date: Tue, 29 Sep 2020 02:35:06 -0300 Subject: [PATCH] Fix reboot deploy-as-is VMs --- .../com/cloud/hypervisor/guru/VmwareVmImplementer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VmwareVmImplementer.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VmwareVmImplementer.java index 5c61887176c..c12c5c20e2d 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VmwareVmImplementer.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VmwareVmImplementer.java @@ -188,8 +188,12 @@ class VmwareVmImplementer { private void setDeployAsIsInfoTO(VirtualMachineProfile vm, VirtualMachineTO to, Map details) { String configuration = details.getOrDefault(VmDetailConstants.DEPLOY_AS_IS_CONFIGURATION, null); Map properties = deployAsIsHelper.getVirtualMachineDeployAsIsProperties(vm); - String destStoragePool = deployAsIsHelper.getAllocatedVirtualMachineDestinationStoragePool(vm); - String templatePath = deployAsIsHelper.getAllocatedVirtualMachineTemplatePath(vm, configuration, destStoragePool); + String templatePath = null; + String destStoragePool = null; + if (vm.getVirtualMachine().getState() == VirtualMachine.State.Starting) { + destStoragePool = deployAsIsHelper.getAllocatedVirtualMachineDestinationStoragePool(vm); + templatePath = deployAsIsHelper.getAllocatedVirtualMachineTemplatePath(vm, configuration, destStoragePool); + } Map nicsAdapterMapping = deployAsIsHelper.getAllocatedVirtualMachineNicsAdapterMapping(vm, to.getNics()); DeployAsIsInfoTO info = new DeployAsIsInfoTO(templatePath, destStoragePool, properties, nicsAdapterMapping); to.setDeployAsIsInfo(info);