'Creates and spawns a test instance.'

def _create_instance(self, spawn=True, obj=False, **attrs):

    instance_values = {'uuid': uuidutils.generate_uuid(), 'display_name': 'host-', 'project_id': self.project_id, 'user_id': self.user_id, 'image_ref': IMAGE_MACHINE, 'kernel_id': IMAGE_KERNEL, 'ramdisk_id': IMAGE_RAMDISK, 'root_gb': 80, 'ephemeral_gb': 0, 'instance_type_id': '3', 'os_type': 'linux', 'vm_mode': 'hvm', 'architecture': 'x86-64'}
    instance_values.update(attrs)
    instance = create_instance_with_system_metadata(self.context, instance_values)
    network_info = fake_network.fake_get_instance_nw_info(self)
    image_meta = objects.ImageMeta.from_dict({'id': uuids.image_id, 'disk_format': 'vhd'})
    if spawn:
        self.conn.spawn(self.context, instance, image_meta, [], 'herp', network_info)
    if obj:
        return instance
    return base.obj_to_primitive(instance)
