Merge "objects: Rename PciDevice _migrate_parent_addr method"
This commit is contained in:
commit
dbdf27021c
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue