Statistics
| Branch: | Tag: | Revision:

root / qa / qa_env.py @ 2ef21e6e

History | View | Annotate | Download (2.2 kB)

1
#
2
#
3

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

    
21

    
22
"""Cluster environment related QA tests.
23

24
"""
25

    
26
from ganeti import utils
27

    
28
import qa_config
29

    
30
from qa_utils import AssertCommand
31

    
32

    
33
def TestSshConnection():
34
  """Test SSH connection.
35

36
  """
37
  for node in qa_config.get("nodes"):
38
    AssertCommand("exit", node=node)
39

    
40

    
41
def TestGanetiCommands():
42
  """Test availibility of Ganeti commands.
43

44
  """
45
  cmds = (["gnt-backup", "--version"],
46
          ["gnt-cluster", "--version"],
47
          ["gnt-debug", "--version"],
48
          ["gnt-instance", "--version"],
49
          ["gnt-job", "--version"],
50
          ["gnt-node", "--version"],
51
          ["gnt-os", "--version"],
52
          ["ganeti-masterd", "--version"],
53
          ["ganeti-noded", "--version"],
54
          ["ganeti-rapi", "--version"],
55
          ["ganeti-watcher", "--version"],
56
          ["ganeti-confd", "--version"],
57
          )
58

    
59
  cmd = " && ".join([utils.ShellQuoteArgs(i) for i in cmds])
60

    
61
  for node in qa_config.get("nodes"):
62
    AssertCommand(cmd, node=node)
63

    
64

    
65
def TestIcmpPing():
66
  """ICMP ping each node.
67

68
  """
69
  nodes = qa_config.get("nodes")
70

    
71
  pingprimary = pingsecondary = "fping"
72
  if qa_config.get("primary_ip_version") == 6:
73
    pingprimary = "fping6"
74

    
75
  pricmd = [pingprimary, "-e"]
76
  seccmd = [pingsecondary, "-e"]
77
  for i in nodes:
78
    pricmd.append(i.primary)
79
    if i.secondary:
80
      seccmd.append(i.secondary)
81

    
82
  pristr = utils.ShellQuoteArgs(pricmd)
83
  if seccmd:
84
    cmdall = "%s && %s" % (pristr, utils.ShellQuoteArgs(seccmd))
85
  else:
86
    cmdall = pristr
87

    
88
  for node in nodes:
89
    AssertCommand(cmdall, node=node)