cmdlib: remove usage of ENABLE_FILE_STORAGE
[ganeti-local] / qa / qa_env.py
index 3b1a761..bb8ab33 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2007 Google Inc.
+# Copyright (C) 2007, 2010, 2011, 2012 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
 from ganeti import utils
 
 import qa_config
-import qa_utils
 
-from qa_utils import AssertEqual, StartSSH
+from qa_utils import AssertCommand
 
 
 def TestSshConnection():
   """Test SSH connection.
 
   """
-  for node in qa_config.get('nodes'):
-    AssertEqual(StartSSH(node['primary'], 'exit').wait(), 0)
+  for node in qa_config.get("nodes"):
+    AssertCommand("exit", node=node)
 
 
 def TestGanetiCommands():
   """Test availibility of Ganeti commands.
 
   """
-  cmds = ( ['gnt-backup', '--version'],
-           ['gnt-cluster', '--version'],
-           ['gnt-debug', '--version'],
-           ['gnt-instance', '--version'],
-           ['gnt-job', '--version'],
-           ['gnt-node', '--version'],
-           ['gnt-os', '--version'],
-           ['ganeti-masterd', '--version'],
-           ['ganeti-noded', '--version'],
-           ['ganeti-rapi', '--version'],
-           ['ganeti-watcher', '--version'] )
-
-  cmd = ' && '.join([utils.ShellQuoteArgs(i) for i in cmds])
-
-  for node in qa_config.get('nodes'):
-    AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
+  cmds = (["gnt-backup", "--version"],
+          ["gnt-cluster", "--version"],
+          ["gnt-debug", "--version"],
+          ["gnt-instance", "--version"],
+          ["gnt-job", "--version"],
+          ["gnt-node", "--version"],
+          ["gnt-os", "--version"],
+          ["ganeti-masterd", "--version"],
+          ["ganeti-noded", "--version"],
+          ["ganeti-rapi", "--version"],
+          ["ganeti-watcher", "--version"],
+          ["ganeti-confd", "--version"],
+          )
+
+  cmd = " && ".join([utils.ShellQuoteArgs(i) for i in cmds])
+
+  for node in qa_config.get("nodes"):
+    AssertCommand(cmd, node=node)
 
 
 def TestIcmpPing():
   """ICMP ping each node.
 
   """
-  nodes = qa_config.get('nodes')
+  nodes = qa_config.get("nodes")
 
-  for node in nodes:
-    check = []
-    for i in nodes:
-      check.append(i['primary'])
-      if i.has_key('secondary'):
-        check.append(i['secondary'])
+  pingprimary = pingsecondary = "fping"
+  if qa_config.get("primary_ip_version") == 6:
+    pingprimary = "fping6"
 
-    ping = lambda ip: utils.ShellQuoteArgs(['ping', '-w', '3', '-c', '1', ip])
-    cmd = ' && '.join([ping(i) for i in check])
+  pricmd = [pingprimary, "-e"]
+  seccmd = [pingsecondary, "-e"]
+  for i in nodes:
+    pricmd.append(i.primary)
+    if i.secondary:
+      seccmd.append(i.secondary)
 
-    AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
+  pristr = utils.ShellQuoteArgs(pricmd)
+  if seccmd:
+    cmdall = "%s && %s" % (pristr, utils.ShellQuoteArgs(seccmd))
+  else:
+    cmdall = pristr
+
+  for node in nodes:
+    AssertCommand(cmdall, node=node)