Ejemplo n.º 1
0
 def _delete_RRs(self):
     rids = self._get_rids()
     
     orig_rid_vips = {}
     for rid in rids:
         vip_id = utils.get_vip_id(rid, deleted = False)
         orig_rid_vips[rid] = vip_id
         
     
     for rid in rids:
         utils.check_server_status(rid,expected_task=utils.tasks.InstanceTasks.NONE,
                                   type=DBInstanceType.READ_REPLI,
                                   expected_svr_status=utils.ServiceStatuses.RUNNING,
                                   deleted=False,timeout=10)
         
         utils.delete_rds_byclient(rid)
         utils.check_server_status(rid,expected_task=utils.tasks.InstanceTasks.NONE,
                                   type=DBInstanceType.READ_REPLI,
                                   expected_svr_status=utils.ServiceStatuses.DELETED,
                                   deleted=True,timeout=CONF.nova_delete_timeout)
         
         vip_id = utils.get_vip_id(rid)
         utils.check_vip(rid, vip_id=vip_id, deleted=True)
         
         # Fore. 20150615. Delete One RR Instance will not make change to other RR Instance's VIP-RIP mapping.
         orig_rid_vips.pop(rid)
         for k, v in orig_rid_vips.items():
             utils.check_vip(id = k, vip_id = v, deleted = False)
Ejemplo n.º 2
0
    def delete(self):
        self.inst_id = utils.get_instance_id_bytenant(DBInstanceType.SINGLE)
        _master_vm_id = utils.get_instance(self.inst_id).compute_instance_id

        utils.delete_rds_byclient(self.inst_id)
        utils.check_vm_is_running(_master_vm_id, expect_status="DELETED", timeout=CONF.nova_delete_timeout)
        
        utils.check_server_status(self.inst_id, expected_task=utils.tasks.InstanceTasks.NONE,
                                  expected_svr_status=utils.ServiceStatuses.DELETED,
                                  deleted=True, timeout=CONF.nova_delete_timeout)
        
        utils.check_vip(self.inst_id, deleted=True)
Ejemplo n.º 3
0
    def restore_to_point_in_time(self):
        self.create()
        old_master_inst = utils.get_builtin_instance(self.inst_id)
        master_vid = old_master_inst.virtual_instance_id
        
        db_count = 100
        utils.generate_databases(self.inst_id, count = db_count)        
        utils.check_generated_databases(self.inst_id, count = db_count)
        time.sleep(3)
        time1 = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') 
        utils.clear_generated_databases(self.inst_id, count = db_count)
        time.sleep(3)
        dt2 = datetime.datetime.now()
        time2 = dt2.strftime('%Y-%m-%d %H:%M:%S')

        while True:
            restorable_time = utils.get_restorable_time(self.inst_id)
            dt = datetime.datetime.strptime(restorable_time.end, '%Y-%m-%d %H:%M:%S')
            if dt > dt2:
                break
            time.sleep(3)

        utils.restore_to_point_in_time_byclient(master_vid, time1) 
        time.sleep(10) # wait for compute instance appear
        new_inst1 = utils.get_restore_instance()
        utils.check_server_status(new_inst1, DBInstanceType.SINGLE, timeout=RESTORE_TIME_OUT) 
        utils.check_generated_databases(new_inst1, count = db_count)
        utils.delete_rds_byclient(new_inst1)
        utils.check_server_status(new_inst1, expected_task=utils.tasks.InstanceTasks.NONE,
                                  type=DBInstanceType.SINGLE,
                                  expected_svr_status=utils.ServiceStatuses.DELETED,
                                  deleted=True, timeout=CONF.trove_delete_timeout)
            
        # delete original instance
        utils.delete_rds_byclient(master_vid)
        utils.check_server_status(self.inst_id, expected_task=utils.tasks.InstanceTasks.NONE,
                                  type=DBInstanceType.MASTER,
                                  expected_svr_status=utils.ServiceStatuses.DELETED,
                                  deleted=True, timeout=CONF.trove_delete_timeout)
 
        # restore to point in time after deleting
        utils.restore_to_point_in_time_byclient(master_vid, time1)
        time.sleep(10) # wait for compute instance appear
        new_inst2 = utils.get_restore_instance()
        utils.check_server_status(new_inst2, DBInstanceType.SINGLE, timeout=RESTORE_TIME_OUT)
        utils.check_generated_databases(new_inst2, count = db_count)
        utils.delete_rds_byclient(new_inst2)
        utils.check_server_status(new_inst2, expected_task=utils.tasks.InstanceTasks.NONE,
                                  type=DBInstanceType.SINGLE,
                                  expected_svr_status=utils.ServiceStatuses.DELETED,
                                  deleted=True, timeout=CONF.trove_delete_timeout)