Modify gnt-node add to call external script
[ganeti-local] / qa / qa_cluster.py
index 7c0de19..e854501 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2007 Google Inc.
+# Copyright (C) 2007, 2010 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
@@ -80,6 +80,9 @@ def TestClusterInit(rapi_user, rapi_secret):
   # Initialize cluster
   cmd = ['gnt-cluster', 'init']
 
+  cmd.append("--primary-ip-version=%d" %
+             qa_config.get("primary_ip_version", 4))
+
   if master.get('secondary', None):
     cmd.append('--secondary-ip=%s' % master['secondary'])
 
@@ -136,6 +139,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"""
@@ -251,6 +275,8 @@ def TestClusterBurnin():
   parallel = options.get('burnin-in-parallel', False)
   check_inst = options.get('burnin-check-instances', False)
   do_rename = options.get('burnin-rename', '')
+  do_reboot = options.get('burnin-reboot', True)
+  reboot_types = options.get("reboot-types", constants.REBOOT_TYPES)
 
   # Get as many instances as we need
   instances = []
@@ -280,6 +306,10 @@ def TestClusterBurnin():
         cmd.append('--http-check')
       if do_rename:
         cmd.append('--rename=%s' % do_rename)
+      if not do_reboot:
+        cmd.append('--no-reboot')
+      else:
+        cmd.append('--reboot-types=%s' % ",".join(reboot_types))
       cmd += [inst['name'] for inst in instances]
       AssertEqual(StartSSH(master['primary'],
                            utils.ShellQuoteArgs(cmd)).wait(), 0)
@@ -293,16 +323,16 @@ def TestClusterBurnin():
 
 
 def TestClusterMasterFailover():
-  """gnt-cluster masterfailover"""
+  """gnt-cluster master-failover"""
   master = qa_config.GetMasterNode()
 
   failovermaster = qa_config.AcquireNode(exclude=master)
   try:
-    cmd = ['gnt-cluster', 'masterfailover']
+    cmd = ['gnt-cluster', 'master-failover']
     AssertEqual(StartSSH(failovermaster['primary'],
                          utils.ShellQuoteArgs(cmd)).wait(), 0)
 
-    cmd = ['gnt-cluster', 'masterfailover']
+    cmd = ['gnt-cluster', 'master-failover']
     AssertEqual(StartSSH(master['primary'],
                          utils.ShellQuoteArgs(cmd)).wait(), 0)
   finally: