39 |
39 |
from qa_utils import AssertEqual, AssertCommand, GetCommandOutput
|
40 |
40 |
|
41 |
41 |
|
|
42 |
# Prefix for LVM volumes created by QA code during tests
|
|
43 |
_QA_LV_PREFIX = "qa-"
|
|
44 |
|
42 |
45 |
#: cluster verify command
|
43 |
46 |
_CLUSTER_VERIFY = ["gnt-cluster", "verify"]
|
44 |
47 |
|
... | ... | |
185 |
188 |
if master.get("secondary", None):
|
186 |
189 |
cmd.append("--secondary-ip=%s" % master["secondary"])
|
187 |
190 |
|
|
191 |
vgname = qa_config.get("vg-name", None)
|
|
192 |
if vgname:
|
|
193 |
cmd.append("--vg-name=%s" % vgname)
|
|
194 |
|
188 |
195 |
master_netdev = qa_config.get("master-netdev", None)
|
189 |
196 |
if master_netdev:
|
190 |
197 |
cmd.append("--master-netdev=%s" % master_netdev)
|
... | ... | |
334 |
341 |
|
335 |
342 |
def TestClusterReservedLvs():
|
336 |
343 |
"""gnt-cluster reserved lvs"""
|
|
344 |
vgname = qa_config.get("vg-name", constants.DEFAULT_VG)
|
|
345 |
lvname = _QA_LV_PREFIX + "test"
|
|
346 |
lvfullname = "/".join([vgname, lvname])
|
337 |
347 |
for fail, cmd in [
|
338 |
348 |
(False, _CLUSTER_VERIFY),
|
339 |
349 |
(False, ["gnt-cluster", "modify", "--reserved-lvs", ""]),
|
340 |
|
(False, ["lvcreate", "-L1G", "-nqa-test", "xenvg"]),
|
|
350 |
(False, ["lvcreate", "-L1G", "-n", lvname, vgname]),
|
341 |
351 |
(True, _CLUSTER_VERIFY),
|
342 |
352 |
(False, ["gnt-cluster", "modify", "--reserved-lvs",
|
343 |
|
"xenvg/qa-test,.*/other-test"]),
|
|
353 |
"%s,.*/other-test" % lvfullname]),
|
344 |
354 |
(False, _CLUSTER_VERIFY),
|
345 |
|
(False, ["gnt-cluster", "modify", "--reserved-lvs", ".*/qa-.*"]),
|
|
355 |
(False, ["gnt-cluster", "modify", "--reserved-lvs",
|
|
356 |
".*/%s.*" % _QA_LV_PREFIX]),
|
346 |
357 |
(False, _CLUSTER_VERIFY),
|
347 |
358 |
(False, ["gnt-cluster", "modify", "--reserved-lvs", ""]),
|
348 |
359 |
(True, _CLUSTER_VERIFY),
|
349 |
|
(False, ["lvremove", "-f", "xenvg/qa-test"]),
|
|
360 |
(False, ["lvremove", "-f", lvfullname]),
|
350 |
361 |
(False, _CLUSTER_VERIFY),
|
351 |
362 |
]:
|
352 |
363 |
AssertCommand(cmd, fail=fail)
|