Rename recreate to evacuate in driver signatures

This is a source of confusion, and we've already renamed it in a few
places. See removed TODO items in ComputeManager.

Change-Id: Ifdcca4cdf6c28269a0126b81f5c9aa71fc2dc5a0
This commit is contained in:
Matthew Booth 2018-04-12 14:27:13 +01:00
parent 318d353d64
commit 6182b82195
16 changed files with 28 additions and 32 deletions

View File

@ -2764,14 +2764,14 @@ class ComputeManager(manager.Manager):
injected_files, admin_password, allocations,
bdms, detach_block_devices, attach_block_devices,
network_info=None,
recreate=False, block_device_info=None,
evacuate=False, block_device_info=None,
preserve_ephemeral=False):
if preserve_ephemeral:
# The default code path does not support preserving ephemeral
# partitions.
raise exception.PreserveEphemeralNotSupported()
if recreate:
if evacuate:
detach_block_devices(context, bdms)
else:
self._power_off_instance(context, instance, clean_shutdown=True)
@ -2982,10 +2982,8 @@ class ComputeManager(manager.Manager):
hints = self._get_scheduler_hints({}, request_spec)
self._validate_instance_group_policy(context, instance, hints)
# TODO(mriedem): Rename the supports_recreate driver capability
# to supports_evacuate.
if not self.driver.capabilities.get("supports_recreate", False):
raise exception.InstanceRecreateNotSupported
if not self.driver.capabilities.get("supports_evacuate", False):
raise exception.InstanceEvacuateNotSupported
self._check_instance_exists(context, instance)
@ -3090,8 +3088,6 @@ class ComputeManager(manager.Manager):
files = self._decode_files(injected_files)
# TODO(mriedem): Rename recreate->evacuate in the driver rebuild
# method signature.
kwargs = dict(
context=context,
instance=instance,
@ -3105,7 +3101,7 @@ class ComputeManager(manager.Manager):
block_device_info=block_device_info,
network_info=network_info,
preserve_ephemeral=preserve_ephemeral,
recreate=evacuate)
evacuate=evacuate)
try:
with instance.mutated_migration_context():
self.driver.rebuild(**kwargs)

View File

@ -1601,8 +1601,8 @@ class CryptoCRLFileNotFound(FileNotFound):
msg_fmt = _("The CRL file for %(project)s could not be found")
class InstanceRecreateNotSupported(Invalid):
msg_fmt = _('Instance recreate is not supported.')
class InstanceEvacuateNotSupported(Invalid):
msg_fmt = _('Instance evacuate is not supported.')
class DBNotAllowed(NovaException):

View File

@ -12757,10 +12757,10 @@ class EvacuateHostTestCase(BaseTestCase):
def test_driver_does_not_support_recreate(self):
with mock.patch.dict(self.compute.driver.capabilities,
supports_recreate=False):
supports_evacuate=False):
self.stub_out('nova.virt.fake.FakeDriver.instance_on_disk',
lambda *a, **kw: True)
self.assertRaises(exception.InstanceRecreateNotSupported,
self.assertRaises(exception.InstanceEvacuateNotSupported,
lambda: self._rebuild(on_shared_storage=True))
@mock.patch.object(fake.FakeDriver, 'spawn')

View File

@ -4204,7 +4204,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
detach_block_devices=_detach,
attach_block_devices=_attach,
network_info=None,
recreate=False,
evacuate=False,
block_device_info=None,
preserve_ephemeral=False)

View File

@ -128,8 +128,8 @@ class IronicDriverTestCase(test.NoDBTestCase):
self.assertFalse(self.driver.capabilities['has_imagecache'],
'Driver capabilities for \'has_imagecache\''
'is invalid')
self.assertFalse(self.driver.capabilities['supports_recreate'],
'Driver capabilities for \'supports_recreate\''
self.assertFalse(self.driver.capabilities['supports_evacuate'],
'Driver capabilities for \'supports_evacuate\''
'is invalid')
self.assertFalse(self.driver.capabilities[
'supports_migrate_to_same_host'],

View File

@ -840,8 +840,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self.assertTrue(drvr.capabilities['has_imagecache'],
'Driver capabilities for \'has_imagecache\' '
'is invalid')
self.assertTrue(drvr.capabilities['supports_recreate'],
'Driver capabilities for \'supports_recreate\' '
self.assertTrue(drvr.capabilities['supports_evacuate'],
'Driver capabilities for \'supports_evacuate\' '
'is invalid')
self.assertFalse(drvr.capabilities['supports_migrate_to_same_host'],
'Driver capabilities for '

View File

@ -59,7 +59,7 @@ class TestPowerVMDriver(test.NoDBTestCase):
set(self.drv.capabilities))
# check the values for each capability
self.assertFalse(self.drv.capabilities['has_imagecache'])
self.assertFalse(self.drv.capabilities['supports_recreate'])
self.assertFalse(self.drv.capabilities['supports_evacuate'])
self.assertFalse(
self.drv.capabilities['supports_migrate_to_same_host'])
self.assertTrue(self.drv.capabilities['supports_attach_interface'])

View File

@ -284,7 +284,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase,
def test_driver_capabilities(self):
self.assertTrue(self.conn.capabilities['has_imagecache'])
self.assertFalse(self.conn.capabilities['supports_recreate'])
self.assertFalse(self.conn.capabilities['supports_evacuate'])
self.assertTrue(
self.conn.capabilities['supports_migrate_to_same_host'])

View File

@ -123,7 +123,7 @@ class ComputeDriver(object):
capabilities = {
"has_imagecache": False,
"supports_recreate": False,
"supports_evacuate": False,
"supports_migrate_to_same_host": False,
"supports_attach_interface": False,
"supports_device_tagging": False,
@ -231,7 +231,7 @@ class ComputeDriver(object):
def rebuild(self, context, instance, image_meta, injected_files,
admin_password, allocations, bdms, detach_block_devices,
attach_block_devices, network_info=None,
recreate=False, block_device_info=None,
evacuate=False, block_device_info=None,
preserve_ephemeral=False):
"""Destroy and re-make this instance.
@ -263,7 +263,7 @@ class ComputeDriver(object):
nova.compute.manager.ComputeManager:_rebuild_default_impl for
usage.
:param network_info: instance network information
:param recreate: True if the instance is being recreated on a new
:param evacuate: True if the instance is being recreated on a new
hypervisor - all the cleanup of old state is skipped.
:param block_device_info: Information about block devices to be
attached to the instance.

View File

@ -123,7 +123,7 @@ class Resources(object):
class FakeDriver(driver.ComputeDriver):
capabilities = {
"has_imagecache": True,
"supports_recreate": True,
"supports_evacuate": True,
"supports_migrate_to_same_host": True,
"supports_attach_interface": True,
"supports_tagged_attach_interface": True,

View File

@ -94,7 +94,7 @@ exception_conversion_map = {
class HyperVDriver(driver.ComputeDriver):
capabilities = {
"has_imagecache": True,
"supports_recreate": False,
"supports_evacuate": False,
"supports_migrate_to_same_host": False,
"supports_attach_interface": True,
"supports_device_tagging": True,

View File

@ -131,7 +131,7 @@ class IronicDriver(virt_driver.ComputeDriver):
"""Hypervisor driver for Ironic - bare metal provisioning."""
capabilities = {"has_imagecache": False,
"supports_recreate": False,
"supports_evacuate": False,
"supports_migrate_to_same_host": False,
"supports_attach_interface": True,
"supports_multiattach": False
@ -1496,7 +1496,7 @@ class IronicDriver(virt_driver.ComputeDriver):
def rebuild(self, context, instance, image_meta, injected_files,
admin_password, allocations, bdms, detach_block_devices,
attach_block_devices, network_info=None,
recreate=False, block_device_info=None,
evacuate=False, block_device_info=None,
preserve_ephemeral=False):
"""Rebuild/redeploy an instance.
@ -1530,7 +1530,7 @@ class IronicDriver(virt_driver.ComputeDriver):
usage. Ignored by this driver.
:param network_info: Instance network information. Ignored by
this driver.
:param recreate: Boolean value; if True the instance is
:param evacuate: Boolean value; if True the instance is
recreated on a new hypervisor - all the cleanup of old state is
skipped. Ignored by this driver.
:param block_device_info: Instance block device

View File

@ -335,7 +335,7 @@ MIN_MIGRATION_SPEED_BW = 1 # 1 MiB/s
class LibvirtDriver(driver.ComputeDriver):
capabilities = {
"has_imagecache": True,
"supports_recreate": True,
"supports_evacuate": True,
"supports_migrate_to_same_host": False,
"supports_attach_interface": True,
"supports_device_tagging": True,

View File

@ -57,7 +57,7 @@ class PowerVMDriver(driver.ComputeDriver):
# capabilities on the instance rather than on the class.
self.capabilities = {
'has_imagecache': False,
'supports_recreate': False,
'supports_evacuate': False,
'supports_migrate_to_same_host': False,
'supports_attach_interface': True,
'supports_device_tagging': False,

View File

@ -63,7 +63,7 @@ class VMwareVCDriver(driver.ComputeDriver):
capabilities = {
"has_imagecache": True,
"supports_recreate": False,
"supports_evacuate": False,
"supports_migrate_to_same_host": True,
"supports_attach_interface": True,
"supports_multiattach": False

View File

@ -69,7 +69,7 @@ class XenAPIDriver(driver.ComputeDriver):
"""A connection to XenServer or Xen Cloud Platform."""
capabilities = {
"has_imagecache": False,
"supports_recreate": False,
"supports_evacuate": False,
"supports_migrate_to_same_host": False,
"supports_attach_interface": True,
"supports_device_tagging": True,