Statistics
| Branch: | Tag: | Revision:

root / qa / ganeti-qa.py @ e8b919a1

History | View | Annotate | Download (20.2 kB)

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

24 94508060 Michael Hanselmann
"""
25 a8083063 Iustin Pop
26 b459a848 Andrea Spadaccini
# pylint: disable=C0103
27 3582eef6 Iustin Pop
# due to invalid name
28 3582eef6 Iustin Pop
29 a8083063 Iustin Pop
import sys
30 c68d1f43 Michael Hanselmann
import datetime
31 c68d1f43 Michael Hanselmann
import optparse
32 a8083063 Iustin Pop
33 cec9845c Michael Hanselmann
import qa_cluster
34 cec9845c Michael Hanselmann
import qa_config
35 cec9845c Michael Hanselmann
import qa_daemon
36 cec9845c Michael Hanselmann
import qa_env
37 83180411 Bernardo Dal Seno
import qa_error
38 30131294 Adeodato Simo
import qa_group
39 cec9845c Michael Hanselmann
import qa_instance
40 cec9845c Michael Hanselmann
import qa_node
41 8947cf2b Michael Hanselmann
import qa_os
42 09470dd8 Michael Hanselmann
import qa_job
43 a47f574c Oleksiy Mishchenko
import qa_rapi
44 d74c2ca1 Michael Hanselmann
import qa_tags
45 1672a0d1 Michael Hanselmann
import qa_utils
46 a8083063 Iustin Pop
47 725ec2f1 René Nussbaumer
from ganeti import utils
48 8ad0da1e Iustin Pop
from ganeti import rapi # pylint: disable=W0611
49 f3fd2c9d Adeodato Simo
from ganeti import constants
50 2a7c3583 Michael Hanselmann
51 b459a848 Andrea Spadaccini
import ganeti.rapi.client # pylint: disable=W0611
52 fc3f75dd Iustin Pop
from ganeti.rapi.client import UsesRapiClient
53 725ec2f1 René Nussbaumer
54 a8083063 Iustin Pop
55 7d88f255 Iustin Pop
def _FormatHeader(line, end=72):
56 f89d59b9 Iustin Pop
  """Fill a line up to the end column.
57 f89d59b9 Iustin Pop

58 f89d59b9 Iustin Pop
  """
59 f89d59b9 Iustin Pop
  line = "---- " + line + " "
60 21bf2e2e Andrea Spadaccini
  line += "-" * (end - len(line))
61 f89d59b9 Iustin Pop
  line = line.rstrip()
62 f89d59b9 Iustin Pop
  return line
63 f89d59b9 Iustin Pop
64 f89d59b9 Iustin Pop
65 7d88f255 Iustin Pop
def _DescriptionOf(fn):
66 7d88f255 Iustin Pop
  """Computes the description of an item.
67 a8083063 Iustin Pop

68 a8083063 Iustin Pop
  """
69 cec9845c Michael Hanselmann
  if fn.__doc__:
70 cec9845c Michael Hanselmann
    desc = fn.__doc__.splitlines()[0].strip()
71 a8083063 Iustin Pop
  else:
72 f89d59b9 Iustin Pop
    desc = "%r" % fn
73 a8083063 Iustin Pop
74 7d88f255 Iustin Pop
  return desc.rstrip(".")
75 7d88f255 Iustin Pop
76 2932dc44 Michael Hanselmann
77 741c6d91 Michael Hanselmann
def RunTest(fn, *args, **kwargs):
78 7d88f255 Iustin Pop
  """Runs a test after printing a header.
79 7d88f255 Iustin Pop

80 7d88f255 Iustin Pop
  """
81 a8083063 Iustin Pop
82 f89d59b9 Iustin Pop
  tstart = datetime.datetime.now()
83 a8083063 Iustin Pop
84 7d88f255 Iustin Pop
  desc = _DescriptionOf(fn)
85 7d88f255 Iustin Pop
86 f89d59b9 Iustin Pop
  print
87 f89d59b9 Iustin Pop
  print _FormatHeader("%s start %s" % (tstart, desc))
88 f89d59b9 Iustin Pop
89 f89d59b9 Iustin Pop
  try:
90 741c6d91 Michael Hanselmann
    retval = fn(*args, **kwargs)
91 f89d59b9 Iustin Pop
    return retval
92 f89d59b9 Iustin Pop
  finally:
93 f89d59b9 Iustin Pop
    tstop = datetime.datetime.now()
94 f89d59b9 Iustin Pop
    tdelta = tstop - tstart
95 f89d59b9 Iustin Pop
    print _FormatHeader("%s time=%s %s" % (tstop, tdelta, desc))
96 a8083063 Iustin Pop
97 a8083063 Iustin Pop
98 741c6d91 Michael Hanselmann
def RunTestIf(testnames, fn, *args, **kwargs):
99 7d88f255 Iustin Pop
  """Runs a test conditionally.
100 7d88f255 Iustin Pop

101 7d88f255 Iustin Pop
  @param testnames: either a single test name in the configuration
102 7d88f255 Iustin Pop
      file, or a list of testnames (which will be AND-ed together)
103 7d88f255 Iustin Pop

104 7d88f255 Iustin Pop
  """
105 7d88f255 Iustin Pop
  if qa_config.TestEnabled(testnames):
106 741c6d91 Michael Hanselmann
    RunTest(fn, *args, **kwargs)
107 7d88f255 Iustin Pop
  else:
108 7d88f255 Iustin Pop
    tstart = datetime.datetime.now()
109 7d88f255 Iustin Pop
    desc = _DescriptionOf(fn)
110 7d88f255 Iustin Pop
    print _FormatHeader("%s skipping %s, test(s) %s disabled" %
111 7d88f255 Iustin Pop
                        (tstart, desc, testnames))
112 7d88f255 Iustin Pop
113 7d88f255 Iustin Pop
114 b1ffe1eb Michael Hanselmann
def RunEnvTests():
115 b1ffe1eb Michael Hanselmann
  """Run several environment tests.
116 a8083063 Iustin Pop

117 a8083063 Iustin Pop
  """
118 7d88f255 Iustin Pop
  RunTestIf("env", qa_env.TestSshConnection)
119 7d88f255 Iustin Pop
  RunTestIf("env", qa_env.TestIcmpPing)
120 7d88f255 Iustin Pop
  RunTestIf("env", qa_env.TestGanetiCommands)
121 a8083063 Iustin Pop
122 94508060 Michael Hanselmann
123 725ec2f1 René Nussbaumer
def SetupCluster(rapi_user, rapi_secret):
124 b1ffe1eb Michael Hanselmann
  """Initializes the cluster.
125 a8083063 Iustin Pop

126 725ec2f1 René Nussbaumer
  @param rapi_user: Login user for RAPI
127 725ec2f1 René Nussbaumer
  @param rapi_secret: Login secret for RAPI
128 725ec2f1 René Nussbaumer

129 b1ffe1eb Michael Hanselmann
  """
130 7d88f255 Iustin Pop
  RunTestIf("create-cluster", qa_cluster.TestClusterInit,
131 7d88f255 Iustin Pop
            rapi_user, rapi_secret)
132 288d6440 Michael Hanselmann
133 288d6440 Michael Hanselmann
  # Test on empty cluster
134 288d6440 Michael Hanselmann
  RunTestIf("node-list", qa_node.TestNodeList)
135 288d6440 Michael Hanselmann
  RunTestIf("instance-list", qa_instance.TestInstanceList)
136 09470dd8 Michael Hanselmann
  RunTestIf("job-list", qa_job.TestJobList)
137 288d6440 Michael Hanselmann
138 7d88f255 Iustin Pop
  RunTestIf("create-cluster", qa_node.TestNodeAddAll)
139 7d88f255 Iustin Pop
  if not qa_config.TestEnabled("create-cluster"):
140 8e671b7c Iustin Pop
    # consider the nodes are already there
141 8e671b7c Iustin Pop
    qa_node.MarkNodeAddedAll()
142 8201b996 Iustin Pop
143 7d88f255 Iustin Pop
  RunTestIf("test-jobqueue", qa_cluster.TestJobqueue)
144 cd04f8c2 Michael Hanselmann
145 8201b996 Iustin Pop
  # enable the watcher (unconditionally)
146 8201b996 Iustin Pop
  RunTest(qa_daemon.TestResumeWatcher)
147 8201b996 Iustin Pop
148 288d6440 Michael Hanselmann
  RunTestIf("node-list", qa_node.TestNodeList)
149 288d6440 Michael Hanselmann
150 2214cf14 Michael Hanselmann
  # Test listing fields
151 2214cf14 Michael Hanselmann
  RunTestIf("node-list", qa_node.TestNodeListFields)
152 2214cf14 Michael Hanselmann
  RunTestIf("instance-list", qa_instance.TestInstanceListFields)
153 09470dd8 Michael Hanselmann
  RunTestIf("job-list", qa_job.TestJobListFields)
154 0fdf247d Michael Hanselmann
  RunTestIf("instance-export", qa_instance.TestBackupListFields)
155 2214cf14 Michael Hanselmann
156 7d88f255 Iustin Pop
  RunTestIf("node-info", qa_node.TestNodeInfo)
157 b1ffe1eb Michael Hanselmann
158 b1ffe1eb Michael Hanselmann
159 b1ffe1eb Michael Hanselmann
def RunClusterTests():
160 b1ffe1eb Michael Hanselmann
  """Runs tests related to gnt-cluster.
161 180bdd1f Michael Hanselmann

162 b1ffe1eb Michael Hanselmann
  """
163 7d88f255 Iustin Pop
  for test, fn in [
164 92cb4940 Andrea Spadaccini
    ("create-cluster", qa_cluster.TestClusterInitDisk),
165 7d88f255 Iustin Pop
    ("cluster-renew-crypto", qa_cluster.TestClusterRenewCrypto),
166 7d88f255 Iustin Pop
    ("cluster-verify", qa_cluster.TestClusterVerify),
167 7d88f255 Iustin Pop
    ("cluster-reserved-lvs", qa_cluster.TestClusterReservedLvs),
168 9738ca94 Iustin Pop
    # TODO: add more cluster modify tests
169 1e7acc3b Iustin Pop
    ("cluster-modify", qa_cluster.TestClusterModifyEmpty),
170 7d88f255 Iustin Pop
    ("cluster-modify", qa_cluster.TestClusterModifyBe),
171 92cb4940 Andrea Spadaccini
    ("cluster-modify", qa_cluster.TestClusterModifyDisk),
172 7d88f255 Iustin Pop
    ("cluster-rename", qa_cluster.TestClusterRename),
173 7d88f255 Iustin Pop
    ("cluster-info", qa_cluster.TestClusterVersion),
174 7d88f255 Iustin Pop
    ("cluster-info", qa_cluster.TestClusterInfo),
175 7d88f255 Iustin Pop
    ("cluster-info", qa_cluster.TestClusterGetmaster),
176 3e8b5a9c Iustin Pop
    ("cluster-redist-conf", qa_cluster.TestClusterRedistConf),
177 7d88f255 Iustin Pop
    ("cluster-copyfile", qa_cluster.TestClusterCopyfile),
178 7d88f255 Iustin Pop
    ("cluster-command", qa_cluster.TestClusterCommand),
179 7d88f255 Iustin Pop
    ("cluster-burnin", qa_cluster.TestClusterBurnin),
180 7d88f255 Iustin Pop
    ("cluster-master-failover", qa_cluster.TestClusterMasterFailover),
181 ff699aa9 Michael Hanselmann
    ("cluster-master-failover",
182 ff699aa9 Michael Hanselmann
     qa_cluster.TestClusterMasterFailoverWithDrainedQueue),
183 69df9d2b Iustin Pop
    ("cluster-oob", qa_cluster.TestClusterOob),
184 7d88f255 Iustin Pop
    ("rapi", qa_rapi.TestVersion),
185 7d88f255 Iustin Pop
    ("rapi", qa_rapi.TestEmptyCluster),
186 4fab7cab Michael Hanselmann
    ("rapi", qa_rapi.TestRapiQuery),
187 7d88f255 Iustin Pop
    ]:
188 7d88f255 Iustin Pop
    RunTestIf(test, fn)
189 8947cf2b Michael Hanselmann
190 6d4a1656 Michael Hanselmann
191 65a884ef Iustin Pop
def RunRepairDiskSizes():
192 65a884ef Iustin Pop
  """Run the repair disk-sizes test.
193 65a884ef Iustin Pop

194 65a884ef Iustin Pop
  """
195 65a884ef Iustin Pop
  RunTestIf("cluster-repair-disk-sizes", qa_cluster.TestClusterRepairDiskSizes)
196 65a884ef Iustin Pop
197 65a884ef Iustin Pop
198 b1ffe1eb Michael Hanselmann
def RunOsTests():
199 b1ffe1eb Michael Hanselmann
  """Runs all tests related to gnt-os.
200 5d640672 Michael Hanselmann

201 b1ffe1eb Michael Hanselmann
  """
202 2932dc44 Michael Hanselmann
  if qa_config.TestEnabled("rapi"):
203 2932dc44 Michael Hanselmann
    rapi_getos = qa_rapi.GetOperatingSystems
204 2932dc44 Michael Hanselmann
  else:
205 2932dc44 Michael Hanselmann
    rapi_getos = None
206 2932dc44 Michael Hanselmann
207 7d88f255 Iustin Pop
  for fn in [
208 7d88f255 Iustin Pop
    qa_os.TestOsList,
209 7d88f255 Iustin Pop
    qa_os.TestOsDiagnose,
210 2932dc44 Michael Hanselmann
    ]:
211 2932dc44 Michael Hanselmann
    RunTestIf("os", fn)
212 2932dc44 Michael Hanselmann
213 2932dc44 Michael Hanselmann
  for fn in [
214 7d88f255 Iustin Pop
    qa_os.TestOsValid,
215 7d88f255 Iustin Pop
    qa_os.TestOsInvalid,
216 7d88f255 Iustin Pop
    qa_os.TestOsPartiallyValid,
217 2932dc44 Michael Hanselmann
    ]:
218 2932dc44 Michael Hanselmann
    RunTestIf("os", fn, rapi_getos)
219 2932dc44 Michael Hanselmann
220 2932dc44 Michael Hanselmann
  for fn in [
221 7d88f255 Iustin Pop
    qa_os.TestOsModifyValid,
222 7d88f255 Iustin Pop
    qa_os.TestOsModifyInvalid,
223 074e139f Michael Hanselmann
    qa_os.TestOsStatesNonExisting,
224 7d88f255 Iustin Pop
    ]:
225 7d88f255 Iustin Pop
    RunTestIf("os", fn)
226 b1ffe1eb Michael Hanselmann
227 b1ffe1eb Michael Hanselmann
228 b1ffe1eb Michael Hanselmann
def RunCommonInstanceTests(instance):
229 b1ffe1eb Michael Hanselmann
  """Runs a few tests that are common to all disk types.
230 b1ffe1eb Michael Hanselmann

231 b1ffe1eb Michael Hanselmann
  """
232 7d88f255 Iustin Pop
  RunTestIf("instance-shutdown", qa_instance.TestInstanceShutdown, instance)
233 b82d4c5e Michael Hanselmann
  RunTestIf(["instance-shutdown", "instance-console", "rapi"],
234 b82d4c5e Michael Hanselmann
            qa_rapi.TestRapiStoppedInstanceConsole, instance)
235 3016bc1f Michael Hanselmann
  RunTestIf(["instance-shutdown", "instance-modify"],
236 3016bc1f Michael Hanselmann
            qa_instance.TestInstanceStoppedModify, instance)
237 7d88f255 Iustin Pop
  RunTestIf("instance-shutdown", qa_instance.TestInstanceStartup, instance)
238 a8083063 Iustin Pop
239 a7418448 Michael Hanselmann
  # Test shutdown/start via RAPI
240 a7418448 Michael Hanselmann
  RunTestIf(["instance-shutdown", "rapi"],
241 a7418448 Michael Hanselmann
            qa_rapi.TestRapiInstanceShutdown, instance)
242 a7418448 Michael Hanselmann
  RunTestIf(["instance-shutdown", "rapi"],
243 a7418448 Michael Hanselmann
            qa_rapi.TestRapiInstanceStartup, instance)
244 a7418448 Michael Hanselmann
245 7d88f255 Iustin Pop
  RunTestIf("instance-list", qa_instance.TestInstanceList)
246 283f9d4c Michael Hanselmann
247 7d88f255 Iustin Pop
  RunTestIf("instance-info", qa_instance.TestInstanceInfo, instance)
248 e9e35aaa Michael Hanselmann
249 7d88f255 Iustin Pop
  RunTestIf("instance-modify", qa_instance.TestInstanceModify, instance)
250 7d88f255 Iustin Pop
  RunTestIf(["instance-modify", "rapi"],
251 7d88f255 Iustin Pop
            qa_rapi.TestRapiInstanceModify, instance)
252 c0f74c55 Iustin Pop
253 7d88f255 Iustin Pop
  RunTestIf("instance-console", qa_instance.TestInstanceConsole, instance)
254 b82d4c5e Michael Hanselmann
  RunTestIf(["instance-console", "rapi"],
255 b82d4c5e Michael Hanselmann
            qa_rapi.TestRapiInstanceConsole, instance)
256 4379b1fa Michael Hanselmann
257 1be35bef Michael Hanselmann
  DOWN_TESTS = qa_config.Either([
258 1be35bef Michael Hanselmann
    "instance-reinstall",
259 1be35bef Michael Hanselmann
    "instance-rename",
260 1be35bef Michael Hanselmann
    "instance-grow-disk",
261 1be35bef Michael Hanselmann
    ])
262 1be35bef Michael Hanselmann
263 4c1a464b Iustin Pop
  # shutdown instance for any 'down' tests
264 4c1a464b Iustin Pop
  RunTestIf(DOWN_TESTS, qa_instance.TestInstanceShutdown, instance)
265 4c1a464b Iustin Pop
266 4c1a464b Iustin Pop
  # now run the 'down' state tests
267 7d88f255 Iustin Pop
  RunTestIf("instance-reinstall", qa_instance.TestInstanceReinstall, instance)
268 0220d2cf Guido Trotter
  RunTestIf(["instance-reinstall", "rapi"],
269 0220d2cf Guido Trotter
            qa_rapi.TestRapiInstanceReinstall, instance)
270 8a4e8898 Michael Hanselmann
271 d0c8c01d Iustin Pop
  if qa_config.TestEnabled("instance-rename"):
272 69bc7a38 Michael Hanselmann
    tgt_instance = qa_config.AcquireInstance()
273 69bc7a38 Michael Hanselmann
    try:
274 69bc7a38 Michael Hanselmann
      rename_source = instance["name"]
275 69bc7a38 Michael Hanselmann
      rename_target = tgt_instance["name"]
276 69bc7a38 Michael Hanselmann
      # perform instance rename to the same name
277 4c1a464b Iustin Pop
      RunTest(qa_instance.TestInstanceRenameAndBack,
278 69bc7a38 Michael Hanselmann
              rename_source, rename_source)
279 4c1a464b Iustin Pop
      RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
280 69bc7a38 Michael Hanselmann
                rename_source, rename_source)
281 69bc7a38 Michael Hanselmann
      if rename_target is not None:
282 69bc7a38 Michael Hanselmann
        # perform instance rename to a different name, if we have one configured
283 69bc7a38 Michael Hanselmann
        RunTest(qa_instance.TestInstanceRenameAndBack,
284 930e77d1 Michael Hanselmann
                rename_source, rename_target)
285 69bc7a38 Michael Hanselmann
        RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
286 69bc7a38 Michael Hanselmann
                  rename_source, rename_target)
287 69bc7a38 Michael Hanselmann
    finally:
288 69bc7a38 Michael Hanselmann
      qa_config.ReleaseInstance(tgt_instance)
289 4c1a464b Iustin Pop
290 26a5056d Iustin Pop
  RunTestIf(["instance-grow-disk"], qa_instance.TestInstanceGrowDisk, instance)
291 26a5056d Iustin Pop
292 4c1a464b Iustin Pop
  # and now start the instance again
293 4c1a464b Iustin Pop
  RunTestIf(DOWN_TESTS, qa_instance.TestInstanceStartup, instance)
294 4c1a464b Iustin Pop
295 4c1a464b Iustin Pop
  RunTestIf("instance-reboot", qa_instance.TestInstanceReboot, instance)
296 18337ca9 Iustin Pop
297 7d88f255 Iustin Pop
  RunTestIf("tags", qa_tags.TestInstanceTags, instance)
298 d74c2ca1 Michael Hanselmann
299 1ef6e776 Michael Hanselmann
  RunTestIf("cluster-verify", qa_cluster.TestClusterVerify)
300 d74c2ca1 Michael Hanselmann
301 7d88f255 Iustin Pop
  RunTestIf("rapi", qa_rapi.TestInstance, instance)
302 729c4377 Iustin Pop
303 288d6440 Michael Hanselmann
  # Lists instances, too
304 288d6440 Michael Hanselmann
  RunTestIf("node-list", qa_node.TestNodeList)
305 288d6440 Michael Hanselmann
306 09470dd8 Michael Hanselmann
  # Some jobs have been run, let's test listing them
307 09470dd8 Michael Hanselmann
  RunTestIf("job-list", qa_job.TestJobList)
308 09470dd8 Michael Hanselmann
309 729c4377 Iustin Pop
310 729c4377 Iustin Pop
def RunCommonNodeTests():
311 729c4377 Iustin Pop
  """Run a few common node tests.
312 729c4377 Iustin Pop

313 729c4377 Iustin Pop
  """
314 7d88f255 Iustin Pop
  RunTestIf("node-volumes", qa_node.TestNodeVolumes)
315 7d88f255 Iustin Pop
  RunTestIf("node-storage", qa_node.TestNodeStorage)
316 a1de4b18 René Nussbaumer
  RunTestIf("node-oob", qa_node.TestOutOfBand)
317 8e1db003 Michael Hanselmann
318 8d8d650c Michael Hanselmann
319 30131294 Adeodato Simo
def RunGroupListTests():
320 30131294 Adeodato Simo
  """Run tests for listing node groups.
321 30131294 Adeodato Simo

322 30131294 Adeodato Simo
  """
323 7ab8b7d7 Adeodato Simo
  RunTestIf("group-list", qa_group.TestGroupList)
324 7ab8b7d7 Adeodato Simo
  RunTestIf("group-list", qa_group.TestGroupListFields)
325 30131294 Adeodato Simo
326 30131294 Adeodato Simo
327 66787da5 Adeodato Simo
def RunGroupRwTests():
328 66787da5 Adeodato Simo
  """Run tests for adding/removing/renaming groups.
329 66787da5 Adeodato Simo

330 66787da5 Adeodato Simo
  """
331 66787da5 Adeodato Simo
  RunTestIf("group-rwops", qa_group.TestGroupAddRemoveRename)
332 4b10fb65 Adeodato Simo
  RunTestIf("group-rwops", qa_group.TestGroupAddWithOptions)
333 4b10fb65 Adeodato Simo
  RunTestIf("group-rwops", qa_group.TestGroupModify)
334 b9e478fe Michael Hanselmann
  RunTestIf(["group-rwops", "rapi"], qa_rapi.TestRapiNodeGroups)
335 fe508a9d Michael Hanselmann
  RunTestIf(["group-rwops", "tags"], qa_tags.TestGroupTags,
336 fe508a9d Michael Hanselmann
            qa_group.GetDefaultGroup())
337 4b10fb65 Adeodato Simo
338 66787da5 Adeodato Simo
339 638a7266 Iustin Pop
def RunExportImportTests(instance, pnode, snode):
340 b1ffe1eb Michael Hanselmann
  """Tries to export and import the instance.
341 a8083063 Iustin Pop

342 638a7266 Iustin Pop
  @param pnode: current primary node of the instance
343 638a7266 Iustin Pop
  @param snode: current secondary node of the instance, if any,
344 638a7266 Iustin Pop
      otherwise None
345 638a7266 Iustin Pop

346 b1ffe1eb Michael Hanselmann
  """
347 d0c8c01d Iustin Pop
  if qa_config.TestEnabled("instance-export"):
348 bc696589 Michael Hanselmann
    RunTest(qa_instance.TestInstanceExportNoTarget, instance)
349 bc696589 Michael Hanselmann
350 b1ffe1eb Michael Hanselmann
    expnode = qa_config.AcquireNode(exclude=pnode)
351 b1ffe1eb Michael Hanselmann
    try:
352 b1ffe1eb Michael Hanselmann
      name = RunTest(qa_instance.TestInstanceExport, instance, expnode)
353 b1ffe1eb Michael Hanselmann
354 b1ffe1eb Michael Hanselmann
      RunTest(qa_instance.TestBackupList, expnode)
355 b1ffe1eb Michael Hanselmann
356 d0c8c01d Iustin Pop
      if qa_config.TestEnabled("instance-import"):
357 b1ffe1eb Michael Hanselmann
        newinst = qa_config.AcquireInstance()
358 5d640672 Michael Hanselmann
        try:
359 5fa0375e Michael Hanselmann
          RunTest(qa_instance.TestInstanceImport, newinst, pnode,
360 b1ffe1eb Michael Hanselmann
                  expnode, name)
361 51131cad Michael Hanselmann
          # Check if starting the instance works
362 51131cad Michael Hanselmann
          RunTest(qa_instance.TestInstanceStartup, newinst)
363 b1ffe1eb Michael Hanselmann
          RunTest(qa_instance.TestInstanceRemove, newinst)
364 5d640672 Michael Hanselmann
        finally:
365 b1ffe1eb Michael Hanselmann
          qa_config.ReleaseInstance(newinst)
366 b1ffe1eb Michael Hanselmann
    finally:
367 b1ffe1eb Michael Hanselmann
      qa_config.ReleaseNode(expnode)
368 5d640672 Michael Hanselmann
369 7d88f255 Iustin Pop
  if qa_config.TestEnabled(["rapi", "inter-cluster-instance-move"]):
370 5d831182 Michael Hanselmann
    newinst = qa_config.AcquireInstance()
371 5d831182 Michael Hanselmann
    try:
372 638a7266 Iustin Pop
      if snode is None:
373 638a7266 Iustin Pop
        excl = [pnode]
374 638a7266 Iustin Pop
      else:
375 638a7266 Iustin Pop
        excl = [pnode, snode]
376 638a7266 Iustin Pop
      tnode = qa_config.AcquireNode(exclude=excl)
377 5d831182 Michael Hanselmann
      try:
378 5d831182 Michael Hanselmann
        RunTest(qa_rapi.TestInterClusterInstanceMove, instance, newinst,
379 638a7266 Iustin Pop
                pnode, snode, tnode)
380 5d831182 Michael Hanselmann
      finally:
381 638a7266 Iustin Pop
        qa_config.ReleaseNode(tnode)
382 5d831182 Michael Hanselmann
    finally:
383 5d831182 Michael Hanselmann
      qa_config.ReleaseInstance(newinst)
384 5d831182 Michael Hanselmann
385 283f9d4c Michael Hanselmann
386 b998270c Iustin Pop
def RunDaemonTests(instance):
387 b1ffe1eb Michael Hanselmann
  """Test the ganeti-watcher script.
388 9df6d173 Michael Hanselmann

389 b1ffe1eb Michael Hanselmann
  """
390 8201b996 Iustin Pop
  RunTest(qa_daemon.TestPauseWatcher)
391 e9e35aaa Michael Hanselmann
392 7d88f255 Iustin Pop
  RunTestIf("instance-automatic-restart",
393 b998270c Iustin Pop
            qa_daemon.TestInstanceAutomaticRestart, instance)
394 7d88f255 Iustin Pop
  RunTestIf("instance-consecutive-failures",
395 b998270c Iustin Pop
            qa_daemon.TestInstanceConsecutiveFailures, instance)
396 e9e35aaa Michael Hanselmann
397 8201b996 Iustin Pop
  RunTest(qa_daemon.TestResumeWatcher)
398 8201b996 Iustin Pop
399 9df6d173 Michael Hanselmann
400 83180411 Bernardo Dal Seno
def RunSingleHomedHardwareFailureTests(instance, pnode):
401 83180411 Bernardo Dal Seno
  """Test hardware failure recovery for single-homed instances.
402 83180411 Bernardo Dal Seno

403 83180411 Bernardo Dal Seno
  """
404 83180411 Bernardo Dal Seno
  if qa_config.TestEnabled("instance-recreate-disks"):
405 83180411 Bernardo Dal Seno
    othernode = qa_config.AcquireNode(exclude=[pnode])
406 83180411 Bernardo Dal Seno
    try:
407 83180411 Bernardo Dal Seno
      RunTest(qa_instance.TestRecreateDisks,
408 83180411 Bernardo Dal Seno
              instance, pnode, None, [othernode])
409 83180411 Bernardo Dal Seno
    finally:
410 83180411 Bernardo Dal Seno
      qa_config.ReleaseNode(othernode)
411 83180411 Bernardo Dal Seno
412 83180411 Bernardo Dal Seno
413 b1ffe1eb Michael Hanselmann
def RunHardwareFailureTests(instance, pnode, snode):
414 b1ffe1eb Michael Hanselmann
  """Test cluster internal hardware failure recovery.
415 a8083063 Iustin Pop

416 b1ffe1eb Michael Hanselmann
  """
417 7d88f255 Iustin Pop
  RunTestIf("instance-failover", qa_instance.TestInstanceFailover, instance)
418 c0a146a1 Michael Hanselmann
  RunTestIf(["instance-failover", "rapi"],
419 c0a146a1 Michael Hanselmann
            qa_rapi.TestRapiInstanceFailover, instance)
420 b1ffe1eb Michael Hanselmann
421 7d88f255 Iustin Pop
  RunTestIf("instance-migrate", qa_instance.TestInstanceMigrate, instance)
422 7d88f255 Iustin Pop
  RunTestIf(["instance-migrate", "rapi"],
423 7d88f255 Iustin Pop
            qa_rapi.TestRapiInstanceMigrate, instance)
424 938bde86 Michael Hanselmann
425 d0c8c01d Iustin Pop
  if qa_config.TestEnabled("instance-replace-disks"):
426 76f59a32 Michael Hanselmann
    othernode = qa_config.AcquireNode(exclude=[pnode, snode])
427 7910e7a5 Michael Hanselmann
    try:
428 539d65ba Michael Hanselmann
      RunTestIf("rapi", qa_rapi.TestRapiInstanceReplaceDisks, instance)
429 7910e7a5 Michael Hanselmann
      RunTest(qa_instance.TestReplaceDisks,
430 7910e7a5 Michael Hanselmann
              instance, pnode, snode, othernode)
431 7910e7a5 Michael Hanselmann
    finally:
432 7910e7a5 Michael Hanselmann
      qa_config.ReleaseNode(othernode)
433 7910e7a5 Michael Hanselmann
434 83180411 Bernardo Dal Seno
  if qa_config.TestEnabled("instance-recreate-disks"):
435 83180411 Bernardo Dal Seno
    othernode1 = qa_config.AcquireNode(exclude=[pnode, snode])
436 83180411 Bernardo Dal Seno
    try:
437 83180411 Bernardo Dal Seno
      othernode2 = qa_config.AcquireNode(exclude=[pnode, snode, othernode1])
438 83180411 Bernardo Dal Seno
    except qa_error.OutOfNodesError:
439 83180411 Bernardo Dal Seno
      # Let's reuse one of the nodes if the cluster is not big enough
440 83180411 Bernardo Dal Seno
      othernode2 = pnode
441 83180411 Bernardo Dal Seno
    try:
442 83180411 Bernardo Dal Seno
      RunTest(qa_instance.TestRecreateDisks,
443 83180411 Bernardo Dal Seno
              instance, pnode, snode, [othernode1, othernode2])
444 83180411 Bernardo Dal Seno
    finally:
445 83180411 Bernardo Dal Seno
      qa_config.ReleaseNode(othernode1)
446 83180411 Bernardo Dal Seno
      if othernode2 != pnode:
447 83180411 Bernardo Dal Seno
        qa_config.ReleaseNode(othernode2)
448 83180411 Bernardo Dal Seno
449 7d88f255 Iustin Pop
  RunTestIf("node-evacuate", qa_node.TestNodeEvacuate, pnode, snode)
450 b1ffe1eb Michael Hanselmann
451 7d88f255 Iustin Pop
  RunTestIf("node-failover", qa_node.TestNodeFailover, pnode, snode)
452 b1ffe1eb Michael Hanselmann
453 7d88f255 Iustin Pop
  RunTestIf("instance-disk-failure", qa_instance.TestInstanceMasterDiskFailure,
454 b1ffe1eb Michael Hanselmann
            instance, pnode, snode)
455 7d88f255 Iustin Pop
  RunTestIf("instance-disk-failure",
456 7d88f255 Iustin Pop
            qa_instance.TestInstanceSecondaryDiskFailure, instance,
457 7d88f255 Iustin Pop
            pnode, snode)
458 b1ffe1eb Michael Hanselmann
459 b1ffe1eb Michael Hanselmann
460 50ef6a41 Bernardo Dal Seno
def RunExclusiveStorageTests():
461 50ef6a41 Bernardo Dal Seno
  """Test exclusive storage."""
462 50ef6a41 Bernardo Dal Seno
  if not qa_config.TestEnabled("cluster-exclusive-storage"):
463 50ef6a41 Bernardo Dal Seno
    return
464 50ef6a41 Bernardo Dal Seno
465 50ef6a41 Bernardo Dal Seno
  node = qa_config.AcquireNode()
466 50ef6a41 Bernardo Dal Seno
  try:
467 e8b919a1 Bernardo Dal Seno
    old_es = qa_cluster.TestSetExclStorCluster(False)
468 e8b919a1 Bernardo Dal Seno
    qa_cluster.TestExclStorSingleNode(node)
469 e8b919a1 Bernardo Dal Seno
470 e8b919a1 Bernardo Dal Seno
    qa_cluster.TestSetExclStorCluster(True)
471 50ef6a41 Bernardo Dal Seno
    if qa_config.TestEnabled("instance-add-plain-disk"):
472 50ef6a41 Bernardo Dal Seno
      # Make sure that the cluster doesn't have any pre-existing problem
473 50ef6a41 Bernardo Dal Seno
      qa_cluster.AssertClusterVerify()
474 50ef6a41 Bernardo Dal Seno
      instance1 = qa_instance.TestInstanceAddWithPlainDisk(node)
475 50ef6a41 Bernardo Dal Seno
      instance2 = qa_instance.TestInstanceAddWithPlainDisk(node)
476 50ef6a41 Bernardo Dal Seno
      # cluster-verify checks that disks are allocated correctly
477 50ef6a41 Bernardo Dal Seno
      qa_cluster.AssertClusterVerify()
478 50ef6a41 Bernardo Dal Seno
      qa_instance.TestInstanceRemove(instance1)
479 50ef6a41 Bernardo Dal Seno
      qa_instance.TestInstanceRemove(instance2)
480 50ef6a41 Bernardo Dal Seno
    qa_cluster.TestSetExclStorCluster(old_es)
481 50ef6a41 Bernardo Dal Seno
  finally:
482 50ef6a41 Bernardo Dal Seno
    qa_config.ReleaseNode(node)
483 50ef6a41 Bernardo Dal Seno
484 50ef6a41 Bernardo Dal Seno
485 f7e6f3c8 Iustin Pop
def RunQa():
486 f7e6f3c8 Iustin Pop
  """Main QA body.
487 b1ffe1eb Michael Hanselmann

488 b1ffe1eb Michael Hanselmann
  """
489 725ec2f1 René Nussbaumer
  rapi_user = "ganeti-qa"
490 725ec2f1 René Nussbaumer
  rapi_secret = utils.GenerateSecret()
491 725ec2f1 René Nussbaumer
492 b1ffe1eb Michael Hanselmann
  RunEnvTests()
493 725ec2f1 René Nussbaumer
  SetupCluster(rapi_user, rapi_secret)
494 2771835c Michael Hanselmann
495 2771835c Michael Hanselmann
  # Load RAPI certificate
496 76917d97 Iustin Pop
  qa_rapi.Setup(rapi_user, rapi_secret)
497 2771835c Michael Hanselmann
498 b1ffe1eb Michael Hanselmann
  RunClusterTests()
499 b1ffe1eb Michael Hanselmann
  RunOsTests()
500 4b62db14 Michael Hanselmann
501 7d88f255 Iustin Pop
  RunTestIf("tags", qa_tags.TestClusterTags)
502 d74c2ca1 Michael Hanselmann
503 729c4377 Iustin Pop
  RunCommonNodeTests()
504 30131294 Adeodato Simo
  RunGroupListTests()
505 66787da5 Adeodato Simo
  RunGroupRwTests()
506 729c4377 Iustin Pop
507 6f058bf2 Bernardo Dal Seno
  # The master shouldn't be readded or put offline; "delay" needs a non-master
508 6f058bf2 Bernardo Dal Seno
  # node to test
509 d0cb68cb Michael Hanselmann
  pnode = qa_config.AcquireNode(exclude=qa_config.GetMasterNode())
510 d0cb68cb Michael Hanselmann
  try:
511 7d88f255 Iustin Pop
    RunTestIf("node-readd", qa_node.TestNodeReadd, pnode)
512 7d88f255 Iustin Pop
    RunTestIf("node-modify", qa_node.TestNodeModify, pnode)
513 5a85b99e Michael Hanselmann
    RunTestIf("delay", qa_cluster.TestDelay, pnode)
514 d0cb68cb Michael Hanselmann
  finally:
515 d0cb68cb Michael Hanselmann
    qa_config.ReleaseNode(pnode)
516 102b115b Michael Hanselmann
517 b1ffe1eb Michael Hanselmann
  pnode = qa_config.AcquireNode()
518 b1ffe1eb Michael Hanselmann
  try:
519 7d88f255 Iustin Pop
    RunTestIf("tags", qa_tags.TestNodeTags, pnode)
520 d74c2ca1 Michael Hanselmann
521 a47f574c Oleksiy Mishchenko
    if qa_rapi.Enabled():
522 a47f574c Oleksiy Mishchenko
      RunTest(qa_rapi.TestNode, pnode)
523 a47f574c Oleksiy Mishchenko
524 8cb70e56 Michael Hanselmann
      if qa_config.TestEnabled("instance-add-plain-disk"):
525 924e95f9 Michael Hanselmann
        for use_client in [True, False]:
526 924e95f9 Michael Hanselmann
          rapi_instance = RunTest(qa_rapi.TestRapiInstanceAdd, pnode,
527 924e95f9 Michael Hanselmann
                                  use_client)
528 b498540e Iustin Pop
          if qa_config.TestEnabled("instance-plain-rapi-common-tests"):
529 b498540e Iustin Pop
            RunCommonInstanceTests(rapi_instance)
530 924e95f9 Michael Hanselmann
          RunTest(qa_rapi.TestRapiInstanceRemove, rapi_instance, use_client)
531 924e95f9 Michael Hanselmann
          del rapi_instance
532 8cb70e56 Michael Hanselmann
533 65a884ef Iustin Pop
    if qa_config.TestEnabled("instance-add-plain-disk"):
534 b1ffe1eb Michael Hanselmann
      instance = RunTest(qa_instance.TestInstanceAddWithPlainDisk, pnode)
535 b1ffe1eb Michael Hanselmann
      RunCommonInstanceTests(instance)
536 30131294 Adeodato Simo
      RunGroupListTests()
537 24fed61e René Nussbaumer
      RunTestIf("cluster-epo", qa_cluster.TestClusterEpo)
538 638a7266 Iustin Pop
      RunExportImportTests(instance, pnode, None)
539 b998270c Iustin Pop
      RunDaemonTests(instance)
540 65a884ef Iustin Pop
      RunRepairDiskSizes()
541 83180411 Bernardo Dal Seno
      RunSingleHomedHardwareFailureTests(instance, pnode)
542 b1ffe1eb Michael Hanselmann
      RunTest(qa_instance.TestInstanceRemove, instance)
543 b1ffe1eb Michael Hanselmann
      del instance
544 9df6d173 Michael Hanselmann
545 7d7609a3 Michael Hanselmann
    multinode_tests = [
546 d0c8c01d Iustin Pop
      ("instance-add-drbd-disk",
547 7d7609a3 Michael Hanselmann
       qa_instance.TestInstanceAddWithDrbdDisk),
548 7d7609a3 Michael Hanselmann
    ]
549 7d7609a3 Michael Hanselmann
550 7d7609a3 Michael Hanselmann
    for name, func in multinode_tests:
551 7d7609a3 Michael Hanselmann
      if qa_config.TestEnabled(name):
552 7d7609a3 Michael Hanselmann
        snode = qa_config.AcquireNode(exclude=pnode)
553 7d7609a3 Michael Hanselmann
        try:
554 7d7609a3 Michael Hanselmann
          instance = RunTest(func, pnode, snode)
555 286b7335 Iustin Pop
          RunTestIf("haskell-confd", qa_node.TestNodeListDrbd, pnode)
556 286b7335 Iustin Pop
          RunTestIf("haskell-confd", qa_node.TestNodeListDrbd, snode)
557 7d7609a3 Michael Hanselmann
          RunCommonInstanceTests(instance)
558 30131294 Adeodato Simo
          RunGroupListTests()
559 479197d5 Bernardo Dal Seno
          RunTestIf("group-rwops", qa_group.TestAssignNodesIncludingSplit,
560 479197d5 Bernardo Dal Seno
                    constants.INITIAL_NODE_GROUP_NAME,
561 479197d5 Bernardo Dal Seno
                    pnode["primary"], snode["primary"])
562 d0c8c01d Iustin Pop
          if qa_config.TestEnabled("instance-convert-disk"):
563 f9f0ce7f Guido Trotter
            RunTest(qa_instance.TestInstanceShutdown, instance)
564 7f69aabb Iustin Pop
            RunTest(qa_instance.TestInstanceConvertDisk, instance, snode)
565 f9f0ce7f Guido Trotter
            RunTest(qa_instance.TestInstanceStartup, instance)
566 638a7266 Iustin Pop
          RunExportImportTests(instance, pnode, snode)
567 7d7609a3 Michael Hanselmann
          RunHardwareFailureTests(instance, pnode, snode)
568 65a884ef Iustin Pop
          RunRepairDiskSizes()
569 7d7609a3 Michael Hanselmann
          RunTest(qa_instance.TestInstanceRemove, instance)
570 7d7609a3 Michael Hanselmann
          del instance
571 7d7609a3 Michael Hanselmann
        finally:
572 7d7609a3 Michael Hanselmann
          qa_config.ReleaseNode(snode)
573 a8083063 Iustin Pop
574 6f058bf2 Bernardo Dal Seno
  finally:
575 6f058bf2 Bernardo Dal Seno
    qa_config.ReleaseNode(pnode)
576 6f058bf2 Bernardo Dal Seno
577 6f058bf2 Bernardo Dal Seno
  # Test removing instance with offline drbd secondary
578 6f058bf2 Bernardo Dal Seno
  if qa_config.TestEnabled("instance-remove-drbd-offline"):
579 6f058bf2 Bernardo Dal Seno
    # Make sure the master is not put offline
580 6f058bf2 Bernardo Dal Seno
    snode = qa_config.AcquireNode(exclude=qa_config.GetMasterNode())
581 6f058bf2 Bernardo Dal Seno
    try:
582 6f058bf2 Bernardo Dal Seno
      pnode = qa_config.AcquireNode(exclude=snode)
583 c7e54e1d Agata Murawska
      try:
584 6f058bf2 Bernardo Dal Seno
        instance = qa_instance.TestInstanceAddWithDrbdDisk(pnode, snode)
585 c7e54e1d Agata Murawska
        qa_node.MakeNodeOffline(snode, "yes")
586 6f058bf2 Bernardo Dal Seno
        try:
587 6f058bf2 Bernardo Dal Seno
          RunTest(qa_instance.TestInstanceRemove, instance)
588 6f058bf2 Bernardo Dal Seno
        finally:
589 6f058bf2 Bernardo Dal Seno
          qa_node.MakeNodeOffline(snode, "no")
590 c7e54e1d Agata Murawska
      finally:
591 6f058bf2 Bernardo Dal Seno
        qa_config.ReleaseNode(pnode)
592 6f058bf2 Bernardo Dal Seno
    finally:
593 6f058bf2 Bernardo Dal Seno
      qa_config.ReleaseNode(snode)
594 c7e54e1d Agata Murawska
595 6f058bf2 Bernardo Dal Seno
  pnode = qa_config.AcquireNode()
596 6f058bf2 Bernardo Dal Seno
  try:
597 7d88f255 Iustin Pop
    if qa_config.TestEnabled(["instance-add-plain-disk", "instance-export"]):
598 3b01286e Michael Hanselmann
      for shutdown in [False, True]:
599 3b01286e Michael Hanselmann
        instance = RunTest(qa_instance.TestInstanceAddWithPlainDisk, pnode)
600 3b01286e Michael Hanselmann
        expnode = qa_config.AcquireNode(exclude=pnode)
601 3b01286e Michael Hanselmann
        try:
602 3b01286e Michael Hanselmann
          if shutdown:
603 3b01286e Michael Hanselmann
            # Stop instance before exporting and removing it
604 3b01286e Michael Hanselmann
            RunTest(qa_instance.TestInstanceShutdown, instance)
605 3b01286e Michael Hanselmann
          RunTest(qa_instance.TestInstanceExportWithRemove, instance, expnode)
606 3b01286e Michael Hanselmann
          RunTest(qa_instance.TestBackupList, expnode)
607 3b01286e Michael Hanselmann
        finally:
608 3b01286e Michael Hanselmann
          qa_config.ReleaseNode(expnode)
609 3b01286e Michael Hanselmann
        del expnode
610 3b01286e Michael Hanselmann
        del instance
611 8d8d650c Michael Hanselmann
612 a8083063 Iustin Pop
  finally:
613 b1ffe1eb Michael Hanselmann
    qa_config.ReleaseNode(pnode)
614 a8083063 Iustin Pop
615 50ef6a41 Bernardo Dal Seno
  RunExclusiveStorageTests()
616 50ef6a41 Bernardo Dal Seno
617 7d88f255 Iustin Pop
  RunTestIf("create-cluster", qa_node.TestNodeRemoveAll)
618 a8083063 Iustin Pop
619 7d88f255 Iustin Pop
  RunTestIf("cluster-destroy", qa_cluster.TestClusterDestroy)
620 a8083063 Iustin Pop
621 cec9845c Michael Hanselmann
622 fc3f75dd Iustin Pop
@UsesRapiClient
623 f7e6f3c8 Iustin Pop
def main():
624 f7e6f3c8 Iustin Pop
  """Main program.
625 f7e6f3c8 Iustin Pop

626 f7e6f3c8 Iustin Pop
  """
627 f7e6f3c8 Iustin Pop
  parser = optparse.OptionParser(usage="%prog [options] <config-file>")
628 d0c8c01d Iustin Pop
  parser.add_option("--yes-do-it", dest="yes_do_it",
629 5ae4945a Iustin Pop
                    action="store_true",
630 5ae4945a Iustin Pop
                    help="Really execute the tests")
631 f7e6f3c8 Iustin Pop
  (qa_config.options, args) = parser.parse_args()
632 f7e6f3c8 Iustin Pop
633 f7e6f3c8 Iustin Pop
  if len(args) == 1:
634 f7e6f3c8 Iustin Pop
    (config_file, ) = args
635 f7e6f3c8 Iustin Pop
  else:
636 f7e6f3c8 Iustin Pop
    parser.error("Wrong number of arguments.")
637 f7e6f3c8 Iustin Pop
638 f7e6f3c8 Iustin Pop
  if not qa_config.options.yes_do_it:
639 f7e6f3c8 Iustin Pop
    print ("Executing this script irreversibly destroys any Ganeti\n"
640 f7e6f3c8 Iustin Pop
           "configuration on all nodes involved. If you really want\n"
641 f7e6f3c8 Iustin Pop
           "to start testing, supply the --yes-do-it option.")
642 f7e6f3c8 Iustin Pop
    sys.exit(1)
643 f7e6f3c8 Iustin Pop
644 f7e6f3c8 Iustin Pop
  qa_config.Load(config_file)
645 f7e6f3c8 Iustin Pop
646 710bc88c Iustin Pop
  primary = qa_config.GetMasterNode()["primary"]
647 710bc88c Iustin Pop
  qa_utils.StartMultiplexer(primary)
648 710bc88c Iustin Pop
  print ("SSH command for primary node: %s" %
649 710bc88c Iustin Pop
         utils.ShellQuoteArgs(qa_utils.GetSSHCommand(primary, "")))
650 710bc88c Iustin Pop
  print ("SSH command for other nodes: %s" %
651 710bc88c Iustin Pop
         utils.ShellQuoteArgs(qa_utils.GetSSHCommand("NODE", "")))
652 f7e6f3c8 Iustin Pop
  try:
653 f7e6f3c8 Iustin Pop
    RunQa()
654 f7e6f3c8 Iustin Pop
  finally:
655 f7e6f3c8 Iustin Pop
    qa_utils.CloseMultiplexers()
656 f7e6f3c8 Iustin Pop
657 d0c8c01d Iustin Pop
if __name__ == "__main__":
658 cec9845c Michael Hanselmann
  main()