From 452913ed98c31566cc3bbe2bbc6595e1dc9bbbef Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 23 Jul 2010 20:11:00 -0400
Subject: [PATCH] QA: add tests for the reserved lvs feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 qa/ganeti-qa.py   |  3 +++
 qa/qa-sample.json |  1 +
 qa/qa_cluster.py  | 21 +++++++++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 777423ddb..a9816129d 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -102,6 +102,9 @@ def RunClusterTests():
   if qa_config.TestEnabled('cluster-verify'):
     RunTest(qa_cluster.TestClusterVerify)
 
+  if qa_config.TestEnabled('cluster-reserved-lvs'):
+    RunTest(qa_cluster.TestClusterReservedLvs)
+
   if qa_config.TestEnabled('cluster-rename'):
     RunTest(qa_cluster.TestClusterRename)
 
diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index 2c56e7fca..68669c05f 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -48,6 +48,7 @@
     "cluster-renew-crypto": true,
     "cluster-destroy": true,
     "cluster-rename": true,
+    "cluster-reserved-lvs": true,
 
     "node-info": true,
     "node-volumes": true,
diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index 164fcf110..13e8f7203 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -136,6 +136,27 @@ def TestClusterVerify():
   AssertEqual(StartSSH(master['primary'],
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
+def TestClusterReservedLvs():
+  """gnt-cluster reserved lvs"""
+  master = qa_config.GetMasterNode()
+  CVERIFY = ['gnt-cluster', 'verify']
+  for rcode, cmd in [
+    (0, CVERIFY),
+    (0, ['gnt-cluster', 'modify', '--reserved-lvs', '']),
+    (0, ['lvcreate', '-L1G', '-nqa-test', 'xenvg']),
+    (1, CVERIFY),
+    (0, ['gnt-cluster', 'modify', '--reserved-lvs', 'qa-test,other-test']),
+    (0, CVERIFY),
+    (0, ['gnt-cluster', 'modify', '--reserved-lvs', 'qa-.*']),
+    (0, CVERIFY),
+    (0, ['gnt-cluster', 'modify', '--reserved-lvs', '']),
+    (1, CVERIFY),
+    (0, ['lvremove', '-f', 'xenvg/qa-test']),
+    (0, CVERIFY),
+    ]:
+    AssertEqual(StartSSH(master['primary'],
+                         utils.ShellQuoteArgs(cmd)).wait(), rcode)
+
 
 def TestClusterInfo():
   """gnt-cluster info"""
-- 
GitLab