root / qa / qa_env.py @ 31d3b918
History | View | Annotate | Download (2.3 kB)
1 | c68d1f43 | Michael Hanselmann | #
|
---|---|---|---|
2 | c68d1f43 | Michael Hanselmann | #
|
3 | c68d1f43 | Michael Hanselmann | |
4 | 5ae4945a | Iustin Pop | # Copyright (C) 2007, 2010, 2011, 2012 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 | 21bf2e2e | Andrea Spadaccini | cmds = (["gnt-backup", "--version"], |
46 | 5ae4945a | Iustin Pop | ["gnt-cluster", "--version"], |
47 | 5ae4945a | Iustin Pop | ["gnt-debug", "--version"], |
48 | 5ae4945a | Iustin Pop | ["gnt-instance", "--version"], |
49 | 5ae4945a | Iustin Pop | ["gnt-job", "--version"], |
50 | 5ae4945a | Iustin Pop | ["gnt-node", "--version"], |
51 | 5ae4945a | Iustin Pop | ["gnt-os", "--version"], |
52 | 5ae4945a | Iustin Pop | ["ganeti-masterd", "--version"], |
53 | 5ae4945a | Iustin Pop | ["ganeti-noded", "--version"], |
54 | 5ae4945a | Iustin Pop | ["ganeti-rapi", "--version"], |
55 | 5ae4945a | Iustin Pop | ["ganeti-watcher", "--version"], |
56 | 5ae4945a | Iustin Pop | ["ganeti-confd", "--version"], |
57 | 3695a4e0 | Thomas Thrainer | ["ganeti-luxid", "--version"], |
58 | 5ae4945a | Iustin Pop | ) |
59 | cec9845c | Michael Hanselmann | |
60 | d0c8c01d | Iustin Pop | cmd = " && ".join([utils.ShellQuoteArgs(i) for i in cmds]) |
61 | cec9845c | Michael Hanselmann | |
62 | d0c8c01d | Iustin Pop | for node in qa_config.get("nodes"): |
63 | 2f4b4f78 | Iustin Pop | AssertCommand(cmd, node=node) |
64 | cec9845c | Michael Hanselmann | |
65 | cec9845c | Michael Hanselmann | |
66 | cec9845c | Michael Hanselmann | def TestIcmpPing(): |
67 | cec9845c | Michael Hanselmann | """ICMP ping each node.
|
68 | cec9845c | Michael Hanselmann |
|
69 | cec9845c | Michael Hanselmann | """
|
70 | d0c8c01d | Iustin Pop | nodes = qa_config.get("nodes")
|
71 | cec9845c | Michael Hanselmann | |
72 | f623cc78 | Iustin Pop | pingprimary = pingsecondary = "fping"
|
73 | 9486f6ae | Manuel Franceschini | if qa_config.get("primary_ip_version") == 6: |
74 | f623cc78 | Iustin Pop | pingprimary = "fping6"
|
75 | 9486f6ae | Manuel Franceschini | |
76 | f623cc78 | Iustin Pop | pricmd = [pingprimary, "-e"]
|
77 | f623cc78 | Iustin Pop | seccmd = [pingsecondary, "-e"]
|
78 | 2f4b4f78 | Iustin Pop | for i in nodes: |
79 | aecba21e | Michael Hanselmann | pricmd.append(i.primary) |
80 | aecba21e | Michael Hanselmann | if i.secondary:
|
81 | aecba21e | Michael Hanselmann | seccmd.append(i.secondary) |
82 | f623cc78 | Iustin Pop | |
83 | f623cc78 | Iustin Pop | pristr = utils.ShellQuoteArgs(pricmd) |
84 | f623cc78 | Iustin Pop | if seccmd:
|
85 | f623cc78 | Iustin Pop | cmdall = "%s && %s" % (pristr, utils.ShellQuoteArgs(seccmd))
|
86 | f623cc78 | Iustin Pop | else:
|
87 | f623cc78 | Iustin Pop | cmdall = pristr |
88 | cec9845c | Michael Hanselmann | |
89 | 2f4b4f78 | Iustin Pop | for node in nodes: |
90 | 2f4b4f78 | Iustin Pop | AssertCommand(cmdall, node=node) |