From 2310354434ca0a5a3fb59b3885d033afcae2b9d2 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Wed, 21 Nov 2007 16:56:49 +0000
Subject: [PATCH] Implement disk templates for burnin from QA.

Reviewed-by: iustinp
---
 qa/qa-sample.yaml |  1 +
 qa/qa_cluster.py  | 24 ++++++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/qa/qa-sample.yaml b/qa/qa-sample.yaml
index 75e9e703f..e196d1e97 100644
--- a/qa/qa-sample.yaml
+++ b/qa/qa-sample.yaml
@@ -72,6 +72,7 @@ tests:
 # Other settings
 options:
   burnin-instances: 2
+  burnin-disk-template: remote_raid1
 
   # Directory containing QA hooks
   #hooks-dir: hooks/
diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index 25ebc75b9..245ac681b 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -117,26 +117,30 @@ def TestClusterBurnin():
   """Burnin"""
   master = qa_config.GetMasterNode()
 
+  disk_template = (qa_config.get('options', {}).
+                   get('burnin-disk-template', 'remote_raid1'))
+
   # Get as many instances as we need
   instances = []
   try:
-    num = qa_config.get('options', {}).get('burnin-instances', 1)
-    for _ in xrange(0, num):
-      instances.append(qa_config.AcquireInstance())
-  except qa_error.OutOfInstancesError:
-    print "Not enough instances, continuing anyway."
+    try:
+      num = qa_config.get('options', {}).get('burnin-instances', 1)
+      for _ in xrange(0, num):
+        instances.append(qa_config.AcquireInstance())
+    except qa_error.OutOfInstancesError:
+      print "Not enough instances, continuing anyway."
 
-  if len(instances) < 1:
-    raise qa_error.Error("Burnin needs at least one instance")
+    if len(instances) < 1:
+      raise qa_error.Error("Burnin needs at least one instance")
 
-  # Run burnin
-  try:
     script = qa_utils.UploadFile(master['primary'], '../tools/burnin')
     try:
+      # Run burnin
       cmd = [script,
              '--os=%s' % qa_config.get('os'),
              '--os-size=%s' % qa_config.get('os-size'),
-             '--swap-size=%s' % qa_config.get('swap-size')]
+             '--swap-size=%s' % qa_config.get('swap-size'),
+             '--disk-template=%s' % disk_template]
       cmd += [inst['name'] for inst in instances]
       AssertEqual(StartSSH(master['primary'],
                            utils.ShellQuoteArgs(cmd)).wait(), 0)
-- 
GitLab