Make backend._GetVGInfo check the validity of 'vgs'
authorIustin Pop <iustin@google.com>
Mon, 28 Jan 2008 14:44:06 +0000 (14:44 +0000)
committerIustin Pop <iustin@google.com>
Mon, 28 Jan 2008 14:44:06 +0000 (14:44 +0000)
commit8c5533a51c3bd235f6d7612bb209fe8c7db094aa
tree20ce93737d6847aab16007410df0337be70916b4
parent6248146c62a909ba6ddae9b149667b6caea165d5
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