Hyper-V: Removes pointless check in livemigrationops
Support for Windows / Hyper-V Server 2008 R2 has been deprecated in Liberty and it is no longer supported in Mitaka. This was missed in the previous commit: I1ec83f852d23758bc91da8fd8021b1bed34c63b3 Co-Authored-By: Andrei Bacos <abacos@cloudbasesolutions.com> Change-Id: I389364a9111b7b115991b31798a4c32268c90dda Related-Bug: #1508066
This commit is contained in:
@@ -16,14 +16,12 @@
|
|||||||
"""
|
"""
|
||||||
Management class for live migration VM operations.
|
Management class for live migration VM operations.
|
||||||
"""
|
"""
|
||||||
import functools
|
|
||||||
|
|
||||||
from os_win import utilsfactory
|
from os_win import utilsfactory
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from hyperv.i18n import _
|
|
||||||
from hyperv.nova import block_device_manager
|
from hyperv.nova import block_device_manager
|
||||||
from hyperv.nova import imagecache
|
from hyperv.nova import imagecache
|
||||||
from hyperv.nova import pathutils
|
from hyperv.nova import pathutils
|
||||||
@@ -36,25 +34,9 @@ CONF = cfg.CONF
|
|||||||
CONF.import_opt('use_cow_images', 'nova.virt.driver')
|
CONF.import_opt('use_cow_images', 'nova.virt.driver')
|
||||||
|
|
||||||
|
|
||||||
def check_os_version_requirement(function):
|
|
||||||
@functools.wraps(function)
|
|
||||||
def wrapper(self, *args, **kwds):
|
|
||||||
if not self._livemigrutils:
|
|
||||||
raise NotImplementedError(_('Live migration is supported '
|
|
||||||
'starting with Hyper-V Server '
|
|
||||||
'2012'))
|
|
||||||
return function(self, *args, **kwds)
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
class LiveMigrationOps(object):
|
class LiveMigrationOps(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Live migration is supported starting from Hyper-V Server 2012
|
|
||||||
if utilsfactory.get_hostutils().check_min_windows_version(6, 2):
|
|
||||||
self._livemigrutils = utilsfactory.get_livemigrationutils()
|
self._livemigrutils = utilsfactory.get_livemigrationutils()
|
||||||
else:
|
|
||||||
self._livemigrutils = None
|
|
||||||
|
|
||||||
self._pathutils = pathutils.PathUtils()
|
self._pathutils = pathutils.PathUtils()
|
||||||
self._vmops = vmops.VMOps()
|
self._vmops = vmops.VMOps()
|
||||||
self._volumeops = volumeops.VolumeOps()
|
self._volumeops = volumeops.VolumeOps()
|
||||||
@@ -62,7 +44,6 @@ class LiveMigrationOps(object):
|
|||||||
self._imagecache = imagecache.ImageCache()
|
self._imagecache = imagecache.ImageCache()
|
||||||
self._block_dev_man = block_device_manager.BlockDeviceInfoManager()
|
self._block_dev_man = block_device_manager.BlockDeviceInfoManager()
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def live_migration(self, context, instance_ref, dest, post_method,
|
def live_migration(self, context, instance_ref, dest, post_method,
|
||||||
recover_method, block_migration=False,
|
recover_method, block_migration=False,
|
||||||
migrate_data=None):
|
migrate_data=None):
|
||||||
@@ -89,7 +70,6 @@ class LiveMigrationOps(object):
|
|||||||
instance_name)
|
instance_name)
|
||||||
post_method(context, instance_ref, dest, block_migration)
|
post_method(context, instance_ref, dest, block_migration)
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def pre_live_migration(self, context, instance, block_device_info,
|
def pre_live_migration(self, context, instance, block_device_info,
|
||||||
network_info):
|
network_info):
|
||||||
LOG.debug("pre_live_migration called", instance=instance)
|
LOG.debug("pre_live_migration called", instance=instance)
|
||||||
@@ -103,20 +83,17 @@ class LiveMigrationOps(object):
|
|||||||
|
|
||||||
self._volumeops.initialize_volumes_connection(block_device_info)
|
self._volumeops.initialize_volumes_connection(block_device_info)
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def post_live_migration(self, context, instance, block_device_info):
|
def post_live_migration(self, context, instance, block_device_info):
|
||||||
self._volumeops.disconnect_volumes(block_device_info)
|
self._volumeops.disconnect_volumes(block_device_info)
|
||||||
self._pathutils.get_instance_dir(instance.name,
|
self._pathutils.get_instance_dir(instance.name,
|
||||||
create_dir=False,
|
create_dir=False,
|
||||||
remove_dir=True)
|
remove_dir=True)
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def post_live_migration_at_destination(self, ctxt, instance_ref,
|
def post_live_migration_at_destination(self, ctxt, instance_ref,
|
||||||
network_info, block_migration):
|
network_info, block_migration):
|
||||||
LOG.debug("post_live_migration_at_destination called",
|
LOG.debug("post_live_migration_at_destination called",
|
||||||
instance=instance_ref)
|
instance=instance_ref)
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def check_can_live_migrate_destination(self, ctxt, instance_ref,
|
def check_can_live_migrate_destination(self, ctxt, instance_ref,
|
||||||
src_compute_info, dst_compute_info,
|
src_compute_info, dst_compute_info,
|
||||||
block_migration=False,
|
block_migration=False,
|
||||||
@@ -124,12 +101,10 @@ class LiveMigrationOps(object):
|
|||||||
LOG.debug("check_can_live_migrate_destination called", instance_ref)
|
LOG.debug("check_can_live_migrate_destination called", instance_ref)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def check_can_live_migrate_destination_cleanup(self, ctxt,
|
def check_can_live_migrate_destination_cleanup(self, ctxt,
|
||||||
dest_check_data):
|
dest_check_data):
|
||||||
LOG.debug("check_can_live_migrate_destination_cleanup called")
|
LOG.debug("check_can_live_migrate_destination_cleanup called")
|
||||||
|
|
||||||
@check_os_version_requirement
|
|
||||||
def check_can_live_migrate_source(self, ctxt, instance_ref,
|
def check_can_live_migrate_source(self, ctxt, instance_ref,
|
||||||
dest_check_data):
|
dest_check_data):
|
||||||
LOG.debug("check_can_live_migrate_source called", instance_ref)
|
LOG.debug("check_can_live_migrate_source called", instance_ref)
|
||||||
|
|||||||
@@ -76,15 +76,6 @@ class LiveMigrationOpsTestCase(test_base.HyperVBaseTestCase):
|
|||||||
def test_live_migration_exception(self):
|
def test_live_migration_exception(self):
|
||||||
self._test_live_migration(side_effect=os_win_exc.HyperVException)
|
self._test_live_migration(side_effect=os_win_exc.HyperVException)
|
||||||
|
|
||||||
def test_live_migration_wrong_os_version(self):
|
|
||||||
self._livemigrops._livemigrutils = None
|
|
||||||
self.assertRaises(NotImplementedError,
|
|
||||||
self._livemigrops.live_migration, self.context,
|
|
||||||
instance_ref=mock.DEFAULT,
|
|
||||||
dest=mock.sentinel.DESTINATION,
|
|
||||||
post_method=mock.DEFAULT,
|
|
||||||
recover_method=mock.DEFAULT)
|
|
||||||
|
|
||||||
@mock.patch('hyperv.nova.imagecache.ImageCache.get_cached_image')
|
@mock.patch('hyperv.nova.imagecache.ImageCache.get_cached_image')
|
||||||
@mock.patch('hyperv.nova.volumeops.VolumeOps'
|
@mock.patch('hyperv.nova.volumeops.VolumeOps'
|
||||||
'.initialize_volumes_connection')
|
'.initialize_volumes_connection')
|
||||||
|
|||||||
Reference in New Issue
Block a user