def create_group(ctxt, host='test_host@fakedrv#fakepool', name='test_group', description='this is a test group', status=fields.GroupStatus.AVAILABLE, availability_zone='fake_az', group_type_id=None, volume_type_ids=None, **kwargs):
 grp = objects.Group(ctxt)
 grp.host = host
 grp.user_id = (ctxt.user_id or fake.USER_ID)
 grp.project_id = (ctxt.project_id or fake.PROJECT_ID)
 grp.status = status
 grp.name = name
 grp.description = description
 grp.availability_zone = availability_zone
 if group_type_id:
  grp.group_type_id = group_type_id
 if volume_type_ids:
  grp.volume_type_ids = volume_type_ids
 new_id = kwargs.pop('id', None)
 grp.update(kwargs)
 grp.create()
 if (new_id and (new_id != grp.id)):
  db.group_update(ctxt, grp.id, {'id': new_id})
  grp = objects.Group.get_by_id(ctxt, new_id)
 return grp

def create_group ( ctxt , host = 'test_host@fakedrv#fakepool' , name = 'test_group' , description = 'this is a test group' , status = fields . GroupStatus . AVAILABLE , availability_zone = 'fake_az' , group_type_id = None , volume_type_ids = None , ** kwargs ) : grp = objects . Group ( ctxt ) grp . host = host grp . user_id = ( ctxt . user_id or fake . USER_ID ) grp . project_id = ( ctxt . project_id or fake . PROJECT_ID ) grp . status = status grp . name = name grp . description = description grp . availability_zone = availability_zone if group_type_id : grp . group_type_id = group_type_id if volume_type_ids : grp . volume_type_ids = volume_type_ids new_id = kwargs . pop ( 'id' , None ) grp . update ( kwargs ) grp . create ( ) if ( new_id and ( new_id != grp . id ) ) : db . group_update ( ctxt , grp . id , { 'id' : new_id } ) grp = objects . Group . get_by_id ( ctxt , new_id ) return grp
create a group object in the db .