diff --git a/nova/objects/base.py b/nova/objects/base.py index b0c98e055986..cf938ab24ef5 100644 --- a/nova/objects/base.py +++ b/nova/objects/base.py @@ -71,6 +71,16 @@ class NovaObject(ovoo_base.VersionedObject): OBJ_SERIAL_NAMESPACE = 'nova_object' OBJ_PROJECT_NAMESPACE = 'nova' + # NOTE(ndipanov): This is nova-specific + @staticmethod + def should_migrate_data(): + """A check that can be used to inhibit online migration behavior + + This is usually used to check if all services that will be accessing + the db directly are ready for the new format. + """ + raise NotImplementedError() + # NOTE(danms): This has some minor change between the nova and o.vo # version, so avoid inheriting it for the moment so we can make that # transition separately for clarity. diff --git a/nova/objects/pci_device.py b/nova/objects/pci_device.py index edcb2d87d9c0..5dbc949be00d 100644 --- a/nova/objects/pci_device.py +++ b/nova/objects/pci_device.py @@ -113,7 +113,7 @@ class PciDevice(base.NovaPersistentObject, base.NovaObject): } @staticmethod - def _migrate_parent_addr(): + def should_migrate_data(): # NOTE(ndipanov): Only migrate parent_addr if all services are up to at # least version 4 - this should only ever be called from save() services = ('conductor', 'api') @@ -231,7 +231,7 @@ class PciDevice(base.NovaPersistentObject, base.NovaObject): self.address) elif self.status != fields.PciDeviceStatus.DELETED: updates = self.obj_get_changes() - if not self._migrate_parent_addr(): + if not self.should_migrate_data(): # NOTE(ndipanov): If we are not migrating data yet, make sure # that any changes to parent_addr are also in the old location # in extra_info diff --git a/nova/tests/unit/pci/test_manager.py b/nova/tests/unit/pci/test_manager.py index 553e9aead07a..665d20920ee4 100644 --- a/nova/tests/unit/pci/test_manager.py +++ b/nova/tests/unit/pci/test_manager.py @@ -274,7 +274,7 @@ class PciDevTrackerTestCase(test.NoDBTestCase): dev in self.tracker.pci_devs]), set(['v', 'v1'])) - @mock.patch.object(objects.PciDevice, '_migrate_parent_addr', + @mock.patch.object(objects.PciDevice, 'should_migrate_data', return_value=False) def test_save(self, migrate_mock): self.stub_out(