Exemple #1
0
    def _create_vm_list_db_for_failed_host(self, session, notification_id, notification_uuid):
        try:
            conf_recover_starter_dic = self.rc_config.get_value("recover_starter")

            interval_to_be_retry = conf_recover_starter_dic.get("interval_to_be_retry")
            max_retry_cnt = conf_recover_starter_dic.get("max_retry_cnt")
            row_cnt = dbapi.get_one_vm_list_by_uuid_and_progress_create_at_last(session, notification_uuid)

            primary_id = None
            if row_cnt == 0:
                primary_id = self.rc_util_db.insert_vm_list_db(session, notification_id, notification_uuid, 0)
                return primary_id
            else:
                self.rc_util.syslogout_ex("RecoveryControllerStarter_0008", syslog.LOG_INFO)
                msg = (
                    "Do not insert a record into vm_list db "
                    "because there are same uuid records that "
                    "progress is 0 or 1."
                )
                self.rc_util.syslogout(msg, syslog.LOG_INFO)
                return None

        except KeyError:
            self.rc_util.syslogout_ex("RecoveryControllerStarter_0010", syslog.LOG_ERR)
            error_type, error_value, traceback_ = sys.exc_info()
            tb_list = traceback.format_tb(traceback_)
            self.rc_util.syslogout(error_type, syslog.LOG_ERR)
            self.rc_util.syslogout(error_value, syslog.LOG_ERR)
            for tb in tb_list:
                self.rc_util.syslogout(tb, syslog.LOG_ERR)
            raise KeyError
    def _create_vm_list_db_for_failed_host(self, session,
                                           notification_id,
                                           notification_uuid):
        try:
            conf_recover_starter_dic = self.rc_config.get_value(
                'recover_starter')

            interval_to_be_retry = conf_recover_starter_dic.get(
                "interval_to_be_retry")
            max_retry_cnt = conf_recover_starter_dic.get("max_retry_cnt")

            msg = "Do get_one_vm_list_by_uuid_and_progress_create_at_last."
            LOG.info(msg)
            row_cnt = dbapi.get_one_vm_list_by_uuid_and_progress_create_at_last(
                session,
                notification_uuid)
            msg = "Succeeded in " \
                + "get_one_vm_list_by_uuid_and_progress_create_at_last. " \
                + "Return_value = " + str(row_cnt)
            LOG.info(msg)

            primary_id = None
            if row_cnt == 0:
                primary_id = self.rc_util_db.insert_vm_list_db(
                    session, notification_id, notification_uuid, 0)

                return primary_id
            else:
                msg = "Do not insert a record into vm_list db " \
                      "because there are same uuid records that " \
                      "progress is 0 or 1."
                LOG.warning(msg)

                return None

        except KeyError:
            error_type, error_value, traceback_ = sys.exc_info()
            tb_list = traceback.format_tb(traceback_)
            LOG.error(error_type)
            LOG.error(error_value)
            for tb in tb_list:
                LOG.error(tb)
            raise KeyError
    def _create_vm_list_db_for_failed_host(self, session, notification_id,
                                           notification_uuid):
        try:
            conf_recover_starter_dic = self.rc_config.get_value(
                'recover_starter')

            interval_to_be_retry = conf_recover_starter_dic.get(
                "interval_to_be_retry")
            max_retry_cnt = conf_recover_starter_dic.get("max_retry_cnt")
            row_cnt = dbapi.get_one_vm_list_by_uuid_and_progress_create_at_last(
                session, notification_uuid)

            primary_id = None
            if row_cnt == 0:
                primary_id = self.rc_util_db.insert_vm_list_db(
                    session, notification_id, notification_uuid, 0)
                return primary_id
            else:
                self.rc_util.syslogout_ex("RecoveryControllerStarter_0008",
                                          syslog.LOG_INFO)
                msg = "Do not insert a record into vm_list db " \
                      "because there are same uuid records that " \
                      "progress is 0 or 1."
                self.rc_util.syslogout(msg, syslog.LOG_INFO)
                return None

        except KeyError:
            self.rc_util.syslogout_ex("RecoveryControllerStarter_0010",
                                      syslog.LOG_ERR)
            error_type, error_value, traceback_ = sys.exc_info()
            tb_list = traceback.format_tb(traceback_)
            self.rc_util.syslogout(error_type, syslog.LOG_ERR)
            self.rc_util.syslogout(error_value, syslog.LOG_ERR)
            for tb in tb_list:
                self.rc_util.syslogout(tb, syslog.LOG_ERR)
            raise KeyError