• Iustin Pop's avatar
    Fix handling of 'vcpus' in instance list · c1ce76bb
    Iustin Pop authored
    
    
    Currently running “gnt-instance list -o+vcpus” fails with a cryptic message:
      Unhandled Ganeti error: vcpus
    
    This is due to multiple issues:
      - in some corner cases cmdlib.py raises an errors.ParameterError but
        this is not handled by cli.py
      - LUQueryInstances declares ‘vcpu’ as a supported field, but doesn't handle
        it, so instead of failing with unknown parameter, e.g.:
          Failure: prerequisites not met for this operation:
          Unknown output fields selected: vcpuscd
        it raises the ParameteError message
    
    This patch:
      - adds handling of 'vcpus' to LUQueryInstances
      - adds handling of the ParameterError exception to cli.py
      - changes the 'else: raise errors.ParameterError' in the field handling of
        LUQueryInstance to an assert, since it's a programmer error if we reached
        this step
    
    With this, a future unhandled parameter will show:
      gnt-instance list -o+vcpus
      Unhandled protocol error while talking to the master daemon:
      Caught exception: Declared but unhandled parameter 'vcpus'
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
    c1ce76bb
cli.py 30.9 KB