Recache or rebuild missing images on hard_reboot
The primary purpose of this change is to provide the ability to re-cache missing backing files on hard_reboot. The old pre_block_migration function was already performing a very similar operation. That function has been refactored to be idempotent and renamed to _create_images_and_backing. The pre_block_migration function is a wrapper, with some additional checking, around the renamed function. Image backend was also adjusted to look for either a missing backing file or disk image, recaching or creating accordingly. It should also be idempotent, never clobbering existing images. Change-Id: Icf4c488d6db59e732b463d08d0606b428ee1e7b9
This commit is contained in:
@@ -199,14 +199,16 @@ class VMwareAPIVMTestCase(test.TestCase):
|
||||
info = self.conn.get_info({'name': 1})
|
||||
self._check_vm_info(info, power_state.RUNNING)
|
||||
reboot_type = "SOFT"
|
||||
self.conn.reboot(self.instance, self.network_info, reboot_type)
|
||||
self.conn.reboot(self.context, self.instance, self.network_info,
|
||||
reboot_type)
|
||||
info = self.conn.get_info({'name': 1})
|
||||
self._check_vm_info(info, power_state.RUNNING)
|
||||
|
||||
def test_reboot_non_existent(self):
|
||||
self._create_instance_in_the_db()
|
||||
self.assertRaises(exception.InstanceNotFound, self.conn.reboot,
|
||||
self.instance, self.network_info, 'SOFT')
|
||||
self.context, self.instance, self.network_info,
|
||||
'SOFT')
|
||||
|
||||
def test_reboot_not_poweredon(self):
|
||||
self._create_vm()
|
||||
@@ -216,7 +218,8 @@ class VMwareAPIVMTestCase(test.TestCase):
|
||||
info = self.conn.get_info({'name': 1})
|
||||
self._check_vm_info(info, power_state.SUSPENDED)
|
||||
self.assertRaises(exception.InstanceRebootFailure, self.conn.reboot,
|
||||
self.instance, self.network_info, 'SOFT')
|
||||
self.context, self.instance, self.network_info,
|
||||
'SOFT')
|
||||
|
||||
def test_suspend(self):
|
||||
self._create_vm()
|
||||
|
||||
Reference in New Issue
Block a user