def test_spawn_fail_cleanup_2(self): """Simulates an error while creating VM record. It verifies that VDIs created are properly cleaned up. """ vdi_recs_start = self._list_vdis() stubs.stubout_create_vm(self.stubs) self.assertRaises(xenapi_fake.Failure, self._test_spawn, 1, 2, 3) # No additional VDI should be found. vdi_recs_end = self._list_vdis() self._check_vdis(vdi_recs_start, vdi_recs_end)