Make backend._GetVGInfo check the validity of 'vgs'
authorIustin Pop <iustin@google.com>
Sun, 20 Jan 2008 22:13:16 +0000 (22:13 +0000)
committerIustin Pop <iustin@google.com>
Sun, 20 Jan 2008 22:13:16 +0000 (22:13 +0000)
commitf4d377e7fe5989b2102e7d8712b8e19c1fcd163b
tree829e78d72f2f9db275d8652cae4ed8eed7684c7f
parent8d75db10386d371c4a6c2761aece881d1aed2c8b
Make backend._GetVGInfo check the validity of 'vgs'

Currently, the function backend._GetVGInfo only checks for errors via
the exit code of the 'vgs' command. However, there are other ways of
failure so we need to also check for valid output before parsing.

Furthermore, the checks on the exit code were reported via a 'raise
LVMError', however this exception is not handled anywhere and so the
remote caller will not get reasonable data.

This patch does two main things:
  - change the calling protocol for this function to not raise an error,
    and instead return the same type of argument always (dict) with the
    requested keys but values changed into None; this allows in the
    parent rpc call node_info to have valid memory information but
    "error" value for disk space, if there's an error with disks
  - check the validity of the output so that in case we fail to parse
    it, we don't abort with a backtrace in the node daemon but instead
    return the default result value (containing errors), and log these
    cases in the node daemon log file

We also bump the protocol version to 11.

Reviewed-by: ultrotter
lib/backend.py
lib/constants.py