Allow block_migration and disk_over_commit to be None
Bump compute rpc api to 4.11 to allow block_migration and disk_over_commit to be None for check_can_live_migrate_destination. If compute rcp client get request with vesion lower than 4.10 and one of block_migration or disk_over_commit is None value, raise an exception LiveMigrationWithOldNovaNotSupported. Partially implements: blueprint making-live-migration-api-friendly Change-Id: I43119bfd2769888b2802ab0a51ba7becedaf569d
This commit is contained in:
committed by
Pawel Koniszewski
parent
10da208f02
commit
bde716442c
@@ -673,7 +673,7 @@ class ComputeVirtAPI(virtapi.VirtAPI):
|
||||
class ComputeManager(manager.Manager):
|
||||
"""Manages the running instances from creation to destruction."""
|
||||
|
||||
target = messaging.Target(version='4.10')
|
||||
target = messaging.Target(version='4.11')
|
||||
|
||||
# How long to wait in seconds before re-issuing a shutdown
|
||||
# signal to an instance during power off. The overall
|
||||
@@ -5050,7 +5050,9 @@ class ComputeManager(manager.Manager):
|
||||
:param context: security context
|
||||
:param instance: dict of instance data
|
||||
:param block_migration: if true, prepare for block migration
|
||||
if None, calculate it in driver
|
||||
:param disk_over_commit: if true, allow disk over commit
|
||||
if None, ignore disk usage checking
|
||||
:returns: a dict containing migration info
|
||||
"""
|
||||
return self._do_check_can_live_migrate_destination(ctxt, instance,
|
||||
|
||||
@@ -327,6 +327,7 @@ class ComputeAPI(object):
|
||||
* ... - Remove refresh_provider_fw_rules()
|
||||
* 4.9 - Add live_migration_force_complete()
|
||||
* 4.10 - Add live_migration_abort()
|
||||
* 4.11 - Allow block_migration and disk_over_commit be None
|
||||
'''
|
||||
|
||||
VERSION_ALIASES = {
|
||||
@@ -435,7 +436,18 @@ class ComputeAPI(object):
|
||||
|
||||
def check_can_live_migrate_destination(self, ctxt, instance, destination,
|
||||
block_migration, disk_over_commit):
|
||||
version = '4.0'
|
||||
version = '4.11'
|
||||
if not self.client.can_send_version(version):
|
||||
# NOTE(eliqiao): This is a new feature that is only available
|
||||
# once all compute nodes support at least version 4.11.
|
||||
# This means the new REST API that supports this needs to handle
|
||||
# this exception correctly. This can all be removed when we bump
|
||||
# the major version of this RPC API.
|
||||
if block_migration is None or disk_over_commit is None:
|
||||
raise exception.LiveMigrationWithOldNovaNotSupported()
|
||||
else:
|
||||
version = '4.0'
|
||||
|
||||
cctxt = self.client.prepare(server=destination, version=version)
|
||||
result = cctxt.call(ctxt, 'check_can_live_migrate_destination',
|
||||
instance=instance,
|
||||
|
||||
@@ -1857,6 +1857,11 @@ class LiveMigrationWithOldNovaNotSafe(NovaException):
|
||||
"Upgrade Nova on %(server)s and try again.")
|
||||
|
||||
|
||||
class LiveMigrationWithOldNovaNotSupported(NovaException):
|
||||
msg_fmt = _("Live migration with API v2.25 requires all the Mitaka "
|
||||
"upgrade to be complete before it is available.")
|
||||
|
||||
|
||||
class LiveMigrationURINotAvailable(NovaException):
|
||||
msg_fmt = _('No live migration URI configured and no default available '
|
||||
'for "%(virt_type)s" hypervisor virtualization type.')
|
||||
|
||||
@@ -29,7 +29,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# NOTE(danms): This is the global service version counter
|
||||
SERVICE_VERSION = 8
|
||||
SERVICE_VERSION = 9
|
||||
|
||||
|
||||
# NOTE(danms): This is our SERVICE_VERSION history. The idea is that any
|
||||
@@ -69,6 +69,8 @@ SERVICE_VERSION_HISTORY = (
|
||||
{'compute_rpc': '4.9'},
|
||||
# Version 8: Add live_migration_abort in the compute_rpc
|
||||
{'compute_rpc': '4.10'},
|
||||
# Version 9: Allow block_migration and disk_over_commit be None
|
||||
{'compute_rpc': '4.11'},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -666,3 +666,13 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
|
||||
'migrate_data': {}},
|
||||
callret=None,
|
||||
calltype='cast')
|
||||
|
||||
def test_check_can_live_migrate_destination_old_compute(self):
|
||||
self.flags(compute='4.10', group='upgrade_levels')
|
||||
self.assertRaises(exception.LiveMigrationWithOldNovaNotSupported,
|
||||
self._test_compute_api,
|
||||
'check_can_live_migrate_destination', 'call',
|
||||
instance=self.fake_instance_obj,
|
||||
block_migration=None,
|
||||
destination='dest',
|
||||
disk_over_commit=None, version='4.11')
|
||||
|
||||
Reference in New Issue
Block a user