From bda08f6a0713951db60adf62e44739bdea093b17 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Fri, 11 Jan 2013 10:20:43 +1300 Subject: Change ComputerDriver.legacy_nwinfo to raise by default. This makes non-updated hypervisors visible by grepping for 'def legacy_nwinfo' rather than only the updated ones being visible, and when new hypervisors are added, it will be clear whether they use the legacy format or not. Out of tree hypervisors will be broken by this, but the fix is trivial:: def legacy_nwinfo(self): # XXX TODO Update to use the non-legacy format. return True Change-Id: If5b461bc5d8e8dc21de3ca9cf521e7b341724900 --- nova/tests/compute/test_resource_tracker.py | 6 ++++++ nova/virt/baremetal/driver.py | 3 +++ nova/virt/driver.py | 9 ++++----- nova/virt/fake.py | 3 +++ nova/virt/libvirt/driver.py | 3 +++ nova/virt/vmwareapi/driver.py | 3 +++ 6 files changed, 22 insertions(+), 5 deletions(-) (limited to 'nova') diff --git a/nova/tests/compute/test_resource_tracker.py b/nova/tests/compute/test_resource_tracker.py index afe05abe0..f5d523ec1 100644 --- a/nova/tests/compute/test_resource_tracker.py +++ b/nova/tests/compute/test_resource_tracker.py @@ -50,6 +50,9 @@ class UnsupportedVirtDriver(driver.ComputeDriver): # no support for getting resource usage info return {} + def legacy_nwinfo(self): + return True + class FakeVirtDriver(driver.ComputeDriver): @@ -80,6 +83,9 @@ class FakeVirtDriver(driver.ComputeDriver): } return d + def legacy_nwinfo(self): + return True + class BaseTestCase(test.TestCase): diff --git a/nova/virt/baremetal/driver.py b/nova/virt/baremetal/driver.py index 3659da711..462e0c444 100644 --- a/nova/virt/baremetal/driver.py +++ b/nova/virt/baremetal/driver.py @@ -166,6 +166,9 @@ class BareMetalDriver(driver.ComputeDriver): # TODO(deva): define the version properly elsewhere return 1 + def legacy_nwinfo(self): + return True + def list_instances(self): l = [] ctx = nova_context.get_admin_context() diff --git a/nova/virt/driver.py b/nova/virt/driver.py index b6a8a91ad..e396de6a0 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -727,11 +727,10 @@ class ComputeDriver(object): raise NotImplementedError() def legacy_nwinfo(self): - """ - Indicate if the driver requires the legacy network_info format. - """ - # TODO(tr3buchet): update all subclasses and remove this - return True + """True if the driver requires the legacy network_info format.""" + # TODO(tr3buchet): update all subclasses and remove this method and + # related helpers. + raise NotImplementedError(self.legacy_nwinfo) def manage_image_cache(self, context, all_instances): """ diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 88346cc3a..0a29a6d67 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -403,6 +403,9 @@ class FakeDriver(driver.ComputeDriver): def list_instance_uuids(self): return [] + def legacy_nwinfo(self): + return True + class FakeVirtAPI(virtapi.VirtAPI): def instance_update(self, context, instance_uuid, updates): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index ea6e0e6a0..66bd3bdaf 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -433,6 +433,9 @@ class LibvirtDriver(driver.ComputeDriver): except exception.NovaException: return False + def legacy_nwinfo(self): + return True + # TODO(Shrews): Remove when libvirt Bugzilla bug # 836647 is fixed. def list_instance_ids(self): if self._conn.numOfDomains() == 0: diff --git a/nova/virt/vmwareapi/driver.py b/nova/virt/vmwareapi/driver.py index c883d1edb..8734df1f6 100644 --- a/nova/virt/vmwareapi/driver.py +++ b/nova/virt/vmwareapi/driver.py @@ -118,6 +118,9 @@ class VMWareESXDriver(driver.ComputeDriver): # FIXME(sateesh): implement this pass + def legacy_nwinfo(self): + return True + def list_instances(self): """List VM instances.""" return self._vmops.list_instances() -- cgit