'Simulates an error while downloading an image.
Verifies that the VM and VDIs created are properly cleaned up.'

def test_spawn_fail_cleanup_1(self):

    vdi_recs_start = self._list_vdis()
    start_vms = self._list_vms()
    stubs.stubout_fetch_disk_image(self.stubs, raise_failure=True)
    self.assertRaises(XenAPI.Failure, self._test_spawn, IMAGE_MACHINE, IMAGE_KERNEL, IMAGE_RAMDISK)
    vdi_recs_end = self._list_vdis()
    end_vms = self._list_vms()
    self._check_vdis(vdi_recs_start, vdi_recs_end)
    self.assertEqual(start_vms, end_vms)
