Skip to content
Snippets Groups Projects
Commit c1ce76bb authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix handling of 'vcpus' in instance list


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>
parent 6dfad215
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment