VMware: Enable disk.EnableUUID=True in vmx

Currently there is no link in /dev/disk/by-id for SCSI (sdx) devices
because by default VMWare doesn't provide information needed by udev
to generate /dev/disk/by-id. When this specific parameter disk.EnableUUID
is set to True in vmx file inside the guest vm /dev/disk/by-id shows a
link to UUID of the attached SCSI device

Closes-Bug: #1475740

Change-Id: Ib2cdf994c37d4c5d2e095741cc579a7dc12be9e0
This commit is contained in:
Johnson koil raj 2015-07-24 01:25:59 +05:30 committed by Johnson koil raj
parent 8e035655d2
commit 2a6bdf8f0e
3 changed files with 46 additions and 0 deletions

View File

@ -566,6 +566,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
extra_config.key = 'nvp.vm-uuid'
spec.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
spec.extraConfig.append(extra_config)
spec.files = fake_factory.create('ns0:VirtualMachineFileInfo')
spec.files.vmPathName = '[fake-datastore]'
@ -668,6 +672,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.key = 'nvp.vm-uuid'
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
self.assertEqual(expected, result)
def test_get_vm_create_spec_with_limit(self):
@ -690,6 +698,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
extra_config.key = 'nvp.vm-uuid'
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
expected.memoryMB = 2048
@ -740,6 +752,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
extra_config.key = 'nvp.vm-uuid'
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
expected.memoryMB = 2048
@ -789,6 +805,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.key = 'nvp.vm-uuid'
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
expected.memoryMB = 2048
expected.managedBy = fake_factory.create('ns0:ManagedByInfo')
@ -839,6 +859,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
extra_config.key = 'nvp.vm-uuid'
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
expected.files = fake_factory.create('ns0:VirtualMachineFileInfo')
expected.files.vmPathName = '[fake-datastore]'
@ -1547,6 +1571,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.key = 'nvp.vm-uuid'
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = 2000000
extra_config.key = 'keyboard.typematicMinDelay'
expected.extraConfig.append(extra_config)
@ -1602,6 +1630,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.key = 'nvp.vm-uuid'
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
self.assertEqual(expected, result)
def test_get_vm_create_spec_with_memory_allocations(self):
@ -1649,6 +1681,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.key = 'nvp.vm-uuid'
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
self.assertEqual(expected, result)
def test_get_swap(self):

View File

@ -261,6 +261,12 @@ def get_vm_create_spec(client_factory, instance, data_store_name,
opt.value = instance.uuid
extra_config.append(opt)
# enable to provide info needed by udev to generate /dev/disk/by-id
opt = client_factory.create('ns0:OptionValue')
opt.key = "disk.EnableUUID"
opt.value = True
extra_config.append(opt)
port_index = 0
for vif_info in vif_infos:
if vif_info['iface_id']:

View File

@ -0,0 +1,4 @@
---
upgrade:
- Now VMwareVCDriver will set disk.EnableUUID=True by default in all guest
VM configuration file. To enable udev to generate /dev/disk/by-id