From c028e54f6be75d1cd335550cf5291ddf94f973e3 Mon Sep 17 00:00:00 2001 From: Dan Wendlandt Date: Sat, 25 May 2013 14:22:23 -0700 Subject: correctly set iface-id in vmware driver bug 1183452 Commit 70c659059b8fbef811ce79700aecb01c60242ebd updated the vmware driver to use the new vif model, but was incorrect in how it tried to grab the iface-id and set it in the vmx file spec. This patch fixes that issue and adds a check for this in the existing unit tests. Change-Id: I756539871d1844a828f9a0a295fc9fa3e59610f7 --- nova/tests/virt/vmwareapi/test_vmwareapi.py | 11 +++++++++++ nova/virt/vmwareapi/fake.py | 3 ++- nova/virt/vmwareapi/vmops.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nova/tests/virt/vmwareapi/test_vmwareapi.py b/nova/tests/virt/vmwareapi/test_vmwareapi.py index 2691857fe..da9ed1467 100644 --- a/nova/tests/virt/vmwareapi/test_vmwareapi.py +++ b/nova/tests/virt/vmwareapi/test_vmwareapi.py @@ -185,6 +185,17 @@ class VMwareAPIVMTestCase(test.TestCase): # Check that the VM is running according to vSphere API. self.assertEquals(vm.get("runtime.powerState"), 'poweredOn') + found_vm_uuid = False + found_iface_id = False + for c in vm.get("config.extraConfig"): + if (c.key == "nvp.vm-uuid" and c.value == self.instance['uuid']): + found_vm_uuid = True + if (c.key == "nvp.iface-id.0" and c.value == "vif-xxx-yyy-zzz"): + found_iface_id = True + + self.assertTrue(found_vm_uuid) + self.assertTrue(found_iface_id) + def _check_vm_info(self, info, pwr_state=power_state.RUNNING): """ Check if the get_info returned values correspond to the instance diff --git a/nova/virt/vmwareapi/fake.py b/nova/virt/vmwareapi/fake.py index 86b6e5fc2..65910f745 100644 --- a/nova/virt/vmwareapi/fake.py +++ b/nova/virt/vmwareapi/fake.py @@ -583,7 +583,8 @@ class FakeVim(object): "powerstate": "poweredOff", "vmPathName": config_spec.files.vmPathName, "numCpu": config_spec.numCPUs, - "mem": config_spec.memoryMB} + "mem": config_spec.memoryMB, + "extra_config": config_spec.extraConfig} virtual_machine = VirtualMachine(**vm_dict) _create_object("VirtualMachine", virtual_machine) task_mdo = create_task(method, "success") diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py index 538b498b6..3d6ef86af 100644 --- a/nova/virt/vmwareapi/vmops.py +++ b/nova/virt/vmwareapi/vmops.py @@ -182,7 +182,7 @@ class VMwareVMOps(object): vif_infos.append({'network_name': network_name, 'mac_address': mac_address, 'network_ref': network_ref, - 'iface_id': vif.get_meta('iface_id'), + 'iface_id': vif['id'], }) return vif_infos -- cgit