def find_new_mppdbs_test_case1(cls, dest_tenant_mppdb_group): new_mppdbs = [] if dest_tenant_mppdb_group.tenant_mppdb_group_id == 1: mppdb = MPPDB(mppdb_id='530807a9-d428-4d69-83b2-9fad30189d7b', mppdb_ip='192.168.1.203', tenant_mppdb_group_id=-1, mppdb_password='') new_mppdbs.append(mppdb) elif dest_tenant_mppdb_group.tenant_mppdb_group_id == 2: mppdb = MPPDB(mppdb_id='aff1849f-6cc8-491c-aca5-8e6ef97cf075', mppdb_ip='192.168.1.226', tenant_mppdb_group_id=-1, mppdb_password='') new_mppdbs.append(mppdb) elif dest_tenant_mppdb_group.tenant_mppdb_group_id == 3: mppdb = MPPDB(mppdb_id='26211c60-c617-4132-9df9-cd40b307caca', mppdb_ip='192.168.1.205', tenant_mppdb_group_id=-1, mppdb_password='') new_mppdbs.append(mppdb) elif dest_tenant_mppdb_group.tenant_mppdb_group_id == 4: mppdb = MPPDB(mppdb_id='dd669e86-2593-4d7b-b515-52a043824b3a', mppdb_ip='192.168.1.218', tenant_mppdb_group_id=dest_tenant_mppdb_group. tenant_mppdb_group_id, mppdb_password='') new_mppdbs.append(mppdb) return new_mppdbs
def find_old_mppdbs_test_case2(cls, dest_tenant_mppdb_group): old_mppdbs = [] if dest_tenant_mppdb_group.tenant_mppdb_group_id == 1: mppdb = MPPDB(mppdb_id='ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', mppdb_ip='192.168.1.220', tenant_mppdb_group_id=dest_tenant_mppdb_group. tenant_mppdb_group_id, mppdb_password='') elif dest_tenant_mppdb_group.tenant_mppdb_group_id == 2: mppdb = MPPDB(mppdb_id='8b029e34-55c4-4b84-b336-8ac7fe60e6df', mppdb_ip='192.168.1.213', tenant_mppdb_group_id=dest_tenant_mppdb_group. tenant_mppdb_group_id, mppdb_password='') elif dest_tenant_mppdb_group.tenant_mppdb_group_id == 3: mppdb = MPPDB(mppdb_id='e6e53153-336f-4030-bd33-10f99bd159e5', mppdb_ip='192.168.1.210', tenant_mppdb_group_id=dest_tenant_mppdb_group. tenant_mppdb_group_id, mppdb_password='') old_mppdbs.append(mppdb) return old_mppdbs
def trove_cluster_creation_thread(cls, session, request_node_quantity, flavor, tenant_mppdb_group_id, post_func=[]): """Create a MPPDB by requesting Trove to create a cluster.""" cluster_instances = [] for i in range(request_node_quantity): cluster_instances.append({'flavorRef': flavor, 'volume': {'size': CLUSTER_VOLUME_SIZE}, 'availability_zone': CLUSTER_AVAILABILITY_ZONE}) i += 1 trove = get_trove_client() cluster = trove.clusters.create(CLUSTER_NAME, CLUSTER_DATASTORE, CLUSTER_DATASTORE_VERSION, instances=cluster_instances) mppdb_id = cluster.id mppdb = MPPDB(mppdb_id=mppdb_id, mppdb_ip="", tenant_mppdb_group_id=tenant_mppdb_group_id, mppdb_password="") session.add(mppdb) session.commit() thread.start_new_thread(cls.trove_cluster_creation, (mppdb_id, tenant_mppdb_group_id, cluster, post_func))
def run(self, session, test_case=None): logging.info('Start to create MPPDBs.') if (test_case is None): self.old_mppdbs = MPPDBDAO.get_mppdb_list( session, self.dest_tenant_mppdb_group.tenant_mppdb_group_id) for i in range(self.mppdb_quantity_to_create): """Create a MPPDB by requesting Trove to create a cluster.""" cluster_instances = [] for i in range(self.dest_tenant_mppdb_group.node_quantity): cluster_instances.append({ 'flavorRef': OpenstackUtil.get_nova_client().flavors.find( name=self.dest_tenant_mppdb_group.flavor). __getattribute__('id'), 'volume': { 'size': CLUSTER_VOLUME_SIZE }, 'availability_zone': CLUSTER_AVAILABILITY_ZONE }) i += 1 trove = get_trove_client() cluster = trove.clusters.create(CLUSTER_NAME, CLUSTER_DATASTORE, CLUSTER_DATASTORE_VERSION, instances=cluster_instances) mppdb_id = cluster.id mppdb_ip = create_trove_cluster(cluster) logging.info('MPPDB %s is successfully created.' % mppdb_id) mppdb_password = get_dbadmin_password(mppdb_ip) if self.action == "tenant_mppdb_data_movement": # add new mppdb to MPPDB mppdb = MPPDB( mppdb_id=mppdb_id, mppdb_ip=mppdb_ip, tenant_mppdb_group_id=self.dest_tenant_mppdb_group. tenant_mppdb_group_id, mppdb_password=mppdb_password) # tenant_mppdb_group_id is set to be -1, since all the mppdbs in the same tenant_mppdb_group are ready elif self.action == "mppdb_copy": # add new mppdb to MPPDB mppdb = MPPDB(mppdb_id=mppdb_id, mppdb_ip=mppdb_ip, tenant_mppdb_group_id=-1, mppdb_password=mppdb_password) session.add(mppdb) self.new_mppdbs.append(mppdb) session.commit() # For testing else: if test_case == 1: self.old_mppdbs = mppdb_creation_dictionary_for_testing.find_old_mppdbs_test_case1( dest_tenant_mppdb_group=self.dest_tenant_mppdb_group) self.new_mppdbs = mppdb_creation_dictionary_for_testing.find_new_mppdbs_test_case1( dest_tenant_mppdb_group=self.dest_tenant_mppdb_group) elif test_case == 2: self.old_mppdbs = mppdb_creation_dictionary_for_testing.find_old_mppdbs_test_case2( dest_tenant_mppdb_group=self.dest_tenant_mppdb_group) self.new_mppdbs = mppdb_creation_dictionary_for_testing.find_new_mppdbs_test_case2( dest_tenant_mppdb_group=self.dest_tenant_mppdb_group) logging.info('New MPPDBs are successfully created.') # Identify whether they are Move or Copy and assign mppdb id for these actions for key in self.action_map: if self.action_map[key][0].action == MigrationJob._mppdb_copy: self.assignMppdbId(self.action_map[key], self.new_mppdbs) elif self.action_map[key][ 0].action == MigrationJob._tenant_mppdb_data_movement: self.assignMppdbId(self.action_map[key], self.new_mppdbs + self.old_mppdbs) return
def test_generate_migration_plan_case1(self): ##############################The current_tenant_mppdb_group_list will be used in Test Case 1 and 2############################## current_tenant_mppdb_group_list = [ TenantMPPDBGroup(1, 3, '2016-07-19 17:08:52.782331', 1, '7', [ TenantMPPDB( 1, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Computing', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0333333333333', [User('2', 'John', 'admin', 'john123', '1')]), TenantMPPDB( 6, 1, '1', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Physics', '[0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.05', [User('5', 'Billy', 'admin', 'billy123', '6')]), TenantMPPDB( 3, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Statistics', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.075', [User('4', 'Mary', 'admin', 'mary123', '3')]) ], [ MPPDB('ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', '192.168.1.220', '1', '') ]), TenantMPPDBGroup(2, 2, '2016-07-19 17:08:52.782331', 1, '8', [ TenantMPPDB( 5, 2, '1', '8', '7d060ae439ad469a9729cfaedfe264d6', 'Math', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0', [User('7', 'Michael', 'admin', 'michael123', '5')]), TenantMPPDB( 2, 2, '1', '8', '43aad64fa7c244e69246b596b6c19128', 'Engineering', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0166666666667', [ User('1', 'Peter', 'admin', 'peter123', '2'), User('3', 'Sally', 'admin', 'sally123', '2') ]) ], [ MPPDB('8b029e34-55c4-4b84-b336-8ac7fe60e6df', '192.168.1.213', '2', '') ]), TenantMPPDBGroup(3, 1, '2016-07-19 17:08:52.782331', 2, '7', [ TenantMPPDB( 4, 3, '2', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Chemistry', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0583333333333', [User('6', 'Henry', 'admin', 'henry123', '4')]) ], [ MPPDB('e6e53153-336f-4030-bd33-10f99bd159e5', '192.168.1.210', '3', '') ]) ] ##############################Test Case 1################################ # CREATE MPPDB and Tenant MPPDB Group for Tenant MPPDB Group 4 # CREATE and COPY the MPPDB when the quantity of MPPDBs of a TenantMPPDBGroup is fewer than the replication factor (copy tmg1: 192.168.1.203, tmg2: 192.168.1.226) # MOVE Tenant MPPDB 1 data from the MPPDBs in Tenant MPPDB Group 1 to Tenant MPPDB Group 4 and update the backend database (move tmg1 to tmg4: from 192.168.1.220 to 192.168.1.218) # DELETE the data of Tenant MPPDB 1 in Tenant MPPDB Group 1 new_tenant_mppdb_group_list_case1 = [ TenantMPPDBGroup(2, 2, '2016-07-20 11:34:41.727016', 1, '8', [ TenantMPPDB( 5, 2, '1', '8', '7d060ae439ad469a9729cfaedfe264d6', 'Math', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1]', '0.108333333333', [User('7', 'Michael', 'admin', 'michael123', '5')]), TenantMPPDB( 2, 2, '1', '8', '43aad64fa7c244e69246b596b6c19128', 'Engineering', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.125', [ User('1', 'Peter', 'admin', 'peter123', '2'), User('3', 'Sally', 'admin', 'sally123', '2') ]) ], [ MPPDB('8b029e34-55c4-4b84-b336-8ac7fe60e6df', '192.168.1.213', '2', '') ]), TenantMPPDBGroup(1, 2, '2016-07-20 11:34:41.727016', 1, '7', [ TenantMPPDB( 3, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Statistics', '[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.108333333333', [User('4', 'Mary', 'admin', 'mary123', '3')]), TenantMPPDB( 6, 1, '1', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Physics', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.108333333333', [User('5', 'Billy', 'admin', 'billy123', '6')]) ], [ MPPDB('ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', '192.168.1.220', '1', '') ]), TenantMPPDBGroup(3, 1, '2016-07-20 11:34:41.727016', 2, '7', [ TenantMPPDB( 4, 3, '2', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Chemistry', '[0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]', '0.2', [User('6', 'Henry', 'admin', 'henry123', '4')]) ], [ MPPDB('e6e53153-336f-4030-bd33-10f99bd159e5', '192.168.1.210', '3', '') ]), TenantMPPDBGroup(4, 1, '2016-07-20 11:34:41.727016', 1, '7', [ TenantMPPDB( 1, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Computing', '[1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]', '0.208333333333', [User('2', 'John', 'admin', 'john123', '1')]) ], 'None') ] dm = DeploymentMaster() migration_plan = dm.generate_migration_plan( current_tenant_mppdb_group_list, new_tenant_mppdb_group_list_case1) # Test Case 1: # Actions includes: # CreateMPPDB Action for TenantMPPDBGroup 1, 2 and 4 [Node quantity : 2] # Create new Tenant MPPDB Group 4 # Move Tenant MPPDB 1 data from TenantMPPDBGroup 1 to the new TenantMPPDBGroup 4 # Copy MPPDB in Tenant MPPDB Group 1 (2 times), 2 (2 times) # Total 9 actions expected_cases = MigrationPlan([ MPPDBCreation(dest_tenant_mppdb_group=TenantMPPDBGroup( tenant_mppdb_group_id=1), mppdb_quantity_to_create=1, action=MigrationJob._mppdb_copy), MPPDBCreation(dest_tenant_mppdb_group=TenantMPPDBGroup( tenant_mppdb_group_id=2), mppdb_quantity_to_create=1, action=MigrationJob._mppdb_copy), MPPDBCreation(dest_tenant_mppdb_group=TenantMPPDBGroup( tenant_mppdb_group_id=4), mppdb_quantity_to_create=1, action=MigrationJob._tenant_mppdb_data_movement), TenantMPPDBGroupCreation(TenantMPPDBGroup(node_quantity=1)), MigrationJob( source_mppdb_id='ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', tenant_mppdb_id=1, action=MigrationJob._tenant_mppdb_data_movement), MigrationJob( source_mppdb_id='ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', tenant_mppdb_id=3, action=MigrationJob._mppdb_copy), MigrationJob( source_mppdb_id='ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', tenant_mppdb_id=6, action=MigrationJob._mppdb_copy), MigrationJob( source_mppdb_id='8b029e34-55c4-4b84-b336-8ac7fe60e6df', tenant_mppdb_id=2, action=MigrationJob._mppdb_copy), MigrationJob( source_mppdb_id='8b029e34-55c4-4b84-b336-8ac7fe60e6df', tenant_mppdb_id=5, action=MigrationJob._mppdb_copy) ]) self.assertEqual(migration_plan, expected_cases)
def test_execute_migration_plan_case2(self): ##############################The current_tenant_mppdb_group_list will be used in Test Case 1 and 2############################## current_tenant_mppdb_group_list = [TenantMPPDBGroup(1, 3, '2016-07-19 17:08:52.782331', 1, '7', [ TenantMPPDB(1, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Computing', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0333333333333', [User('2', 'John', 'admin', 'john123', '1')]), TenantMPPDB(6, 1, '1', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Physics', '[0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.05', [User('5', 'Billy', 'admin', 'billy123', '6')]), TenantMPPDB(3, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Statistics', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.075', [User('4', 'Mary', 'admin', 'mary123', '3')])], [ MPPDB('ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', '192.168.1.220', '1', '')]), TenantMPPDBGroup(2, 2, '2016-07-19 17:08:52.782331', 1, '8', [ TenantMPPDB(5, 2, '1', '8', '7d060ae439ad469a9729cfaedfe264d6', 'Math', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0', [User('7', 'Michael', 'admin', 'michael123', '5')]), TenantMPPDB(2, 2, '1', '8', '43aad64fa7c244e69246b596b6c19128', 'Engineering', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0166666666667', [User('1', 'Peter', 'admin', 'peter123', '2'), User('3', 'Sally', 'admin', 'sally123', '2')])], [ MPPDB('8b029e34-55c4-4b84-b336-8ac7fe60e6df ', '192.168.1.213', '2', '')]), TenantMPPDBGroup(3, 1, '2016-07-19 17:08:52.782331', 2, '7', [ TenantMPPDB(4, 3, '2', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Chemistry', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.0583333333333', [User('6', 'Henry', 'admin', 'henry123', '4')])], [ MPPDB('e6e53153-336f-4030-bd33-10f99bd159e5', '192.168.1.210', '3', '')])] ##############################Test Case 2################################ # CREATE and COPY the MPPDB when the quantity of MPPDBs of a TenantMPPDBGroup is fewer than the replication factor (copy tmg1: 192.168.1.203, tmg2: 192.168.1.226, tmg3: 192.168.1.205) # MOVE Tenant MPPDB 1 data from the MPPDBs in Tenant MPPDB Group 1 to Tenant MPPDB Group 3 and update the backend database (if move action before tmg3 copy: move from 192.168.1.220 to 192.168.1.210 / if move action after copy tmg3: move from 192.168.1.220 to 192.168.1.210 and 205) # DELETE the data of Tenant MPPDB 1 in Tenant MPPDB Group 1 (delete the tmg 1 data in 192.168.1.220) new_tenant_mppdb_group_list_case2 = [TenantMPPDBGroup(2, 2, '2016-07-20 11:34:41.727016', 1, '8', [ TenantMPPDB(5, 2, '1', '8', '7d060ae439ad469a9729cfaedfe264d6', 'Math', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1]', '0.108333333333', [User('7', 'Michael', 'admin', 'michael123', '5')]), TenantMPPDB(2, 2, '1', '8', '43aad64fa7c244e69246b596b6c19128', 'Engineering', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.125', [User('1', 'Peter', 'admin', 'peter123', '2'), User('3', 'Sally', 'admin', 'sally123', '2')])], [ MPPDB('8b029e34-55c4-4b84-b336-8ac7fe60e6df ', '192.168.1.213', '2', '')]), TenantMPPDBGroup(1, 2, '2016-07-20 11:34:41.727016', 1, '7', [ TenantMPPDB(3, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Statistics', '[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.108333333333', [User('4', 'Mary', 'admin', 'mary123', '3')]), TenantMPPDB(6, 1, '1', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Physics', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]', '0.108333333333', [User('5', 'Billy', 'admin', 'billy123', '6')])], [ MPPDB('ffae3bc8-572a-4a10-aeae-048bd4e9f9f2', '192.168.1.220', '1', '')]), TenantMPPDBGroup(3, 1, '2016-07-20 11:34:41.727016', 2, '7', [ TenantMPPDB(4, 3, '2', '7', '7d060ae439ad469a9729cfaedfe264d6', 'Chemistry', '[0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]', '0.2', [User('6', 'Henry', 'admin', 'henry123', '4')]), TenantMPPDB(1, 1, '1', '7', '43aad64fa7c244e69246b596b6c19128', 'Computing', '[1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]', '0.208333333333', [User('2', 'John', 'admin', 'john123', '1')])], [ MPPDB('e6e53153-336f-4030-bd33-10f99bd159e5', '192.168.1.210', '3', '')])] dm = DeploymentMaster() test_deploymentmaster_reset.reset() migration_plan = dm.generate_migration_plan(current_tenant_mppdb_group_list, new_tenant_mppdb_group_list_case2) session = SQLalchemyUtil.get_session() dm.execute_migration_plan(session, migration_plan, 2) JobQueueManager.start()