The disk templates used by the instances are tracked in the QA
configuration.  This will be used to selectively enable tests according to
the configuration.

Signed-off-by: Bernardo Dal Seno <[email protected]>
---
 qa/qa_config.py   | 19 ++++++++++++++++++-
 qa/qa_instance.py |  2 ++
 qa/qa_rapi.py     |  6 +++++-
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/qa/qa_config.py b/qa/qa_config.py
index 635aec8..df716bc 100644
--- a/qa/qa_config.py
+++ b/qa/qa_config.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2007, 2011, 2012 Google Inc.
+# Copyright (C) 2007, 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -218,6 +218,7 @@ def AcquireInstance():
 
   inst = instances[0]
   inst["_used"] = True
+  inst["_template"] = None
   return inst
 
 
@@ -225,6 +226,22 @@ def ReleaseInstance(inst):
   inst["_used"] = False
 
 
+def GetInstanceTemplate(inst):
+  """Return the disk template of an instance.
+
+  """
+  templ = inst["_template"]
+  assert templ is not None
+  return templ
+
+
+def SetInstanceTemplate(inst, template):
+  """Set the disk template for an instance.
+
+  """
+  inst["_template"] = template
+
+
 def AcquireNode(exclude=None):
   """Returns the least used node.
 
diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index bee0cab..195457b 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -75,6 +75,7 @@ def _DiskTest(node, disk_template):
     AssertCommand(cmd)
 
     _CheckSsconfInstanceList(instance["name"])
+    qa_config.SetInstanceTemplate(instance, disk_template)
 
     return instance
   except:
@@ -640,6 +641,7 @@ def TestInstanceImport(newinst, node, expnode, name):
          _GetGenericAddParameters(newinst, force_mac=constants.VALUE_GENERATE))
   cmd.append(newinst["name"])
   AssertCommand(cmd)
+  qa_config.SetInstanceTemplate(newinst, "plain")
 
 
 def TestBackupList(expnode):
diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py
index cd9c004..5189304 100644
--- a/qa/qa_rapi.py
+++ b/qa/qa_rapi.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -551,6 +551,7 @@ def TestRapiNodeGroups():
 def TestRapiInstanceAdd(node, use_client):
   """Test adding a new instance via RAPI"""
   instance = qa_config.AcquireInstance()
+  qa_config.SetInstanceTemplate(instance, constants.DT_PLAIN)
   try:
     disk_sizes = [utils.ParseUnit(size) for size in qa_config.get("disk")]
     disks = [{"size": size} for size in disk_sizes]
@@ -751,6 +752,9 @@ def TestInterClusterInstanceMove(src_instance, 
dest_instance,
   rapi_pw_file.write(_rapi_password)
   rapi_pw_file.flush()
 
+  qa_config.SetInstanceTemplate(dest_instance,
+                                qa_config.GetInstanceTemplate(src_instance))
+
   # TODO: Run some instance tests before moving back
 
   if snode is None:
-- 
1.8.1

-- 
You received this message because you are subscribed to the Google Groups 
"ganeti-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to