Allow VMs to be resumed after a hypervisor reboot

Fixes bug 1052696.

Update the compute manager to pass network_info and block_device_info
to the driver.resume() and update all virtualization drivers to accept
the new arguments.

For libvirt, change resume() to use _create_domain_and_network()
rather than _create_domain(). This eliminates the assumption that the
network and block device connections remained in place from the period
between the VM being suspended and resumed.  Instead, all the
networking and block connections will be rebuilt on resume (in case
they are missing) as is the case after a hypervisor reboot.

Change-Id: I6e19ec42f7e929678abce8f276c0a6e91f1fa8af
This commit is contained in:
Rafi Khardalian
2012-09-04 13:37:46 +00:00
parent 3b635d09c2
commit 4bb9a5df44
3 changed files with 11 additions and 5 deletions

View File

@@ -215,21 +215,21 @@ class VMWareAPIVMTestCase(test.TestCase):
self.conn.suspend(self.instance)
info = self.conn.get_info({'name': 1})
self._check_vm_info(info, power_state.PAUSED)
self.conn.resume(self.instance)
self.conn.resume(self.instance, self.network_info)
info = self.conn.get_info({'name': 1})
self._check_vm_info(info, power_state.RUNNING)
def test_resume_non_existent(self):
self._create_instance_in_the_db()
self.assertRaises(exception.InstanceNotFound, self.conn.resume,
self.instance)
self.instance, self.network_info)
def test_resume_not_suspended(self):
self._create_vm()
info = self.conn.get_info({'name': 1})
self._check_vm_info(info, power_state.RUNNING)
self.assertRaises(exception.InstanceResumeFailure, self.conn.resume,
self.instance)
self.instance, self.network_info)
def test_get_info(self):
self._create_vm()