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

Change-Id: I389364a9111b7b115991b31798a4c32268c90dda
Related-Bug: #1508066
This commit is contained in:
Andrei Bacos
2016-02-19 18:47:02 +02:00
parent d51c5670d8
commit a8c474c5ec
2 changed files with 1 additions and 35 deletions

View File

@@ -72,15 +72,6 @@ class LiveMigrationOpsTestCase(test_base.HyperVBaseTestCase):
def test_live_migration_exception(self):
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('nova.virt.hyperv.volumeops.VolumeOps'
'.ebs_root_in_block_devices')
@mock.patch('nova.virt.hyperv.imagecache.ImageCache.get_cached_image')

View File

@@ -16,14 +16,12 @@
"""
Management class for live migration VM operations.
"""
import functools
from os_win import utilsfactory
from oslo_log import log as logging
from oslo_utils import excutils
import nova.conf
from nova.i18n import _
from nova.objects import migrate_data as migrate_data_obj
from nova.virt.hyperv import imagecache
from nova.virt.hyperv import pathutils
@@ -34,32 +32,15 @@ LOG = logging.getLogger(__name__)
CONF = nova.conf.CONF
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):
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()
else:
self._livemigrutils = None
self._livemigrutils = utilsfactory.get_livemigrationutils()
self._pathutils = pathutils.PathUtils()
self._vmops = vmops.VMOps()
self._volumeops = volumeops.VolumeOps()
self._imagecache = imagecache.ImageCache()
self._vmutils = utilsfactory.get_vmutils()
@check_os_version_requirement
def live_migration(self, context, instance_ref, dest, post_method,
recover_method, block_migration=False,
migrate_data=None):
@@ -81,7 +62,6 @@ class LiveMigrationOps(object):
instance_name)
post_method(context, instance_ref, dest, block_migration)
@check_os_version_requirement
def pre_live_migration(self, context, instance, block_device_info,
network_info):
LOG.debug("pre_live_migration called", instance=instance)
@@ -95,14 +75,12 @@ class LiveMigrationOps(object):
self._volumeops.initialize_volumes_connection(block_device_info)
@check_os_version_requirement
def post_live_migration(self, context, instance, block_device_info):
self._volumeops.disconnect_volumes(block_device_info)
self._pathutils.get_instance_dir(instance.name,
create_dir=False,
remove_dir=True)
@check_os_version_requirement
def post_live_migration_at_destination(self, ctxt, instance_ref,
network_info, block_migration):
LOG.debug("post_live_migration_at_destination called",
@@ -110,7 +88,6 @@ class LiveMigrationOps(object):
self._vmops.log_vm_serial_output(instance_ref['name'],
instance_ref['uuid'])
@check_os_version_requirement
def check_can_live_migrate_destination(self, ctxt, instance_ref,
src_compute_info, dst_compute_info,
block_migration=False,
@@ -118,12 +95,10 @@ class LiveMigrationOps(object):
LOG.debug("check_can_live_migrate_destination called", instance_ref)
return migrate_data_obj.LiveMigrateData()
@check_os_version_requirement
def check_can_live_migrate_destination_cleanup(self, ctxt,
dest_check_data):
LOG.debug("check_can_live_migrate_destination_cleanup called")
@check_os_version_requirement
def check_can_live_migrate_source(self, ctxt, instance_ref,
dest_check_data):
LOG.debug("check_can_live_migrate_source called", instance_ref)