diff --git a/hyperv/nova/imagecache.py b/hyperv/nova/imagecache.py index 07b1f493..a81d5da3 100644 --- a/hyperv/nova/imagecache.py +++ b/hyperv/nova/imagecache.py @@ -18,12 +18,12 @@ Image caching and management. import os import re +import nova.conf from nova import exception from nova import utils from nova.virt import imagecache from nova.virt import images from os_win import utilsfactory -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import units @@ -34,7 +34,7 @@ from hyperv.nova import pathutils LOG = logging.getLogger(__name__) -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.import_opt('use_cow_images', 'nova.virt.driver') CONF.import_opt('instances_path', 'nova.compute.manager') CONF.import_opt('remove_unused_original_minimum_age_seconds', diff --git a/hyperv/nova/livemigrationops.py b/hyperv/nova/livemigrationops.py index a6b36bda..abb8b612 100644 --- a/hyperv/nova/livemigrationops.py +++ b/hyperv/nova/livemigrationops.py @@ -18,8 +18,9 @@ Management class for live migration VM operations. """ import functools +import nova.conf +from nova.objects import migrate_data as migrate_data_obj from os_win import utilsfactory -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils @@ -32,8 +33,7 @@ from hyperv.nova import vmops from hyperv.nova import volumeops LOG = logging.getLogger(__name__) -CONF = cfg.CONF -CONF.import_opt('use_cow_images', 'nova.virt.driver') +CONF = nova.conf.CONF def check_os_version_requirement(function): @@ -122,7 +122,7 @@ class LiveMigrationOps(object): block_migration=False, disk_over_commit=False): LOG.debug("check_can_live_migrate_destination called", instance_ref) - return {} + return migrate_data_obj.LiveMigrateData() @check_os_version_requirement def check_can_live_migrate_destination_cleanup(self, ctxt, diff --git a/hyperv/nova/pathutils.py b/hyperv/nova/pathutils.py index 4dbf92fa..c712b6aa 100644 --- a/hyperv/nova/pathutils.py +++ b/hyperv/nova/pathutils.py @@ -19,13 +19,10 @@ import time from nova import exception from os_win.utils import pathutils from oslo_config import cfg -from oslo_log import log as logging from hyperv.i18n import _ from hyperv.nova import constants -LOG = logging.getLogger(__name__) - hyperv_opts = [ cfg.StrOpt('instances_path_share', default="", diff --git a/hyperv/nova/snapshotops.py b/hyperv/nova/snapshotops.py index e2184739..1bc24210 100644 --- a/hyperv/nova/snapshotops.py +++ b/hyperv/nova/snapshotops.py @@ -24,13 +24,11 @@ from nova.image import glance from nova import utils from os_win import exceptions as os_win_exc from os_win import utilsfactory -from oslo_config import cfg from oslo_log import log as logging -from hyperv.i18n import _LW +from hyperv.i18n import _LE from hyperv.nova import pathutils -CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -60,7 +58,7 @@ class SnapshotOps(object): try: instance_synchronized_snapshot() except os_win_exc.HyperVVMNotFoundException: - # the instance might dissapear before starting the operation. + # the instance might disappear before starting the operation. raise exception.InstanceNotFound(instance_id=instance.uuid) def _snapshot(self, context, instance, image_id, update_task_state): @@ -129,10 +127,9 @@ class SnapshotOps(object): try: LOG.debug("Removing snapshot %s", image_id) self._vmutils.remove_vm_snapshot(snapshot_path) - except Exception as ex: - LOG.exception(ex) - LOG.warning(_LW('Failed to remove snapshot for VM %s'), - instance_name) + except Exception: + LOG.exception(_LE('Failed to remove snapshot for VM %s'), + instance_name, instance=instance) if export_dir: LOG.debug('Removing directory: %s', export_dir) self._pathutils.rmtree(export_dir) diff --git a/hyperv/nova/vif.py b/hyperv/nova/vif.py index 831a8a5b..a6a9dc0e 100644 --- a/hyperv/nova/vif.py +++ b/hyperv/nova/vif.py @@ -20,7 +20,6 @@ from nova.i18n import _ from nova.network import model as network_model from os_win import utilsfactory from oslo_config import cfg -from oslo_log import log as logging from hyperv.nova import ovsutils @@ -36,8 +35,6 @@ CONF = cfg.CONF CONF.register_opts(hyperv_opts, 'hyperv') CONF.import_opt('network_api_class', 'nova.network') -LOG = logging.getLogger(__name__) - class HyperVBaseVIFDriver(object): @abc.abstractmethod diff --git a/hyperv/nova/vmops.py b/hyperv/nova/vmops.py index 2070b3f1..1f438ad2 100644 --- a/hyperv/nova/vmops.py +++ b/hyperv/nova/vmops.py @@ -24,6 +24,7 @@ import time from eventlet import timeout as etimeout from nova.api.metadata import base as instance_metadata from nova.compute import vm_states +import nova.conf from nova import exception from nova import objects from nova import utils @@ -95,7 +96,7 @@ hyperv_opts = [ 'RDS-Virtualization feature has to be enabled') ] -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.register_opts(hyperv_opts, 'hyperv') CONF.import_opt('use_cow_images', 'nova.virt.driver')