Esempio n. 1
0
    def override_with_backup(self, instance_id=None):
        self.inst_id = instance_id
        if not self.inst_id:
            self.create()
            self.inst_id = utils.get_instance_id_bytenant(DBInstanceType.MASTER)

        old_master_instance = utils.get_builtin_instance(self.inst_id)
        old_group_id = old_master_instance.group_id
        
        old_adm_user_1 = utils.check_mysql_adminuser(self.inst_id)
        backup1 = utils.create_backup_byclient(self.inst_id)
        utils.check_backup_status(backup1.id)
                
        new_password = "******" + str(random.randint(0, 100))
        utils.reset_admin_user_byclient(self.inst_id, new_password)
        new_adm_user_1 = utils.check_mysql_adminuser(self.inst_id)
        assert old_adm_user_1['_password'] != new_adm_user_1['_password'], \
            (old_adm_user_1['_password'], new_adm_user_1['_password'])
        backup2 = utils.create_backup_byclient(self.inst_id)
        utils.check_backup_status(backup2.id)
        
        utils.override_with_backup_byclient(self.inst_id, backup1.id)
        utils.check_server_deleted(old_master_instance.id, type = DBInstanceType.PENDING, timeout = 600)


        self.inst_id = utils.get_instance_id(old_group_id, DBInstanceType.MASTER)
        new_master_instance = utils.get_builtin_instance(self.inst_id)
        self.dbslave_id = utils.get_instance_id(old_group_id, DBInstanceType.STANDBY)
        self.vip_id = utils.get_vip_id(self.inst_id)
        self.group_id = new_master_instance.group_id
        self.validate()
        
        new_adm_user_2 = utils.check_mysql_adminuser(self.inst_id)
        assert old_adm_user_1['_password'] == new_adm_user_2['_password'], \
            (old_adm_user_1['_password'], new_adm_user_2['_password'])
Esempio n. 2
0
    def reset_adm_user(self):
        self.inst_id = utils.get_instance_id_bytenant(DBInstanceType.SINGLE)
        old_adm_user = utils.check_mysql_adminuser(self.inst_id)

        new_password = "******" + str(random.randint(0, 100))
        utils.reset_admin_user_byclient(self.inst_id, new_password)
        new_adm_user = utils.check_mysql_adminuser(self.inst_id)
        assert old_adm_user['_password'] != new_adm_user['_password'], (old_adm_user, new_adm_user)