Revision cb178a1e qa/qa_cluster.py
b/qa/qa_cluster.py | ||
---|---|---|
544 | 544 |
for (key, val) in policy.items(): |
545 | 545 |
if key in ispec_keys: |
546 | 546 |
for (par, pval) in val.items(): |
547 |
if par == "memory-size": |
|
548 |
par = "mem-size" |
|
549 | 547 |
d = ret_specs.setdefault(par, {}) |
550 | 548 |
d[key] = pval |
551 | 549 |
else: |
... | ... | |
617 | 615 |
AssertEqual(eff_policy[p], old_policy[p]) |
618 | 616 |
|
619 | 617 |
|
618 |
def _GetParameterOptions(key, specs, old_specs): |
|
619 |
values = ["%s=%s" % (par, keyvals[key]) |
|
620 |
for (par, keyvals) in specs.items() |
|
621 |
if key in keyvals] |
|
622 |
if old_specs: |
|
623 |
present_pars = frozenset(par |
|
624 |
for (par, keyvals) in specs.items() |
|
625 |
if key in keyvals) |
|
626 |
values.extend("%s=%s" % (par, keyvals[key]) |
|
627 |
for (par, keyvals) in old_specs.items() |
|
628 |
if key in keyvals and par not in present_pars) |
|
629 |
return ",".join(values) |
|
630 |
|
|
631 |
|
|
620 | 632 |
def TestClusterSetISpecs(new_specs, fail=False, old_values=None): |
621 | 633 |
"""Change instance specs. |
622 | 634 |
|
... | ... | |
637 | 649 |
(old_policy, old_specs) = _GetClusterIPolicy() |
638 | 650 |
if new_specs: |
639 | 651 |
cmd = ["gnt-cluster", "modify"] |
640 |
for (par, keyvals) in new_specs.items(): |
|
641 |
if par == "spindle-use": |
|
642 |
# ignore spindle-use, which is not settable |
|
643 |
continue |
|
644 |
cmd += [ |
|
645 |
"--specs-%s" % par, |
|
646 |
",".join(["%s=%s" % (k, v) for (k, v) in keyvals.items()]), |
|
647 |
] |
|
652 |
if any(("min" in val or "max" in val) for val in new_specs.values()): |
|
653 |
minmax_opt_items = [] |
|
654 |
for key in ["min", "max"]: |
|
655 |
keyopt = _GetParameterOptions(key, new_specs, old_specs) |
|
656 |
minmax_opt_items.append("%s:%s" % (key, keyopt)) |
|
657 |
cmd.extend([ |
|
658 |
"--ipolicy-bounds-specs", |
|
659 |
"/".join(minmax_opt_items) |
|
660 |
]) |
|
661 |
std_opt = _GetParameterOptions("std", new_specs, {}) |
|
662 |
if std_opt: |
|
663 |
cmd.extend(["--ipolicy-std-specs", std_opt]) |
|
648 | 664 |
AssertCommand(cmd, fail=fail) |
665 |
|
|
649 | 666 |
# Check the new state |
650 | 667 |
(eff_policy, eff_specs) = _GetClusterIPolicy() |
651 | 668 |
AssertEqual(eff_policy, old_policy) |
... | ... | |
663 | 680 |
|
664 | 681 |
def TestClusterModifyISpecs(): |
665 | 682 |
"""gnt-cluster modify --specs-*""" |
666 |
params = ["mem-size", "disk-size", "disk-count", "cpu-count", "nic-count"] |
|
683 |
params = ["memory-size", "disk-size", "disk-count", "cpu-count", "nic-count"]
|
|
667 | 684 |
(cur_policy, cur_specs) = _GetClusterIPolicy() |
668 | 685 |
for par in params: |
669 | 686 |
test_values = [ |
Also available in: Unified diff