Revision 7af293d7
b/qa/ganeti-qa.py | ||
---|---|---|
273 | 273 |
RunTestIf(os_enabled, fn) |
274 | 274 |
|
275 | 275 |
|
276 |
def RunCommonInstanceTests(instance): |
|
276 |
def RunCommonInstanceTests(instance, inst_nodes):
|
|
277 | 277 |
"""Runs a few tests that are common to all disk types. |
278 | 278 |
|
279 | 279 |
""" |
... | ... | |
346 | 346 |
|
347 | 347 |
RunTestIf("tags", qa_tags.TestInstanceTags, instance) |
348 | 348 |
|
349 |
if instance.disk_template == constants.DT_DRBD8: |
|
350 |
RunTestIf("cluster-verify", |
|
351 |
qa_cluster.TestClusterVerifyDisksBrokenDRBD, instance, inst_nodes) |
|
349 | 352 |
RunTestIf("cluster-verify", qa_cluster.TestClusterVerify) |
350 | 353 |
|
351 | 354 |
RunTestIf(qa_rapi.Enabled, qa_rapi.TestInstance, instance) |
... | ... | |
729 | 732 |
RunTest(qa_instance.TestInstanceStartup, instance) |
730 | 733 |
RunTestIf("instance-modify-disks", |
731 | 734 |
qa_instance.TestInstanceModifyDisks, instance) |
732 |
RunCommonInstanceTests(instance) |
|
735 |
RunCommonInstanceTests(instance, inodes)
|
|
733 | 736 |
if qa_config.TestEnabled("instance-modify-primary"): |
734 | 737 |
othernode = qa_config.AcquireNode() |
735 | 738 |
RunTest(qa_instance.TestInstanceModifyPrimaryAndBack, |
... | ... | |
802 | 805 |
use_client) |
803 | 806 |
try: |
804 | 807 |
if qa_config.TestEnabled("instance-plain-rapi-common-tests"): |
805 |
RunCommonInstanceTests(rapi_instance) |
|
808 |
RunCommonInstanceTests(rapi_instance, [pnode])
|
|
806 | 809 |
RunTest(qa_rapi.TestRapiInstanceRemove, rapi_instance, use_client) |
807 | 810 |
finally: |
808 | 811 |
rapi_instance.Release() |
b/qa/qa_cluster.py | ||
---|---|---|
33 | 33 |
from ganeti import pathutils |
34 | 34 |
|
35 | 35 |
import qa_config |
36 |
import qa_daemon |
|
36 | 37 |
import qa_utils |
37 | 38 |
import qa_error |
38 | 39 |
import qa_instance |
... | ... | |
347 | 348 |
AssertCommand(["gnt-cluster", "verify-disks"]) |
348 | 349 |
|
349 | 350 |
|
351 |
def TestClusterVerifyDisksBrokenDRBD(instance, inst_nodes): |
|
352 |
"""gnt-cluster verify-disks with broken DRBD""" |
|
353 |
qa_daemon.TestPauseWatcher() |
|
354 |
|
|
355 |
try: |
|
356 |
info = qa_instance.GetInstanceInfo(instance.name) |
|
357 |
snode = inst_nodes[1] |
|
358 |
for idx, minor in enumerate(info["drbd-minors"][snode.primary]): |
|
359 |
if idx % 2 == 0: |
|
360 |
break_drbd_cmd = \ |
|
361 |
"(drbdsetup %d down >/dev/null 2>&1;" \ |
|
362 |
" drbdsetup down resource%d >/dev/null 2>&1) || /bin/true" % \ |
|
363 |
(minor, minor) |
|
364 |
else: |
|
365 |
break_drbd_cmd = \ |
|
366 |
"(drbdsetup %d detach >/dev/null 2>&1;" \ |
|
367 |
" drbdsetup detach %d >/dev/null 2>&1) || /bin/true" % \ |
|
368 |
(minor, minor) |
|
369 |
AssertCommand(break_drbd_cmd, node=snode) |
|
370 |
|
|
371 |
verify_output = GetCommandOutput(qa_config.GetMasterNode().primary, |
|
372 |
"gnt-cluster verify-disks") |
|
373 |
activation_msg = "Activating disks for instance '%s'" % instance.name |
|
374 |
if activation_msg not in verify_output: |
|
375 |
raise qa_error.Error("gnt-cluster verify-disks did not activate broken" |
|
376 |
" DRBD disks:\n%s" % verify_output) |
|
377 |
|
|
378 |
verify_output = GetCommandOutput(qa_config.GetMasterNode().primary, |
|
379 |
"gnt-cluster verify-disks") |
|
380 |
if activation_msg in verify_output: |
|
381 |
raise qa_error.Error("gnt-cluster verify-disks wants to activate broken" |
|
382 |
" DRBD disks on second attempt:\n%s" % verify_output) |
|
383 |
|
|
384 |
AssertCommand(_CLUSTER_VERIFY) |
|
385 |
finally: |
|
386 |
qa_daemon.TestResumeWatcher() |
|
387 |
|
|
388 |
|
|
350 | 389 |
def TestJobqueue(): |
351 | 390 |
"""gnt-debug test-jobqueue""" |
352 | 391 |
AssertCommand(["gnt-debug", "test-jobqueue"]) |
b/qa/qa_instance.py | ||
---|---|---|
48 | 48 |
return "/sys/block/%s/device/state" % disk |
49 | 49 |
|
50 | 50 |
|
51 |
def _GetInstanceInfo(instance):
|
|
51 |
def GetInstanceInfo(instance): |
|
52 | 52 |
"""Return information about the actual state of an instance. |
53 | 53 |
|
54 | 54 |
@type instance: string |
... | ... | |
129 | 129 |
@param instance: the instance |
130 | 130 |
|
131 | 131 |
""" |
132 |
info = _GetInstanceInfo(instance.name)
|
|
132 |
info = GetInstanceInfo(instance.name) |
|
133 | 133 |
# FIXME: destruction/removal should be part of the disk class |
134 | 134 |
if info["storage-type"] == constants.ST_LVM_VG: |
135 | 135 |
vols = info["volumes"] |
... | ... | |
357 | 357 |
finally: |
358 | 358 |
qa_utils.RemoveFromEtcHosts(["meeeeh-not-exists", rename_target]) |
359 | 359 |
|
360 |
info = _GetInstanceInfo(rename_source)
|
|
360 |
info = GetInstanceInfo(rename_source) |
|
361 | 361 |
|
362 | 362 |
# Check instance volume tags correctly updated. Note that this check is lvm |
363 | 363 |
# specific, so we skip it for non-lvm-based instances. |
... | ... | |
972 | 972 |
@param set_online: function to call to set the node on-line |
973 | 973 |
|
974 | 974 |
""" |
975 |
info = _GetInstanceInfo(instance.name)
|
|
975 |
info = GetInstanceInfo(instance.name) |
|
976 | 976 |
set_offline(snode) |
977 | 977 |
try: |
978 | 978 |
TestInstanceRemove(instance) |
... | ... | |
991 | 991 |
# syntax), we always have to perform both commands and ignore the |
992 | 992 |
# output. |
993 | 993 |
drbd_shutdown_cmd = \ |
994 |
"(drbdsetup %d down && drbdsetup down resource%d) || /bin/true" % \ |
|
994 |
"(drbdsetup %d down >/dev/null 2>&1;" \ |
|
995 |
" drbdsetup down resource%d >/dev/null 2>&1) || /bin/true" % \ |
|
995 | 996 |
(minor, minor) |
996 | 997 |
AssertCommand(drbd_shutdown_cmd, node=snode) |
997 | 998 |
AssertCommand(["lvremove", "-f"] + info["volumes"], node=snode) |
Also available in: Unified diff