Statistics
| Branch: | Tag: | Revision:

root / qa / qa_env.py @ 2e5eb96a

History | View | Annotate | Download (2.3 kB)

1 c68d1f43 Michael Hanselmann
#
2 c68d1f43 Michael Hanselmann
#
3 c68d1f43 Michael Hanselmann
4 f623cc78 Iustin Pop
# Copyright (C) 2007, 2010, 2011 Google Inc.
5 cec9845c Michael Hanselmann
#
6 cec9845c Michael Hanselmann
# This program is free software; you can redistribute it and/or modify
7 cec9845c Michael Hanselmann
# it under the terms of the GNU General Public License as published by
8 cec9845c Michael Hanselmann
# the Free Software Foundation; either version 2 of the License, or
9 cec9845c Michael Hanselmann
# (at your option) any later version.
10 cec9845c Michael Hanselmann
#
11 cec9845c Michael Hanselmann
# This program is distributed in the hope that it will be useful, but
12 cec9845c Michael Hanselmann
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 cec9845c Michael Hanselmann
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 cec9845c Michael Hanselmann
# General Public License for more details.
15 cec9845c Michael Hanselmann
#
16 cec9845c Michael Hanselmann
# You should have received a copy of the GNU General Public License
17 cec9845c Michael Hanselmann
# along with this program; if not, write to the Free Software
18 cec9845c Michael Hanselmann
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 cec9845c Michael Hanselmann
# 02110-1301, USA.
20 cec9845c Michael Hanselmann
21 cec9845c Michael Hanselmann
22 cec9845c Michael Hanselmann
"""Cluster environment related QA tests.
23 cec9845c Michael Hanselmann

24 cec9845c Michael Hanselmann
"""
25 cec9845c Michael Hanselmann
26 cec9845c Michael Hanselmann
from ganeti import utils
27 cec9845c Michael Hanselmann
28 cec9845c Michael Hanselmann
import qa_config
29 cec9845c Michael Hanselmann
30 2f4b4f78 Iustin Pop
from qa_utils import AssertCommand
31 cec9845c Michael Hanselmann
32 cec9845c Michael Hanselmann
33 cec9845c Michael Hanselmann
def TestSshConnection():
34 cec9845c Michael Hanselmann
  """Test SSH connection.
35 cec9845c Michael Hanselmann

36 cec9845c Michael Hanselmann
  """
37 2f4b4f78 Iustin Pop
  for node in qa_config.get("nodes"):
38 2f4b4f78 Iustin Pop
    AssertCommand("exit", node=node)
39 cec9845c Michael Hanselmann
40 cec9845c Michael Hanselmann
41 cec9845c Michael Hanselmann
def TestGanetiCommands():
42 cec9845c Michael Hanselmann
  """Test availibility of Ganeti commands.
43 cec9845c Michael Hanselmann

44 cec9845c Michael Hanselmann
  """
45 fc28c086 Michael Hanselmann
  cmds = ( ['gnt-backup', '--version'],
46 fc28c086 Michael Hanselmann
           ['gnt-cluster', '--version'],
47 fc28c086 Michael Hanselmann
           ['gnt-debug', '--version'],
48 cec9845c Michael Hanselmann
           ['gnt-instance', '--version'],
49 fc28c086 Michael Hanselmann
           ['gnt-job', '--version'],
50 fc28c086 Michael Hanselmann
           ['gnt-node', '--version'],
51 fc28c086 Michael Hanselmann
           ['gnt-os', '--version'],
52 fc28c086 Michael Hanselmann
           ['ganeti-masterd', '--version'],
53 cec9845c Michael Hanselmann
           ['ganeti-noded', '--version'],
54 fc28c086 Michael Hanselmann
           ['ganeti-rapi', '--version'],
55 3aa81090 Guido Trotter
           ['ganeti-watcher', '--version'],
56 3aa81090 Guido Trotter
           ['ganeti-confd', '--version'],
57 3aa81090 Guido Trotter
           )
58 cec9845c Michael Hanselmann
59 cec9845c Michael Hanselmann
  cmd = ' && '.join([utils.ShellQuoteArgs(i) for i in cmds])
60 cec9845c Michael Hanselmann
61 cec9845c Michael Hanselmann
  for node in qa_config.get('nodes'):
62 2f4b4f78 Iustin Pop
    AssertCommand(cmd, node=node)
63 cec9845c Michael Hanselmann
64 cec9845c Michael Hanselmann
65 cec9845c Michael Hanselmann
def TestIcmpPing():
66 cec9845c Michael Hanselmann
  """ICMP ping each node.
67 cec9845c Michael Hanselmann

68 cec9845c Michael Hanselmann
  """
69 cec9845c Michael Hanselmann
  nodes = qa_config.get('nodes')
70 cec9845c Michael Hanselmann
71 f623cc78 Iustin Pop
  pingprimary = pingsecondary = "fping"
72 9486f6ae Manuel Franceschini
  if qa_config.get("primary_ip_version") == 6:
73 f623cc78 Iustin Pop
    pingprimary = "fping6"
74 9486f6ae Manuel Franceschini
75 f623cc78 Iustin Pop
  pricmd = [pingprimary, "-e"]
76 f623cc78 Iustin Pop
  seccmd = [pingsecondary, "-e"]
77 2f4b4f78 Iustin Pop
  for i in nodes:
78 f623cc78 Iustin Pop
    pricmd.append(i["primary"])
79 2f4b4f78 Iustin Pop
    if i.has_key("secondary"):
80 f623cc78 Iustin Pop
      seccmd.append(i["secondary"])
81 f623cc78 Iustin Pop
82 f623cc78 Iustin Pop
  pristr = utils.ShellQuoteArgs(pricmd)
83 f623cc78 Iustin Pop
  if seccmd:
84 f623cc78 Iustin Pop
    cmdall = "%s && %s" % (pristr, utils.ShellQuoteArgs(seccmd))
85 f623cc78 Iustin Pop
  else:
86 f623cc78 Iustin Pop
    cmdall = pristr
87 cec9845c Michael Hanselmann
88 2f4b4f78 Iustin Pop
  for node in nodes:
89 2f4b4f78 Iustin Pop
    AssertCommand(cmdall, node=node)