From 1e7acc3b32ef9a835fa9d26ed7976474be945058 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 23 Jan 2012 18:08:50 +0100 Subject: [PATCH] Fix gnt-cluster modify check of passed options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit β¦ and add the disk_templates/vcpu_ratio new entries. Since the default ispecs_* are dicts, we can't compare them to none. Additionally, add a QA test for this case (empty cluster modify). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/client/gnt_cluster.py | 12 +++++++----- qa/ganeti-qa.py | 3 ++- qa/qa_cluster.py | 7 ++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py index add24d6c8..b1054c90e 100644 --- a/lib/client/gnt_cluster.py +++ b/lib/client/gnt_cluster.py @@ -949,11 +949,13 @@ def SetClusterParams(opts, args): opts.prealloc_wipe_disks is not None or opts.hv_state or opts.disk_state or - opts.ispecs_mem_size is not None or - opts.ispecs_cpu_count is not None or - opts.ispecs_disk_count is not None or - opts.ispecs_disk_size is not None or - opts.ispecs_nic_count is not None): + opts.ispecs_mem_size or + opts.ispecs_cpu_count or + opts.ispecs_disk_count or + opts.ispecs_disk_size or + opts.ispecs_nic_count or + opts.ipolicy_disk_templates is not None or + opts.ipolicy_vcpu_ratio is not None): ToStderr("Please give at least one of the parameters.") return 1 diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 26f9d6876..669e0d3f3 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -1,7 +1,7 @@ #!/usr/bin/python -u # -# Copyright (C) 2007, 2008, 2009, 2010, 2011 Google Inc. +# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -160,6 +160,7 @@ def RunClusterTests(): ("cluster-verify", qa_cluster.TestClusterVerify), ("cluster-reserved-lvs", qa_cluster.TestClusterReservedLvs), # TODO: add more cluster modify tests + ("cluster-modify", qa_cluster.TestClusterModifyEmpty), ("cluster-modify", qa_cluster.TestClusterModifyBe), ("cluster-modify", qa_cluster.TestClusterModifyDisk), ("cluster-rename", qa_cluster.TestClusterRename), diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index 233cacb0c..77a78fb68 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2007, 2010, 2011 Google Inc. +# Copyright (C) 2007, 2010, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -276,6 +276,11 @@ def TestClusterReservedLvs(): AssertCommand(cmd, fail=fail) +def TestClusterModifyEmpty(): + """gnt-cluster modify""" + AssertCommand(["gnt-cluster", "modify"], fail=True) + + def TestClusterModifyDisk(): """gnt-cluster modify -D""" for param in _FAIL_PARAMS: -- GitLab