def create_populated_cluster(ctxt, num_services, num_down_svcs=0, **values):
 up_time = timeutils.utcnow()
 down_time = (up_time - datetime.timedelta(seconds=(CONF.service_down_time + 1)))
 cluster = create_cluster(ctxt, **values)
 svcs = [db.service_create(ctxt, {'cluster_name': cluster.name, 'host': ('host' + str(i)), 'updated_at': (down_time if (i < num_down_svcs) else up_time)}) for i in range(num_services)]
 return (cluster, svcs)

def create_populated_cluster ( ctxt , num_services , num_down_svcs = 0 , ** values ) : up_time = timeutils . utcnow ( ) down_time = ( up_time - datetime . timedelta ( seconds = ( CONF . service_down_time + 1 ) ) ) cluster = create_cluster ( ctxt , ** values ) svcs = [ db . service_create ( ctxt , { 'cluster_name' : cluster . name , 'host' : ( 'host' + str ( i ) ) , 'updated_at' : ( down_time if ( i < num_down_svcs ) else up_time ) } ) for i in range ( num_services ) ] return ( cluster , svcs )
helper method that creates a cluster with up and down services .