Commit d0a44ec0 authored by Klaus Aehlig's avatar Klaus Aehlig Committed by Guido Trotter
Browse files

Add QA for gnt-instance modify --new-primary

Add a simple walk through the intended use case of
gnt-instance modify --new-primary for the disk template
file. The tested scenario is shutting down an instance,
manually moving the disk to the new node, setting the
new primary, and starting up the instance on the new
node. It is also verified that the operation is rejected
while the instance is still running on the old node.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarGuido Trotter <>
parent 6970c89c
...@@ -602,6 +602,11 @@ def RunInstanceTests(): ...@@ -602,6 +602,11 @@ def RunInstanceTests():
instance, inodes) instance, inodes)
RunTest(qa_instance.TestInstanceStartup, instance) RunTest(qa_instance.TestInstanceStartup, instance)
RunCommonInstanceTests(instance) RunCommonInstanceTests(instance)
if qa_config.TestEnabled("instance-modify-primary"):
othernode = qa_config.AcquireNode()
instance, inodes[0], othernode)
RunGroupListTests() RunGroupListTests()
RunExportImportTests(instance, inodes) RunExportImportTests(instance, inodes)
RunHardwareFailureTests(instance, inodes) RunHardwareFailureTests(instance, inodes)
...@@ -185,6 +185,7 @@ ...@@ -185,6 +185,7 @@
"instance-list": true, "instance-list": true,
"instance-migrate": true, "instance-migrate": true,
"instance-modify": true, "instance-modify": true,
"instance-modify-primary": true,
"instance-reboot": true, "instance-reboot": true,
"instance-reinstall": true, "instance-reinstall": true,
"instance-rename": true, "instance-rename": true,
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
""" """
import operator import operator
import os
import re import re
from ganeti import utils from ganeti import utils
...@@ -573,6 +574,38 @@ def TestInstanceModify(instance): ...@@ -573,6 +574,38 @@ def TestInstanceModify(instance):
AssertCommand(["gnt-instance", "modify", "--online",]) AssertCommand(["gnt-instance", "modify", "--online",])
def TestInstanceModifyPrimaryAndBack(instance, currentnode, othernode):
"""gnt-instance modify --new-primary
This will leave the instance on its original primary node, not other node.
if instance.disk_template != constants.DT_FILE:
print qa_utils.FormatInfo("Test only supported for the file disk template")
name =
current = currentnode.primary
other = othernode.primary
filestorage = qa_config.get("file-storage-dir")
disk = os.path.join(filestorage, name)
AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name],
AssertCommand(["gnt-instance", "shutdown", name])
AssertCommand(["scp", "-r", disk, "%s:%s" % (other, filestorage)])
AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name])
AssertCommand(["gnt-instance", "startup", name])
# and back
AssertCommand(["gnt-instance", "shutdown", name])
AssertCommand(["rm", "-rf", disk], node=other)
AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % current, name])
AssertCommand(["gnt-instance", "startup", name])
def TestInstanceStoppedModify(instance): def TestInstanceStoppedModify(instance):
"""gnt-instance modify (stopped instance)""" """gnt-instance modify (stopped instance)"""
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