Skip to content

Commit e8aa476

Browse files
authored
Snapshot hardware version 411 (#26)
* Added snapshot hardware version - needs testing * Fixed hardware version format * Added worker vm hardware version when making a template from a volume * Using Cluster/Datacenter logic when VM hardware version is not available from any previous/parent VM
1 parent a0986bf commit e8aa476

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,9 +1118,11 @@ private Ternary<String, Long, Long> createTemplateFromVolume(VirtualMachineMO vm
11181118
throw new Exception(msg);
11191119
}
11201120

1121+
String hardwareVersion = String.valueOf(vmMo.getVirtualHardwareVersion());
1122+
11211123
// 4 MB is the minimum requirement for VM memory in VMware
11221124
Pair<VirtualMachineMO, String[]> cloneResult =
1123-
vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()), null);
1125+
vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()), hardwareVersion);
11241126
clonedVm = cloneResult.first();
11251127

11261128
clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, false, false);

vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,10 @@ public static VirtualMachineMO createWorkerVM(VmwareHypervisorHost hyperHost, Da
16131613
vmConfig.setName(vmName);
16141614
if (hardwareVersion != null){
16151615
vmConfig.setVersion("vmx-" + hardwareVersion);
1616+
} else {
1617+
ClusterMO clusterMo = new ClusterMO(hyperHost.getContext(), hyperHost.getHyperHostCluster());
1618+
DatacenterMO dataCenterMo = new DatacenterMO(hyperHost.getContext(), hyperHost.getHyperHostDatacenter());
1619+
setVMHardwareVersion(vmConfig, clusterMo, dataCenterMo);
16161620
}
16171621
vmConfig.setMemoryMB((long)4);
16181622
vmConfig.setNumCPUs(1);

0 commit comments

Comments
 (0)