QA: Test instance migration via CLI and RAPI
authorMichael Hanselmann <hansmi@google.com>
Fri, 16 Jul 2010 17:44:06 +0000 (19:44 +0200)
committerMichael Hanselmann <hansmi@google.com>
Thu, 29 Jul 2010 13:05:57 +0000 (15:05 +0200)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

qa/ganeti-qa.py
qa/qa-sample.json
qa/qa_instance.py
qa/qa_rapi.py

index a981612..12c39c0 100755 (executable)
@@ -254,6 +254,12 @@ def RunHardwareFailureTests(instance, pnode, snode):
   if qa_config.TestEnabled('instance-failover'):
     RunTest(qa_instance.TestInstanceFailover, instance)
 
+  if qa_config.TestEnabled("instance-migrate"):
+    RunTest(qa_instance.TestInstanceMigrate, instance)
+
+    if qa_rapi.Enabled():
+      RunTest(qa_rapi.TestRapiInstanceMigrate, instance)
+
   if qa_config.TestEnabled('instance-replace-disks'):
     othernode = qa_config.AcquireNode(exclude=[pnode, snode])
     try:
index 68669c0..fe42edf 100644 (file)
@@ -72,6 +72,7 @@
     "instance-import": true,
     "instance-info": true,
     "instance-list": true,
+    "instance-migrate": true,
     "instance-modify": true,
     "instance-reboot": true,
     "instance-reinstall": true,
index 28b246c..411b72c 100644 (file)
@@ -160,6 +160,20 @@ def TestInstanceFailover(instance):
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
 
+def TestInstanceMigrate(instance):
+  """gnt-instance migrate"""
+  master = qa_config.GetMasterNode()
+
+  cmd = ["gnt-instance", "migrate", "--force", instance["name"]]
+  AssertEqual(StartSSH(master["primary"],
+                       utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+  # ... and back
+  cmd = ["gnt-instance", "migrate", "--force", instance["name"]]
+  AssertEqual(StartSSH(master["primary"],
+                       utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+
 def TestInstanceInfo(instance):
   """gnt-instance info"""
   master = qa_config.GetMasterNode()
index a8a54f7..7583c52 100644 (file)
@@ -341,6 +341,14 @@ def TestRapiInstanceRemove(instance, use_client):
   qa_config.ReleaseInstance(instance)
 
 
+def TestRapiInstanceMigrate(instance):
+  """Test migrating instance via RAPI"""
+  # Move to secondary node
+  _WaitForRapiJob(_rapi_client.MigrateInstance(instance["name"]))
+  # And back to previous primary
+  _WaitForRapiJob(_rapi_client.MigrateInstance(instance["name"]))
+
+
 def TestInterClusterInstanceMove(src_instance, dest_instance, pnode, snode):
   """Test tools/move-instance"""
   master = qa_config.GetMasterNode()