Clean up xenapi VM records on failed disk attaches

Breaks the create_vm_step up so that we can clean up the VM record in
case of disk attach failures.

Fixes bug 1073219

Change-Id: I54e28e2cce6fe4f29a03566eff998479410f7555
This commit is contained in:
Chris Behrens
2012-10-30 18:33:18 +00:00
parent 10db27b9fd
commit b1c1902bb7
2 changed files with 45 additions and 8 deletions

View File

@@ -138,11 +138,18 @@ def stubout_create_vm(stubs):
"""Simulates a failure in create_vm."""
def f(*args):
raise fake.Failure("Test Exception raised by " +
"fake create_vm")
raise fake.Failure("Test Exception raised by fake create_vm")
stubs.Set(vm_utils, 'create_vm', f)
def stubout_attach_disks(stubs):
"""Simulates a failure in _attach_disks."""
def f(*args):
raise fake.Failure("Test Exception raised by fake _attach_disks")
stubs.Set(vmops.VMOps, '_attach_disks', f)
def _make_fake_vdi():
sr_ref = fake.get_all('SR')[0]
vdi_ref = fake.create_vdi('', sr_ref)