diff --git a/lib/cmdlib.py b/lib/cmdlib.py index c2085b9f36bc136bda315721b4be9a32869abbf6..a10aba72ee92024fa98d3c8e3072a712d27120dc 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2575,8 +2575,7 @@ class LUSetClusterParams(LogicalUnit): ht.TNone)), ("hvparams", None, ht.TOr(ht.TDictOf(ht.TNonEmptyString, ht.TDict), ht.TNone)), - ("beparams", None, ht.TOr(ht.TDictOf(ht.TNonEmptyString, ht.TDict), - ht.TNone)), + ("beparams", None, ht.TOr(ht.TDict, ht.TNone)), ("os_hvp", None, ht.TOr(ht.TDictOf(ht.TNonEmptyString, ht.TDict), ht.TNone)), ("osparams", None, ht.TOr(ht.TDictOf(ht.TNonEmptyString, ht.TDict), diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index aace2348022105cbd2c3d9257424a7a988cb2510..af8ddb59698e20dca806a04b4bd2ef941185b92b 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -128,6 +128,10 @@ def RunClusterTests(): if qa_config.TestEnabled('cluster-reserved-lvs'): RunTest(qa_cluster.TestClusterReservedLvs) + if qa_config.TestEnabled("cluster-modify"): + RunTest(qa_cluster.TestClusterModifyBe) + # TODO: add more cluster modify tests + if qa_config.TestEnabled('cluster-rename'): RunTest(qa_cluster.TestClusterRename) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index 3b1be0df60ecb7e6258f4ffb8fb15077f7508134..57fd3539f1655461535aeeb32ae4788a61a90c34 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -51,6 +51,7 @@ "cluster-destroy": true, "cluster-rename": true, "cluster-reserved-lvs": true, + "cluster-modify": true, "node-info": true, "node-volumes": true, diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index bab5bc6280676dae241645e87bcdf7c9a9a01306..f615a736bb35a7305bc349663dbf3408dca7fd27 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -171,6 +171,34 @@ def TestClusterReservedLvs(): utils.ShellQuoteArgs(cmd)).wait(), rcode) +def TestClusterModifyBe(): + """gnt-cluster modify -B""" + master = qa_config.GetMasterNode() + + for rcode, cmd in [ + # mem + (0, ["gnt-cluster", "modify", "-B", "memory=256"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 256$'"]), + (1, ["gnt-cluster", "modify", "-B", "memory=a"]), + (0, ["gnt-cluster", "modify", "-B", "memory=128"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 128$'"]), + # vcpus + (0, ["gnt-cluster", "modify", "-B", "vcpus=4"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 4$'"]), + (1, ["gnt-cluster", "modify", "-B", "vcpus=a"]), + (0, ["gnt-cluster", "modify", "-B", "vcpus=1"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 1$'"]), + # auto_balance + (0, ["gnt-cluster", "modify", "-B", "auto_balance=False"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: False$'"]), + (1, ["gnt-cluster", "modify", "-B", "auto_balance=1"]), + (0, ["gnt-cluster", "modify", "-B", "auto_balance=True"]), + (0, ["sh", "-c", "gnt-cluster info|grep '^ *auto_balance: True$'"]), + ]: + AssertEqual(StartSSH(master['primary'], + utils.ShellQuoteArgs(cmd)).wait(), rcode) + + def TestClusterInfo(): """gnt-cluster info""" master = qa_config.GetMasterNode()