Now removing kernel/ramdisk VDI after copy
Code tested with PV and HVM guests Fixed pep8 errors Could not run tests - test environment broken on dev machine
This commit is contained in:
@@ -206,19 +206,16 @@ class XenAPIVMTestCase(test.TestCase):
|
|||||||
|
|
||||||
check()
|
check()
|
||||||
|
|
||||||
def test_spawn(self):
|
def check_vm_record(self, conn):
|
||||||
instance = self._create_instance()
|
instances = conn.list_instances()
|
||||||
|
|
||||||
def check():
|
|
||||||
instances = self.conn.list_instances()
|
|
||||||
self.assertEquals(instances, [1])
|
self.assertEquals(instances, [1])
|
||||||
|
|
||||||
# Get Nova record for VM
|
# Get Nova record for VM
|
||||||
vm_info = self.conn.get_info(1)
|
vm_info = conn.get_info(1)
|
||||||
|
|
||||||
# Get XenAPI record for VM
|
# Get XenAPI record for VM
|
||||||
vms = xenapi_fake.get_all('VM')
|
vms = fake.get_all('VM')
|
||||||
vm = xenapi_fake.get_record('VM', vms[0])
|
vm = fake.get_record('VM', vms[0])
|
||||||
|
|
||||||
# Check that m1.large above turned into the right thing.
|
# Check that m1.large above turned into the right thing.
|
||||||
instance_type = instance_types.INSTANCE_TYPES['m1.large']
|
instance_type = instance_types.INSTANCE_TYPES['m1.large']
|
||||||
@@ -239,7 +236,27 @@ class XenAPIVMTestCase(test.TestCase):
|
|||||||
# Check that the VM is running according to XenAPI.
|
# Check that the VM is running according to XenAPI.
|
||||||
self.assertEquals(vm['power_state'], 'Running')
|
self.assertEquals(vm['power_state'], 'Running')
|
||||||
|
|
||||||
check()
|
def _test_spawn(self, image_id, kernel_id, ramdisk_id):
|
||||||
|
stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests)
|
||||||
|
values = {'name': 1,
|
||||||
|
'project_id': self.project.id,
|
||||||
|
'user_id': self.user.id,
|
||||||
|
'image_id': image_id,
|
||||||
|
'kernel_id': kernel_id,
|
||||||
|
'ramdisk_id': ramdisk_id,
|
||||||
|
'instance_type': 'm1.large',
|
||||||
|
'mac_address': 'aa:bb:cc:dd:ee:ff',
|
||||||
|
}
|
||||||
|
conn = xenapi_conn.get_connection(False)
|
||||||
|
instance = db.instance_create(values)
|
||||||
|
conn.spawn(instance)
|
||||||
|
self.check_vm_record(conn)
|
||||||
|
|
||||||
|
def test_spawn_raw(self):
|
||||||
|
self._test_spawn(1, None, None)
|
||||||
|
|
||||||
|
def test_spawn(self):
|
||||||
|
self._test_spawn(1, 2, 3)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(XenAPIVMTestCase, self).tearDown()
|
super(XenAPIVMTestCase, self).tearDown()
|
||||||
|
|||||||
Reference in New Issue
Block a user