LGTM, thanks
On Wed, May 28, 2014 at 12:37 PM, 'Jose A. Lopes' via ganeti-devel < [email protected]> wrote: > From: Apollon Oikonomopoulos <[email protected]> > > Info queries on user-down instances would fail, because of a check > against instance.hvparams which only contains the instance's non-default > parameters. To fix this, we use GetUpdatedParams, to merge with the cluster > hypervisor parameters. > > We also fix a logic error uncovered after the above fix: instances that > were shut down by the user but not marked for user_shutdown, would be > reported as "up" instead of "down". > > Signed-off-by: Apollon Oikonomopoulos <[email protected]> > Signed-off-by: Jose A. Lopes <[email protected]> > --- > lib/cmdlib/instance_query.py | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/lib/cmdlib/instance_query.py b/lib/cmdlib/instance_query.py > index 28fae88..36ae190 100644 > --- a/lib/cmdlib/instance_query.py > +++ b/lib/cmdlib/instance_query.py > @@ -28,7 +28,7 @@ from ganeti import constants > from ganeti import locking > from ganeti.cmdlib.base import NoHooksLU > from ganeti.cmdlib.common import ShareAll, GetWantedInstances, \ > - CheckInstancesNodeGroups, AnnotateDiskParams > + CheckInstancesNodeGroups, AnnotateDiskParams, GetUpdatedParams > from ganeti.cmdlib.instance_utils import NICListToTuple > from ganeti.hypervisor import hv_base > > @@ -229,10 +229,14 @@ class LUInstanceQueryData(NoHooksLU): > remote_info.Raise("Error checking node %s" % pnode.name) > remote_info = remote_info.payload > if remote_info and "state" in remote_info: > - if hv_base.HvInstanceState.IsShutdown(remote_info["state"]) \ > - and (instance.hypervisor != constants.HT_KVM > - or > instance.hvparams[constants.HV_KVM_USER_SHUTDOWN]): > - remote_state = "user down" > + hvparams = GetUpdatedParams(instance.hvparams, > + > cluster.hvparams[instance.hypervisor]) > + if hv_base.HvInstanceState.IsShutdown(remote_info["state"]): > + if (instance.hypervisor != constants.HT_KVM > + or hvparams[constants.HV_KVM_USER_SHUTDOWN]): > + remote_state = "user down" > + else: > + remote_state = "down" > else: > remote_state = "up" > else: > -- > 1.9.1.423.g4596e3a > >
