'Check if the spawned VM\'s properties correspond to the instance in
the db.'

def _check_vm_record(self, num_instances=1, powered_on=True, uuid=None):

    instances = self.conn.list_instances()
    if uuidutils.is_uuid_like(uuid):
        self.assertEqual(num_instances, len(instances))
    vm_info = self._get_info()
    vm = self._get_vm_record()
    mem_kib = (int(self.type_data['memory_mb']) << 10)
    vcpus = self.type_data['vcpus']
    self.assertEqual(vm_info.max_mem_kb, mem_kib)
    self.assertEqual(vm_info.mem_kb, mem_kib)
    self.assertEqual(vm.get('summary.config.instanceUuid'), self.uuid)
    self.assertEqual(vm.get('summary.config.numCpu'), vcpus)
    self.assertEqual(vm.get('summary.config.memorySizeMB'), self.type_data['memory_mb'])
    self.assertEqual('ns0:VirtualE1000', vm.get('config.hardware.device').VirtualDevice[2].obj_name)
    if powered_on:
        self.assertEqual(power_state.RUNNING, vm_info.state)
        self.assertEqual('poweredOn', vm.get('runtime.powerState'))
    else:
        self.assertEqual(power_state.SHUTDOWN, vm_info.state)
        self.assertEqual('poweredOff', vm.get('runtime.powerState'))
    found_vm_uuid = False
    found_iface_id = False
    extras = vm.get('config.extraConfig')
    for c in extras.OptionValue:
        if ((c.key == 'nvp.vm-uuid') and (c.value == self.instance['uuid'])):
            found_vm_uuid = True
        if ((c.key == 'nvp.iface-id.0') and (c.value == utils.FAKE_VIF_UUID)):
            found_iface_id = True
    self.assertTrue(found_vm_uuid)
    self.assertTrue(found_iface_id)
