Merge "Add share_info parameter to resume method for each driver (driver part)"
This commit is contained in:
@@ -18298,10 +18298,18 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
_attach_mediated_devices):
|
||||
get_image_metadata.return_value = {'bar': 234}
|
||||
|
||||
share_info = objects.share_mapping.ShareMappingList()
|
||||
|
||||
drvr.resume(self.context, instance, network_info,
|
||||
block_device_info)
|
||||
_get_existing_domain_xml.assert_has_calls([mock.call(instance,
|
||||
network_info, block_device_info)])
|
||||
block_device_info, share_info=share_info)
|
||||
_get_existing_domain_xml.assert_has_calls(
|
||||
[mock.call(
|
||||
instance,
|
||||
network_info,
|
||||
block_device_info,
|
||||
share_info
|
||||
)]
|
||||
)
|
||||
_create_guest_with_network.assert_has_calls([
|
||||
mock.call(
|
||||
self.context, dummyxml, instance, network_info,
|
||||
|
||||
+10
-1
@@ -972,7 +972,14 @@ class ComputeDriver(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def resume(self, context, instance, network_info, block_device_info=None):
|
||||
def resume(
|
||||
self,
|
||||
context,
|
||||
instance,
|
||||
network_info,
|
||||
block_device_info=None,
|
||||
share_info=None
|
||||
):
|
||||
"""resume the specified suspended instance.
|
||||
|
||||
The suspended instance gets resumed and will use CPU cycles and memory
|
||||
@@ -988,6 +995,8 @@ class ComputeDriver(object):
|
||||
Necessary network information for the resume.
|
||||
:param dict block_device_info:
|
||||
Instance volume block device info.
|
||||
:param nova.objects.share_mapping.ShareMapingList share_info
|
||||
optional list of share_mapping
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
+8
-1
@@ -321,7 +321,14 @@ class FakeDriver(driver.ComputeDriver):
|
||||
def suspend(self, context, instance):
|
||||
pass
|
||||
|
||||
def resume(self, context, instance, network_info, block_device_info=None):
|
||||
def resume(
|
||||
self,
|
||||
context,
|
||||
instance,
|
||||
network_info,
|
||||
block_device_info=None,
|
||||
share_info=None
|
||||
):
|
||||
pass
|
||||
|
||||
def destroy(self, context, instance, network_info, block_device_info=None,
|
||||
|
||||
@@ -2441,7 +2441,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
self._disconnect_volume(context, old_connection_info, instance)
|
||||
|
||||
def _get_existing_domain_xml(self, instance, network_info,
|
||||
block_device_info=None):
|
||||
block_device_info=None, share_info=None):
|
||||
try:
|
||||
guest = self._host.get_guest(instance)
|
||||
xml = guest.get_xml_desc()
|
||||
@@ -2453,7 +2453,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
xml = self._get_guest_xml(nova_context.get_admin_context(),
|
||||
instance, network_info, disk_info,
|
||||
instance.image_meta,
|
||||
block_device_info=block_device_info)
|
||||
block_device_info=block_device_info,
|
||||
share_info=share_info)
|
||||
return xml
|
||||
|
||||
def emit_event(self, event: virtevent.InstanceEvent) -> None:
|
||||
@@ -4400,10 +4401,20 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
self._detach_mediated_devices(guest)
|
||||
guest.save_memory_state()
|
||||
|
||||
def resume(self, context, instance, network_info, block_device_info=None):
|
||||
def resume(
|
||||
self,
|
||||
context,
|
||||
instance,
|
||||
network_info,
|
||||
block_device_info=None,
|
||||
share_info=None
|
||||
):
|
||||
"""resume the specified instance."""
|
||||
if share_info is None:
|
||||
share_info = objects.ShareMappingList()
|
||||
|
||||
xml = self._get_existing_domain_xml(instance, network_info,
|
||||
block_device_info)
|
||||
block_device_info, share_info)
|
||||
# NOTE(gsantos): The mediated devices that were removed on suspension
|
||||
# are still present in the xml. Let's take their references from it
|
||||
# and re-attach them.
|
||||
|
||||
@@ -644,7 +644,14 @@ class VMwareVCDriver(driver.ComputeDriver):
|
||||
"""Suspend the specified instance."""
|
||||
self._vmops.suspend(instance)
|
||||
|
||||
def resume(self, context, instance, network_info, block_device_info=None):
|
||||
def resume(
|
||||
self,
|
||||
context,
|
||||
instance,
|
||||
network_info,
|
||||
block_device_info=None,
|
||||
share_info=None
|
||||
):
|
||||
"""Resume the suspended VM instance."""
|
||||
self._vmops.resume(instance)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user