vmware: OptionValue.value cannot be Boolean

With changing the SOAP library backing oslo.vmware [1], boolean types
will be represented as such in the generated XML while the previous SOAP
library always generated strings. For OptionValue objects, the vCenter
complains about an InvalidArgument when we send a boolean instead of a
string for the value attribute. Therefore, we change all occurrences to
strings.

[1] https://specs.openstack.org/openstack/oslo-specs/specs/victoria/oslo-vmware-soap-library-switch.html

Change-Id: I7659a48f0eeb28cb396e8476a3e2c4b7f027c0bb
This commit is contained in:
Johannes Kulik 2021-04-14 14:54:45 +02:00
parent fa59cde51f
commit 6ce1272a62
2 changed files with 11 additions and 11 deletions

View File

@ -637,7 +637,7 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.key = 'nvp.vm-uuid'
spec.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.value = 'true'
extra_config.key = 'disk.EnableUUID'
spec.extraConfig.append(extra_config)
spec.files = fake_factory.create('ns0:VirtualMachineFileInfo')
@ -738,7 +738,7 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
self.assertEqual(expected, result)
@ -764,7 +764,7 @@ 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.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
@ -818,7 +818,7 @@ 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.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
@ -871,7 +871,7 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
@ -925,7 +925,7 @@ 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.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
expected.files = fake_factory.create('ns0:VirtualMachineFileInfo')
@ -968,7 +968,7 @@ 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.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
expected.files = fake_factory.create('ns0:VirtualMachineFileInfo')
@ -1768,7 +1768,7 @@ 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.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
@ -1828,7 +1828,7 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
self.assertEqual(expected, result)
@ -1879,7 +1879,7 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
extra_config.value = self._instance.uuid
expected.extraConfig.append(extra_config)
extra_config = fake_factory.create("ns0:OptionValue")
extra_config.value = True
extra_config.value = 'true'
extra_config.key = 'disk.EnableUUID'
expected.extraConfig.append(extra_config)
self.assertEqual(expected, result)

View File

@ -276,7 +276,7 @@ def get_vm_create_spec(client_factory, instance, data_store_name,
# 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
opt.value = 'true'
extra_config.append(opt)
port_index = 0