Commit eedf99b5 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Move cluster verify error codes to constants



- move the cluster verify error codes from cmdlib._VerifyErrors to
  constants;
- add to each of them the CV (Cluster Verify) prefix;
- add the CV_ALL_ECODES and CV_ALL_ECODES_STRINGS constants;
- wrap the lines that exceed 80 characters after changing the error
  code names to the new ones.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 909b3a0e
This diff is collapsed.
......@@ -1082,6 +1082,76 @@ HT_MIGRATION_MODES = frozenset([HT_MIGRATION_LIVE, HT_MIGRATION_NONLIVE])
VERIFY_NPLUSONE_MEM = "nplusone_mem"
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
# Cluster Verify error classes
CV_TCLUSTER = "cluster"
CV_TNODE = "node"
CV_TINSTANCE = "instance"
# Cluster Verify error codes
CV_ECLUSTERCFG = (CV_TCLUSTER, "ECLUSTERCFG")
CV_ECLUSTERCERT = (CV_TCLUSTER, "ECLUSTERCERT")
CV_ECLUSTERFILECHECK = (CV_TCLUSTER, "ECLUSTERFILECHECK")
CV_ECLUSTERDANGLINGNODES = (CV_TNODE, "ECLUSTERDANGLINGNODES")
CV_ECLUSTERDANGLINGINST = (CV_TNODE, "ECLUSTERDANGLINGINST")
CV_EINSTANCEBADNODE = (CV_TINSTANCE, "EINSTANCEBADNODE")
CV_EINSTANCEDOWN = (CV_TINSTANCE, "EINSTANCEDOWN")
CV_EINSTANCELAYOUT = (CV_TINSTANCE, "EINSTANCELAYOUT")
CV_EINSTANCEMISSINGDISK = (CV_TINSTANCE, "EINSTANCEMISSINGDISK")
CV_EINSTANCEFAULTYDISK = (CV_TINSTANCE, "EINSTANCEFAULTYDISK")
CV_EINSTANCEWRONGNODE = (CV_TINSTANCE, "EINSTANCEWRONGNODE")
CV_EINSTANCESPLITGROUPS = (CV_TINSTANCE, "EINSTANCESPLITGROUPS")
CV_ENODEDRBD = (CV_TNODE, "ENODEDRBD")
CV_ENODEDRBDHELPER = (CV_TNODE, "ENODEDRBDHELPER")
CV_ENODEFILECHECK = (CV_TNODE, "ENODEFILECHECK")
CV_ENODEHOOKS = (CV_TNODE, "ENODEHOOKS")
CV_ENODEHV = (CV_TNODE, "ENODEHV")
CV_ENODELVM = (CV_TNODE, "ENODELVM")
CV_ENODEN1 = (CV_TNODE, "ENODEN1")
CV_ENODENET = (CV_TNODE, "ENODENET")
CV_ENODEOS = (CV_TNODE, "ENODEOS")
CV_ENODEORPHANINSTANCE = (CV_TNODE, "ENODEORPHANINSTANCE")
CV_ENODEORPHANLV = (CV_TNODE, "ENODEORPHANLV")
CV_ENODERPC = (CV_TNODE, "ENODERPC")
CV_ENODESSH = (CV_TNODE, "ENODESSH")
CV_ENODEVERSION = (CV_TNODE, "ENODEVERSION")
CV_ENODESETUP = (CV_TNODE, "ENODESETUP")
CV_ENODETIME = (CV_TNODE, "ENODETIME")
CV_ENODEOOBPATH = (CV_TNODE, "ENODEOOBPATH")
CV_ALL_ECODES = frozenset([
CV_ECLUSTERCFG,
CV_ECLUSTERCERT,
CV_ECLUSTERFILECHECK,
CV_ECLUSTERDANGLINGNODES,
CV_ECLUSTERDANGLINGINST,
CV_EINSTANCEBADNODE,
CV_EINSTANCEDOWN,
CV_EINSTANCELAYOUT,
CV_EINSTANCEMISSINGDISK,
CV_EINSTANCEFAULTYDISK,
CV_EINSTANCEWRONGNODE,
CV_EINSTANCESPLITGROUPS,
CV_ENODEDRBD,
CV_ENODEDRBDHELPER,
CV_ENODEFILECHECK,
CV_ENODEHOOKS,
CV_ENODEHV,
CV_ENODELVM,
CV_ENODEN1,
CV_ENODENET,
CV_ENODEOS,
CV_ENODEORPHANINSTANCE,
CV_ENODEORPHANLV,
CV_ENODERPC,
CV_ENODESSH,
CV_ENODEVERSION,
CV_ENODESETUP,
CV_ENODETIME,
CV_ENODEOOBPATH,
])
CV_ALL_ECODES_STRINGS = frozenset([estr for (_, estr) in CV_ALL_ECODES])
# Node verify constants
NV_DRBDHELPER = "drbd-helper"
NV_DRBDLIST = "drbd-list"
......
......@@ -272,9 +272,9 @@ class TestClusterVerifySsh(unittest.TestCase):
class TestClusterVerifyFiles(unittest.TestCase):
@staticmethod
def _FakeErrorIf(errors, cond, ecode, item, msg, *args, **kwargs):
assert ((ecode == cmdlib.LUClusterVerifyGroup.ENODEFILECHECK and
assert ((ecode == constants.CV_ENODEFILECHECK and
ht.TNonEmptyString(item)) or
(ecode == cmdlib.LUClusterVerifyGroup.ECLUSTERFILECHECK and
(ecode == constants.CV_ECLUSTERFILECHECK and
item is None))
if args:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment