• Iustin Pop's avatar
    Make backend._GetVGInfo check the validity of 'vgs' · f4d377e7
    Iustin Pop authored
    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
    f4d377e7
backend.py 45.2 KB