This patch series fixes user down to keep being reported even after an instance has been cleaned up. This is achieved by extending the instance class with an additional field, 'admin_state_source', which keeps track of who last changed the instance field 'admin_state'. With this, USER_down is reported when either the instance has been shutdown by the user and its configuration state is still ADMIN_up, or when the instance has been cleaned up and its configuration state is USER_down.
This patch series also modifies the watcher to clean user down instances, only once, and it modifies 'Hypervisor.ListInstances' to exclude user down instances, as well as, start, stop, and reboot instance functions in 'ganeti.backend' to use 'GetInstanceInfo' instead of 'ListInstances'. Finally, the QA is extended to test more attributes related to user down. Two patches in this series have been submitted by Apollon and reviewed by me. Apollon Oikonomopoulos (2): Correctly report user-down instance status luxid: report error-down when user shutdown not allowed Jose A. Lopes (16): Fix typo in docstring Fix whitespace Use keyword args when passing 'hvparams' to 'ListInstances' Remove unnecessary list copying Use standard 'Raise' method for LU exceptions Add type 'AdminStateSource', tracks changes to 'admin_state' Add field 'admin_state_source' to the Instance class Add field 'admin_state_source' to unit tests Modify config to update 'admin_state_source' Fix instance queries to correctly report USER_down Modify instance shutdown to optionally mark as user down Modify watcher to properly cleanup user down instances Allow instance start for user down instances Extend QA for instance user down Modify 'Hypervisor.ListInstances' to exclude user downs Assume that instance keys might not be present in watcher lib/backend.py | 80 +++++----- lib/cmdlib/common.py | 2 +- lib/cmdlib/instance.py | 1 + lib/cmdlib/instance_operation.py | 78 ++++++++-- lib/cmdlib/instance_query.py | 24 ++- lib/config.py | 34 ++++- lib/ht.py | 1 + lib/hypervisor/hv_kvm.py | 2 +- lib/hypervisor/hv_xen.py | 13 +- lib/objects.py | 3 + lib/query.py | 64 +++++--- lib/watcher/__init__.py | 34 ++++- lib/watcher/state.py | 12 +- qa/ganeti-qa.py | 2 +- qa/qa_daemon.py | 6 +- qa/qa_instance.py | 165 +++++++++++++++------ src/Ganeti/Constants.hs | 11 ++ src/Ganeti/Luxi.hs | 2 +- src/Ganeti/Objects.hs | 25 ++-- src/Ganeti/OpCodes.hs | 3 + src/Ganeti/OpParams.hs | 7 + src/Ganeti/Query/Instance.hs | 32 ++-- src/Ganeti/Types.hs | 12 ++ test/data/htools/hail-alloc-drbd.json | 10 ++ .../data/htools/hail-alloc-restricted-network.json | 3 + test/data/htools/hail-alloc-spindles.json | 4 + test/data/htools/hail-change-group.json | 10 ++ test/data/htools/hail-node-evac.json | 10 ++ test/data/htools/hail-reloc-drbd.json | 10 ++ test/data/htools/rapi/instances.json | 11 ++ test/data/instance-prim-sec.txt | 1 + test/hs/Test/Ganeti/Objects.hs | 4 + test/hs/Test/Ganeti/OpCodes.hs | 18 ++- test/hs/Test/Ganeti/Query/Instance.hs | 14 +- test/py/cmdlib/testsupport/config_mock.py | 4 + test/py/ganeti.query_unittest.py | 46 ++++-- tools/cfgupgrade | 10 ++ 37 files changed, 566 insertions(+), 202 deletions(-) -- 1.9.1.423.g4596e3a
