def get_test_instance(context=None, flavor=None, obj=False):
    if (not context):
        context = get_test_admin_context()
    if (not flavor):
        flavor = get_test_flavor(context)
    metadata = {}
    flavors.save_flavor_info(metadata, flavor, '')
    test_instance = {'memory_kb': '2048000', 'basepath': '/some/path', 'bridge_name': 'br100', 'vcpus': 4, 'root_gb': 40, 'project_id': 'fake', 'bridge': 'br101', 'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175', 'instance_type_id': '5', 'system_metadata': metadata, 'extra_specs': {}}
    if obj:
        instance = instance_obj.Instance(context, **test_instance)
        instance.create()
    else:
        instance = nova.db.instance_create(context, test_instance)
    return instance
def get_test_instance(context=None, flavor=None, obj=False):
    if (not context):
        context = get_test_admin_context()
    if (not flavor):
        flavor = get_test_flavor(context)
    metadata = {}
    flavors.save_flavor_info(metadata, flavor, )
    test_instance = {'memory_kb': '2048000', 'basepath': '/some/path', 'bridge_name': 'br100', 'vcpus': 4, 'root_gb': 40, 'project_id': 'fake', 'bridge': 'br101', 'image_ref': 'cedef40a-ed67-4d10-800e-17455edce175', 'instance_type_id': '5', 'system_metadata': metadata, 'extra_specs': {}}
    if obj:
        instance = instance_obj.Instance(context, **test_instance)
        instance.create()
    else:
        instance = nova.db.instance_create(context, test_instance)
    return instance