Commit 1e7acc3b authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix gnt-cluster modify check of passed options



… 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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 976b78ba
......@@ -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
......
#!/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),
......
#
#
# 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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment