Ejemplo n.º 1
0
    def _update_old_records_vm_list(self, session):
        conf_dict = self.rc_config.get_value('recover_starter')
        notification_expiration_sec = int(
            conf_dict.get('notification_expiration_sec'))
        now = datetime.datetime.now()
        border_time = now - \
            datetime.timedelta(seconds=notification_expiration_sec)
        border_time_str = border_time.strftime('%Y-%m-%d %H:%M:%S')

        msg = "Do get_old_records_vm_list."
        LOG.info(msg)
        result = dbapi.get_old_records_vm_list(session, border_time_str,
                                               border_time_str)
        msg = "Succeeded in get_old_records_vm_list. " \
            + "Return_value = " + str(result)
        LOG.info(msg)

        if result:
            msg = 'Old and incomplete records will be skipped.'
            LOG.info(msg)

            # Set progress = 4 for old record
            for row in result:
                update_val = {
                    'progress': 4,
                    'update_at': datetime.datetime.now(),
                    'delete_at': datetime.datetime.now()
                }
                msg = "Do update_vm_list_by_id_dict."
                LOG.info(msg)
                dbapi.update_vm_list_by_id_dict(session, row.id, update_val)
                msg = "Succeeded in update_vm_list_by_id_dict."
                LOG.info(msg)
Ejemplo n.º 2
0
    def _update_old_records_vm_list(self, session):
        conf_dict = self.rc_config.get_value('recover_starter')
        notification_expiration_sec = int(
            conf_dict.get('notification_expiration_sec'))
        now = datetime.datetime.now()
        border_time = now - \
            datetime.timedelta(seconds=notification_expiration_sec)
        border_time_str = border_time.strftime('%Y-%m-%d %H:%M:%S')
        self.rc_util.syslogout_ex("RecoveryControllerStarter_0026",
                                  syslog.LOG_INFO)
        result = dbapi.get_old_records_vm_list(session, border_time_str,
                                               border_time_str)
        self.rc_util.syslogout(result, syslog.LOG_INFO)

        if result:
            self.rc_util.syslogout_ex("RecoveryControllerStarter_0035",
                                      syslog.LOG_INFO)
            msg = 'Old and incomplete records will be skipped.'
            self.rc_util.syslogout(msg, syslog.LOG_INFO)

            # Set progress = 4 for old record
            for row in result:
                update_val = {
                    'progress': 4,
                    'update_at': datetime.datetime.now(),
                    'delete_at': datetime.datetime.now()
                }
                dbapi.update_vm_list_by_id_dict(session, row.id, update_val)
                self.rc_util.syslogout_ex("RecoveryControllerStarter_0036",
                                          syslog.LOG_INFO)
Ejemplo n.º 3
0
    def _update_old_records_vm_list(self, session):
        conf_dict = self.rc_config.get_value('recover_starter')
        notification_expiration_sec = int(conf_dict.get(
            'notification_expiration_sec'))
        now = datetime.datetime.now()
        border_time = now - \
            datetime.timedelta(seconds=notification_expiration_sec)
        border_time_str = border_time.strftime('%Y-%m-%d %H:%M:%S')

        msg = "Do get_old_records_vm_list."
        LOG.info(msg)
        result = dbapi.get_old_records_vm_list(
            session,
            border_time_str,
            border_time_str
        )
        msg = "Succeeded in get_old_records_vm_list. " \
            + "Return_value = " + str(result)
        LOG.info(msg)

        if result:
            msg = 'Old and incomplete records will be skipped.'
            LOG.info(msg)

            # Set progress = 4 for old record
            for row in result:
                update_val = {'progress': 4,
                              'update_at': datetime.datetime.now(),
                              'delete_at': datetime.datetime.now()
                              }
                msg = "Do update_vm_list_by_id_dict."
                LOG.info(msg)
                dbapi.update_vm_list_by_id_dict(session, row.id, update_val)
                msg = "Succeeded in update_vm_list_by_id_dict."
                LOG.info(msg)
Ejemplo n.º 4
0
    def _update_old_records_vm_list(self, session):
        conf_dict = self.rc_config.get_value("recover_starter")
        notification_expiration_sec = int(conf_dict.get("notification_expiration_sec"))
        now = datetime.datetime.now()
        border_time = now - datetime.timedelta(seconds=notification_expiration_sec)
        border_time_str = border_time.strftime("%Y-%m-%d %H:%M:%S")
        self.rc_util.syslogout_ex("RecoveryControllerStarter_0026", syslog.LOG_INFO)
        result = dbapi.get_old_records_vm_list(session, border_time_str, border_time_str)
        self.rc_util.syslogout(result, syslog.LOG_INFO)

        if result:
            self.rc_util.syslogout_ex("RecoveryControllerStarter_0035", syslog.LOG_INFO)
            msg = "Old and incomplete records will be skipped."
            self.rc_util.syslogout(msg, syslog.LOG_INFO)

            # Set progress = 4 for old record
            for row in result:
                update_val = {"progress": 4, "update_at": datetime.datetime.now(), "delete_at": datetime.datetime.now()}
                dbapi.update_vm_list_by_id_dict(session, row.id, update_val)
                self.rc_util.syslogout_ex("RecoveryControllerStarter_0036", syslog.LOG_INFO)