def _create_instance_dict(**kwargs):
 inst = {}
 inst['image_ref'] = 'cedef40a-ed67-4d10-800e-17455edce175'
 inst['reservation_id'] = 'r-fakeres'
 inst['user_id'] = kwargs.get('user_id', 'admin')
 inst['project_id'] = kwargs.get('project_id', 'fake')
 inst['instance_type_id'] = '1'
 if ('host' in kwargs):
  inst['host'] = kwargs.get('host')
 inst['vcpus'] = kwargs.get('vcpus', 1)
 inst['memory_mb'] = kwargs.get('memory_mb', 20)
 inst['root_gb'] = kwargs.get('root_gb', 30)
 inst['ephemeral_gb'] = kwargs.get('ephemeral_gb', 30)
 inst['vm_state'] = kwargs.get('vm_state', vm_states.ACTIVE)
 inst['power_state'] = kwargs.get('power_state', power_state.RUNNING)
 inst['task_state'] = kwargs.get('task_state', None)
 inst['availability_zone'] = kwargs.get('availability_zone', None)
 inst['ami_launch_index'] = 0
 inst['launched_on'] = kwargs.get('launched_on', 'dummy')
 return inst

def _create_instance_dict ( ** kwargs ) : inst = { } inst [ 'image_ref' ] = 'cedef40a-ed67-4d10-800e-17455edce175' inst [ 'reservation_id' ] = 'r-fakeres' inst [ 'user_id' ] = kwargs . get ( 'user_id' , 'admin' ) inst [ 'project_id' ] = kwargs . get ( 'project_id' , 'fake' ) inst [ 'instance_type_id' ] = '1' if ( 'host' in kwargs ) : inst [ 'host' ] = kwargs . get ( 'host' ) inst [ 'vcpus' ] = kwargs . get ( 'vcpus' , 1 ) inst [ 'memory_mb' ] = kwargs . get ( 'memory_mb' , 20 ) inst [ 'root_gb' ] = kwargs . get ( 'root_gb' , 30 ) inst [ 'ephemeral_gb' ] = kwargs . get ( 'ephemeral_gb' , 30 ) inst [ 'vm_state' ] = kwargs . get ( 'vm_state' , vm_states . ACTIVE ) inst [ 'power_state' ] = kwargs . get ( 'power_state' , power_state . RUNNING ) inst [ 'task_state' ] = kwargs . get ( 'task_state' , None ) inst [ 'availability_zone' ] = kwargs . get ( 'availability_zone' , None ) inst [ 'ami_launch_index' ] = 0 inst [ 'launched_on' ] = kwargs . get ( 'launched_on' , 'dummy' ) return inst
create a dictionary for a test instance .