Commit 7910e7a5 authored by Michael Hanselmann's avatar Michael Hanselmann

Forward-port: Add QA test for “gnt-instance replace-disks”

Reviewed-by: iustinp
parent a53a1b18
...@@ -207,6 +207,14 @@ def RunHardwareFailureTests(instance, pnode, snode): ...@@ -207,6 +207,14 @@ def RunHardwareFailureTests(instance, pnode, snode):
if qa_config.TestEnabled('instance-failover'): if qa_config.TestEnabled('instance-failover'):
RunTest(qa_instance.TestInstanceFailover, instance) RunTest(qa_instance.TestInstanceFailover, instance)
if qa_config.TestEnabled('instance-replace-disks'):
othernode = qa_config.AcquireNode(exclude=pnode)
try:
RunTest(qa_instance.TestReplaceDisks,
instance, pnode, snode, othernode)
finally:
qa_config.ReleaseNode(othernode)
if qa_config.TestEnabled('node-evacuate'): if qa_config.TestEnabled('node-evacuate'):
RunTest(qa_node.TestNodeEvacuate, pnode, snode) RunTest(qa_node.TestNodeEvacuate, pnode, snode)
......
...@@ -69,6 +69,9 @@ tests: ...@@ -69,6 +69,9 @@ tests:
# they support the `gnt-instance console' command. # they support the `gnt-instance console' command.
instance-console: False instance-console: False
# Disabled by default because it takes rather long
instance-replace-disks: False
# Make sure not to include the disk(s) required for Dom0 to be included in # Make sure not to include the disk(s) required for Dom0 to be included in
# the volume group used for instances. Otherwise the whole system may stop # the volume group used for instances. Otherwise the whole system may stop
# working until restarted. # working until restarted.
......
...@@ -194,6 +194,35 @@ def TestInstanceConsole(instance): ...@@ -194,6 +194,35 @@ def TestInstanceConsole(instance):
utils.ShellQuoteArgs(cmd)).wait(), 0) utils.ShellQuoteArgs(cmd)).wait(), 0)
@qa_utils.DefineHook('instance-replace-disks')
def TestReplaceDisks(instance, pnode, snode, othernode):
"""gnt-instance replace-disks"""
master = qa_config.GetMasterNode()
def buildcmd(args):
cmd = ['gnt-instance', 'replace-disks']
cmd.extend(args)
cmd.append(instance["name"])
return cmd
cmd = buildcmd(["-p"])
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
cmd = buildcmd(["-s"])
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
cmd = buildcmd(["--new-secondary=%s" % othernode["primary"]])
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
# Restore
cmd = buildcmd(["--new-secondary=%s" % snode["primary"]])
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
@qa_utils.DefineHook('backup-export') @qa_utils.DefineHook('backup-export')
def TestInstanceExport(instance, node): def TestInstanceExport(instance, node):
"""gnt-backup export""" """gnt-backup export"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment