• Iustin Pop's avatar
    A rewrite of LUClusterVerify · 02c521e4
    Iustin Pop authored
    Per issue 90, current cluster verify is very very brittle. It's one of
    the oldest pieces of code, with only additions without cleanups over the
    last years.
    Among its problems:
    - data initialization interspersed with verification of RPC results,
      leading to non-initialized data for some branches
    - due to the above, we order strictly some checks and we have the case
      where a bad node time result will skip checking of node volumes
    - many many local variables, with each new check adding a new dict,
      leading to a spaghetti of dicts in the main Exec function
    - monolithic code, both Exec() and _NodeVerify() do a lot of
      independent checks
    This patch does an imperfect rewrite, but at least we gain:
    - a clear infrastructure for adding more checks (the new NodeImage
      class, with it's clear and documented fields), and removal of most
      per-node dicts from the Exec() function
    - the new NodeImage object should allow better type safety, e.g. by
      allowing pylint to check the actual object attributes rather than
      strings as dict keys
    - a-priori initialization of data fields, eliminating the need to
      introduce dependencies between checks
    - per-result-key status field, allowing elimination of duplicate error
      messages (where we want)
    - split of most independent checks into separate functions, for greater
    The new code, being new will probably introduce for the short term more
    bugs than it removes. However, it should offer a much better way for
    extending cluster verify in the future.
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
cmdlib.py 332 KB