Statistics
| Branch: | Tag: | Revision:

root / qa / qa_env.py @ 9486f6ae

History | View | Annotate | Download (2.4 kB)

1
#
2
#
3

    
4
# Copyright (C) 2007, 2010 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
import qa_utils
30

    
31
from qa_utils import AssertEqual, StartSSH
32

    
33

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

37
  """
38
  for node in qa_config.get('nodes'):
39
    AssertEqual(StartSSH(node['primary'], 'exit').wait(), 0)
40

    
41

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

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

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

    
62
  for node in qa_config.get('nodes'):
63
    AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
64

    
65

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

69
  """
70
  nodes = qa_config.get('nodes')
71

    
72
  pingargs = ['-w', '3', '-c', '1 ']
73
  pingprimary = "ping"
74
  if qa_config.get("primary_ip_version") == 6:
75
    pingprimary = "ping6"
76

    
77
  for node in nodes:
78
    check = []
79
    for i in nodes:
80
      cmd = [pingprimary] + pingargs + [i['primary']]
81
      check.append(utils.ShellQuoteArgs(cmd))
82
      if i.has_key('secondary'):
83
        cmd = ["ping"] + pingargs + [i["secondary"]]
84
        check.append(utils.ShellQuoteArgs(cmd))
85

    
86
    cmdall = ' && '.join(check)
87
    AssertEqual(StartSSH(node['primary'], cmdall).wait(), 0)