Revision aecba21e qa/qa_cluster.py
b/qa/qa_cluster.py | ||
---|---|---|
60 | 60 |
""" |
61 | 61 |
cmd = utils.ShellQuoteArgs(["cat", filename]) |
62 | 62 |
for node in qa_config.get("nodes"): |
63 |
AssertEqual(qa_utils.GetCommandOutput(node["primary"], cmd), content)
|
|
63 |
AssertEqual(qa_utils.GetCommandOutput(node.primary, cmd), content)
|
|
64 | 64 |
|
65 | 65 |
|
66 | 66 |
# "gnt-cluster info" fields |
... | ... | |
81 | 81 |
""" |
82 | 82 |
master = qa_config.GetMasterNode() |
83 | 83 |
infocmd = "gnt-cluster info" |
84 |
info_out = qa_utils.GetCommandOutput(master["primary"], infocmd)
|
|
84 |
info_out = qa_utils.GetCommandOutput(master.primary, infocmd)
|
|
85 | 85 |
ret = None |
86 | 86 |
for l in info_out.splitlines(): |
87 | 87 |
m = _CIFIELD_RE.match(l) |
... | ... | |
123 | 123 |
cvcmd = "gnt-cluster verify" |
124 | 124 |
mnode = qa_config.GetMasterNode() |
125 | 125 |
if errors: |
126 |
cvout = GetCommandOutput(mnode["primary"], cvcmd + " --error-codes",
|
|
126 |
cvout = GetCommandOutput(mnode.primary, cvcmd + " --error-codes",
|
|
127 | 127 |
fail=True) |
128 | 128 |
actual = _GetCVErrorCodes(cvout) |
129 | 129 |
expected = compat.UniqueFrozenset(e for (_, e, _) in errors) |
... | ... | |
161 | 161 |
fh.write("%s %s write\n" % (rapi_user, rapi_secret)) |
162 | 162 |
fh.flush() |
163 | 163 |
|
164 |
tmpru = qa_utils.UploadFile(master["primary"], fh.name)
|
|
164 |
tmpru = qa_utils.UploadFile(master.primary, fh.name)
|
|
165 | 165 |
try: |
166 | 166 |
AssertCommand(["mkdir", "-p", rapi_dir]) |
167 | 167 |
AssertCommand(["mv", tmpru, pathutils.RAPI_USERS_FILE]) |
... | ... | |
185 | 185 |
if spec: |
186 | 186 |
cmd.append("--specs-%s=%s=%d" % (spec_type, spec_val, spec)) |
187 | 187 |
|
188 |
if master.get("secondary", None):
|
|
189 |
cmd.append("--secondary-ip=%s" % master["secondary"])
|
|
188 |
if master.secondary:
|
|
189 |
cmd.append("--secondary-ip=%s" % master.secondary)
|
|
190 | 190 |
|
191 | 191 |
vgname = qa_config.get("vg-name", None) |
192 | 192 |
if vgname: |
... | ... | |
294 | 294 |
master = qa_config.GetMasterNode() |
295 | 295 |
|
296 | 296 |
# Assert that OOB is unavailable for all nodes |
297 |
result_output = GetCommandOutput(master["primary"],
|
|
297 |
result_output = GetCommandOutput(master.primary,
|
|
298 | 298 |
"gnt-node list --verbose --no-headers -o" |
299 | 299 |
" powered") |
300 | 300 |
AssertEqual(compat.all(powered == "(unavail)" |
... | ... | |
306 | 306 |
AssertCommand(["gnt-cluster", "epo", "--all", "some_arg"], fail=True) |
307 | 307 |
|
308 | 308 |
# Unless --all is given master is not allowed to be in the list |
309 |
AssertCommand(["gnt-cluster", "epo", "-f", master["primary"]], fail=True)
|
|
309 |
AssertCommand(["gnt-cluster", "epo", "-f", master.primary], fail=True)
|
|
310 | 310 |
|
311 | 311 |
# This shouldn't fail |
312 | 312 |
AssertCommand(["gnt-cluster", "epo", "-f", "--all"]) |
313 | 313 |
|
314 | 314 |
# All instances should have been stopped now |
315 |
result_output = GetCommandOutput(master["primary"],
|
|
315 |
result_output = GetCommandOutput(master.primary,
|
|
316 | 316 |
"gnt-instance list --no-headers -o status") |
317 | 317 |
# ERROR_down because the instance is stopped but not recorded as such |
318 | 318 |
AssertEqual(compat.all(status == "ERROR_down" |
... | ... | |
322 | 322 |
AssertCommand(["gnt-cluster", "epo", "--on", "-f", "--all"]) |
323 | 323 |
|
324 | 324 |
# All instances should have been started now |
325 |
result_output = GetCommandOutput(master["primary"],
|
|
325 |
result_output = GetCommandOutput(master.primary,
|
|
326 | 326 |
"gnt-instance list --no-headers -o status") |
327 | 327 |
AssertEqual(compat.all(status == "running" |
328 | 328 |
for status in result_output.splitlines()), True) |
... | ... | |
344 | 344 |
AssertCommand(["gnt-debug", "delay", "1"]) |
345 | 345 |
AssertCommand(["gnt-debug", "delay", "--no-master", "1"]) |
346 | 346 |
AssertCommand(["gnt-debug", "delay", "--no-master", |
347 |
"-n", node["primary"], "1"])
|
|
347 |
"-n", node.primary, "1"])
|
|
348 | 348 |
|
349 | 349 |
|
350 | 350 |
def TestClusterReservedLvs(): |
... | ... | |
457 | 457 |
"--rapi-certificate=/dev/null"] |
458 | 458 |
AssertCommand(cmd, fail=True) |
459 | 459 |
|
460 |
rapi_cert_backup = qa_utils.BackupFile(master["primary"],
|
|
460 |
rapi_cert_backup = qa_utils.BackupFile(master.primary,
|
|
461 | 461 |
pathutils.RAPI_CERT_FILE) |
462 | 462 |
try: |
463 | 463 |
# Custom RAPI certificate |
... | ... | |
468 | 468 |
|
469 | 469 |
utils.GenerateSelfSignedSslCert(fh.name, validity=validity) |
470 | 470 |
|
471 |
tmpcert = qa_utils.UploadFile(master["primary"], fh.name)
|
|
471 |
tmpcert = qa_utils.UploadFile(master.primary, fh.name)
|
|
472 | 472 |
try: |
473 | 473 |
AssertCommand(["gnt-cluster", "renew-crypto", "--force", |
474 | 474 |
"--rapi-certificate=%s" % tmpcert]) |
... | ... | |
481 | 481 |
cds_fh.write("\n") |
482 | 482 |
cds_fh.flush() |
483 | 483 |
|
484 |
tmpcds = qa_utils.UploadFile(master["primary"], cds_fh.name)
|
|
484 |
tmpcds = qa_utils.UploadFile(master.primary, cds_fh.name)
|
|
485 | 485 |
try: |
486 | 486 |
AssertCommand(["gnt-cluster", "renew-crypto", "--force", |
487 | 487 |
"--cluster-domain-secret=%s" % tmpcds]) |
... | ... | |
525 | 525 |
if len(instances) < 1: |
526 | 526 |
raise qa_error.Error("Burnin needs at least one instance") |
527 | 527 |
|
528 |
script = qa_utils.UploadFile(master["primary"], "../tools/burnin")
|
|
528 |
script = qa_utils.UploadFile(master.primary, "../tools/burnin")
|
|
529 | 529 |
try: |
530 | 530 |
# Run burnin |
531 | 531 |
cmd = [script, |
... | ... | |
613 | 613 |
f.seek(0) |
614 | 614 |
|
615 | 615 |
# Upload file to master node |
616 |
testname = qa_utils.UploadFile(master["primary"], f.name)
|
|
616 |
testname = qa_utils.UploadFile(master.primary, f.name)
|
|
617 | 617 |
try: |
618 | 618 |
# Copy file to all nodes |
619 | 619 |
AssertCommand(["gnt-cluster", "copyfile", testname]) |
... | ... | |
676 | 676 |
"""cluster-verify reports exclusive_storage set only on one node. |
677 | 677 |
|
678 | 678 |
""" |
679 |
node_name = node["primary"]
|
|
679 |
node_name = node.primary
|
|
680 | 680 |
es_val = _GetBoolClusterField("exclusive_storage") |
681 | 681 |
assert not es_val |
682 | 682 |
AssertCommand(_BuildSetESCmd(True, node_name)) |
... | ... | |
692 | 692 |
vgname = qa_config.get("vg-name", constants.DEFAULT_VG) |
693 | 693 |
lvname1 = _QA_LV_PREFIX + "vol1" |
694 | 694 |
lvname2 = _QA_LV_PREFIX + "vol2" |
695 |
node_name = node["primary"]
|
|
695 |
node_name = node.primary
|
|
696 | 696 |
AssertCommand(["lvcreate", "-L1G", "-n", lvname1, vgname], node=node_name) |
697 | 697 |
AssertClusterVerify(fail=True, errors=[constants.CV_ENODEORPHANLV]) |
698 | 698 |
AssertCommand(["lvcreate", "-L1G", "-n", lvname2, vgname], node=node_name) |
Also available in: Unified diff