From a23a80aeb8a35cd421fe63c984bf64f24f0dcb3c Mon Sep 17 00:00:00 2001 From: Unmesh Gurjar Date: Mon, 2 Jun 2014 18:44:55 +0530 Subject: [PATCH] vmware: Fixes VMDK volume incompatibility issue VMDK volume created in a cluster having ESXi 5.1 host has a high hardware version i.e. 9; hence, fails when attached to instance on an ESXi 5.0 host. This patch sets the hardware version to 8, so that the volume can be attached to instances on any ESXi host starting version 5.0 and above. Change-Id: Ia750fd1183334005a834eb49be767451d87b338c Closes-Bug: #1325586 --- cinder/tests/test_vmware_volumeops.py | 1 + cinder/volume/drivers/vmware/volumeops.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cinder/tests/test_vmware_volumeops.py b/cinder/tests/test_vmware_volumeops.py index ab71dcb63..5c761ecb4 100644 --- a/cinder/tests/test_vmware_volumeops.py +++ b/cinder/tests/test_vmware_volumeops.py @@ -413,6 +413,7 @@ class VolumeOpsTestCase(test.TestCase): self.assertEqual(name, ret.name) self.assertEqual('[%s]' % ds_name, ret.files.vmPathName) self.assertEqual(1, ret.deviceChange[1].device.capacityInKB) + self.assertEqual("vmx-08", ret.version) expected = [mock.call.create('ns0:VirtualLsiLogicController'), mock.call.create('ns0:VirtualDeviceConfigSpec'), mock.call.create('ns0:VirtualDisk'), diff --git a/cinder/volume/drivers/vmware/volumeops.py b/cinder/volume/drivers/vmware/volumeops.py index 8ba7b01f1..e9def9e95 100644 --- a/cinder/volume/drivers/vmware/volumeops.py +++ b/cinder/volume/drivers/vmware/volumeops.py @@ -397,6 +397,11 @@ class VMwareVolumeOps(object): create_spec.memoryMB = 128 create_spec.deviceChange = [controller_spec, disk_spec] create_spec.files = vm_file_info + # set the Hardware version to the lowest version supported by ESXi5.0 + # and compatible with vCenter Server 5.0 + # This ensures migration of volume created on a later ESX server + # works on any ESX server 5.0 and above. + create_spec.version = "vmx-08" if profileId: vmProfile = cf.create('ns0:VirtualMachineDefinedProfileSpec') -- 2.45.2