#!/usr/bin/python
# -*- coding: UTF-8 -*-

SERVICE_NAME = "DistributedStorage"


class PostCheckStatus(object):
    CHECKING = 0
    SUCCESSED = 1
    FAILERED = 2


class ErrorInfo(object):
    OK = 0
    ERROR_IS_MASTER = 2
    ERROR_IS_STANDBY = 3
    ERROR_PACKAGE_DIR_NOT_EXIST = 4
    ERROR_PACKAGE_DIR_IS_EXIST = 5
    ERROR_SAME_VERSION = 6


class UnifyPwdInfo:
    COMPONENT_NAME = 'Distributed storage'
    SUB_COMPONENT_NAME = 'Distributed Block Storage'


class UpgradeStateKey:
    PRODUCT_UPGRADE_STATE = "{}_ProductUpgradeState"
    HOTPATCH_UPGRADE_STATE = "{}_HotpatchUpgradeState"
    ROLLBACK_STATE = "{}_RollBackState"
    ROLLBACK_COMMIT_STATE = "{}_RollBackCommitState"
    UPGRADE_COMMIT_STATE = "{}_UpgradeCommitState"


class UpgradeStates:
    PRODUCT_UPGRADE_START = 0
    PRODUCT_UPGRADE_POST_CHECK_START = 1
    BACKUP_PRODUCT_DB_START = 2
    BACKUP_PRODUCT_REPO_START = 3
    SET_IGNORE_NODES_START = 4
    PRODUCT_UPGRADE_COMMIT_START = 5
    DEL_IGNORE_NODES_START = 6


class HotpatchStates:
    HOTPATCH_UPLOAD_START = 0
    HOTPATCH_UPGRADE_PRE_CHECK_START = 1
    HOTPATCH_UPGRADE_START = 2
    BACKUP_HOTPATCH_DB_START = 3


class RollBackStates:
    ROLLBACK_HOTPATCH_START = 0
    ROLLBACK_HOTPATCH_POST_CHECK_START = 1
    RESTORE_PRODUCT_REPO_DATA_START = 2
    RESTORE_PRODUCT_DB_DATA_START = 3
    ROLLBACK_HOTPATCH_POST_CHECK_START2 = 4
    ROLLBACK_PRODUCT_START = 5


class UpgradeCommitStates:
    RESTORE_PRODUCT_REPO_DATA_START = 0
    RESTORE_PRODUCT_DB_DATA_START = 1
    PRODUCT_UPGRADE_COMMIT_START = 2
    RESTORE_HOTPATCH_REPO_DATA_START = 3
    RESTORE_HOTPATCH_DB_DATA_START = 4
    HOTPATCH_UPGRADE_COMMIT_START = 5
    CLEAR_BACKUP_DATA_START = 6

