Syncs with nova
There are some small differences in the projects due to a few patches. Solves the differences. Change-Id: I6ef3890f23b4bdb9a8a3bb615f19f06d6276b1fc
This commit is contained in:
@@ -77,7 +77,7 @@ class InstanceEventHandler(object):
|
|||||||
def _poll_events(self):
|
def _poll_events(self):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# Retrieve one by one all the events that occured in
|
# Retrieve one by one all the events that occurred in
|
||||||
# the checked interval.
|
# the checked interval.
|
||||||
event = self._listener(self._WAIT_TIMEOUT)
|
event = self._listener(self._WAIT_TIMEOUT)
|
||||||
self._dispatch_event(event)
|
self._dispatch_event(event)
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class HostOps(object):
|
|||||||
|
|
||||||
# format the string to match libvirt driver uptime
|
# format the string to match libvirt driver uptime
|
||||||
# Libvirt uptime returns a combination of the following
|
# Libvirt uptime returns a combination of the following
|
||||||
# - curent host time
|
# - current host time
|
||||||
# - time since host is up
|
# - time since host is up
|
||||||
# - number of logged in users
|
# - number of logged in users
|
||||||
# - cpu load
|
# - cpu load
|
||||||
|
|||||||
@@ -282,8 +282,8 @@ class PathUtils(object):
|
|||||||
except wmi.x_wmi as exc:
|
except wmi.x_wmi as exc:
|
||||||
err_msg = (_(
|
err_msg = (_(
|
||||||
'Unable to mount SMBFS share: %(smbfs_share)s '
|
'Unable to mount SMBFS share: %(smbfs_share)s '
|
||||||
'WMI exception: %(wmi_exc)s'), {'smbfs_share': smbfs_share,
|
'WMI exception: %(wmi_exc)s') % {'smbfs_share': smbfs_share,
|
||||||
'wmi_exc': exc})
|
'wmi_exc': exc})
|
||||||
raise vmutils.HyperVException(err_msg)
|
raise vmutils.HyperVException(err_msg)
|
||||||
|
|
||||||
def unmount_smb_share(self, smbfs_share, force=False):
|
def unmount_smb_share(self, smbfs_share, force=False):
|
||||||
@@ -306,4 +306,4 @@ class PathUtils(object):
|
|||||||
# case.
|
# case.
|
||||||
if force:
|
if force:
|
||||||
raise vmutils.HyperVException(
|
raise vmutils.HyperVException(
|
||||||
_("Could not unmount share: %s"), smbfs_share)
|
_("Could not unmount share: %s") % smbfs_share)
|
||||||
|
|||||||
@@ -528,6 +528,8 @@ class VMOps(object):
|
|||||||
LOG.info(_LI("Got request to destroy instance"), instance=instance)
|
LOG.info(_LI("Got request to destroy instance"), instance=instance)
|
||||||
try:
|
try:
|
||||||
if self._vmutils.vm_exists(instance_name):
|
if self._vmutils.vm_exists(instance_name):
|
||||||
|
|
||||||
|
# Stop the VM first.
|
||||||
self._vmutils.stop_vm_jobs(instance_name)
|
self._vmutils.stop_vm_jobs(instance_name)
|
||||||
self.power_off(instance)
|
self.power_off(instance)
|
||||||
|
|
||||||
@@ -629,6 +631,7 @@ class VMOps(object):
|
|||||||
|
|
||||||
if retry_interval <= 0:
|
if retry_interval <= 0:
|
||||||
retry_interval = SHUTDOWN_TIME_INCREMENT
|
retry_interval = SHUTDOWN_TIME_INCREMENT
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if timeout and self._soft_shutdown(instance,
|
if timeout and self._soft_shutdown(instance,
|
||||||
timeout,
|
timeout,
|
||||||
@@ -638,7 +641,12 @@ class VMOps(object):
|
|||||||
self._set_vm_state(instance,
|
self._set_vm_state(instance,
|
||||||
constants.HYPERV_VM_STATE_DISABLED)
|
constants.HYPERV_VM_STATE_DISABLED)
|
||||||
except exception.InstanceNotFound:
|
except exception.InstanceNotFound:
|
||||||
pass
|
# The manager can call the stop API after receiving instance
|
||||||
|
# power off events. If this is triggered when the instance
|
||||||
|
# is being deleted, it might attempt to power off an unexisting
|
||||||
|
# instance. We'll just pass in this case.
|
||||||
|
LOG.debug("Instance not found. Skipping power off",
|
||||||
|
instance=instance)
|
||||||
|
|
||||||
def power_on(self, instance, block_device_info=None, network_info=None):
|
def power_on(self, instance, block_device_info=None, network_info=None):
|
||||||
"""Power on the specified instance."""
|
"""Power on the specified instance."""
|
||||||
|
|||||||
Reference in New Issue
Block a user