diff --git a/nova/tests/unit/virt/vmwareapi/test_vm_util.py b/nova/tests/unit/virt/vmwareapi/test_vm_util.py index 3b6b1a72567b..320301b7f153 100644 --- a/nova/tests/unit/virt/vmwareapi/test_vm_util.py +++ b/nova/tests/unit/virt/vmwareapi/test_vm_util.py @@ -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): diff --git a/nova/virt/vmwareapi/vm_util.py b/nova/virt/vmwareapi/vm_util.py index 50fbf95e3d9e..d60b76734b4a 100644 --- a/nova/virt/vmwareapi/vm_util.py +++ b/nova/virt/vmwareapi/vm_util.py @@ -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']: diff --git a/releasenotes/notes/vmware_disk_enableuuid_true-99b88e00fc168dd3.yaml b/releasenotes/notes/vmware_disk_enableuuid_true-99b88e00fc168dd3.yaml new file mode 100644 index 000000000000..0aa96455fe7b --- /dev/null +++ b/releasenotes/notes/vmware_disk_enableuuid_true-99b88e00fc168dd3.yaml @@ -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