root / qa / ganeti-qa.py @ 5fa0375e
History | View | Annotate | Download (16.8 kB)
1 |
#!/usr/bin/python -u
|
---|---|
2 |
#
|
3 |
|
4 |
# Copyright (C) 2007, 2008, 2009, 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 |
"""Script for doing QA on Ganeti.
|
23 |
|
24 |
"""
|
25 |
|
26 |
# pylint: disable=C0103
|
27 |
# due to invalid name
|
28 |
|
29 |
import sys |
30 |
import datetime |
31 |
import optparse |
32 |
|
33 |
import qa_cluster |
34 |
import qa_config |
35 |
import qa_daemon |
36 |
import qa_env |
37 |
import qa_group |
38 |
import qa_instance |
39 |
import qa_node |
40 |
import qa_os |
41 |
import qa_job |
42 |
import qa_rapi |
43 |
import qa_tags |
44 |
import qa_utils |
45 |
|
46 |
from ganeti import utils |
47 |
from ganeti import rapi |
48 |
from ganeti import constants |
49 |
|
50 |
import ganeti.rapi.client # pylint: disable=W0611 |
51 |
|
52 |
|
53 |
def _FormatHeader(line, end=72): |
54 |
"""Fill a line up to the end column.
|
55 |
|
56 |
"""
|
57 |
line = "---- " + line + " " |
58 |
line += "-" * (end - len(line)) |
59 |
line = line.rstrip() |
60 |
return line
|
61 |
|
62 |
|
63 |
def _DescriptionOf(fn): |
64 |
"""Computes the description of an item.
|
65 |
|
66 |
"""
|
67 |
if fn.__doc__:
|
68 |
desc = fn.__doc__.splitlines()[0].strip()
|
69 |
else:
|
70 |
desc = "%r" % fn
|
71 |
|
72 |
return desc.rstrip(".") |
73 |
|
74 |
|
75 |
def RunTest(fn, *args, **kwargs): |
76 |
"""Runs a test after printing a header.
|
77 |
|
78 |
"""
|
79 |
|
80 |
tstart = datetime.datetime.now() |
81 |
|
82 |
desc = _DescriptionOf(fn) |
83 |
|
84 |
print
|
85 |
print _FormatHeader("%s start %s" % (tstart, desc)) |
86 |
|
87 |
try:
|
88 |
retval = fn(*args, **kwargs) |
89 |
return retval
|
90 |
finally:
|
91 |
tstop = datetime.datetime.now() |
92 |
tdelta = tstop - tstart |
93 |
print _FormatHeader("%s time=%s %s" % (tstop, tdelta, desc)) |
94 |
|
95 |
|
96 |
def RunTestIf(testnames, fn, *args, **kwargs): |
97 |
"""Runs a test conditionally.
|
98 |
|
99 |
@param testnames: either a single test name in the configuration
|
100 |
file, or a list of testnames (which will be AND-ed together)
|
101 |
|
102 |
"""
|
103 |
if qa_config.TestEnabled(testnames):
|
104 |
RunTest(fn, *args, **kwargs) |
105 |
else:
|
106 |
tstart = datetime.datetime.now() |
107 |
desc = _DescriptionOf(fn) |
108 |
print _FormatHeader("%s skipping %s, test(s) %s disabled" % |
109 |
(tstart, desc, testnames)) |
110 |
|
111 |
|
112 |
def RunEnvTests(): |
113 |
"""Run several environment tests.
|
114 |
|
115 |
"""
|
116 |
RunTestIf("env", qa_env.TestSshConnection)
|
117 |
RunTestIf("env", qa_env.TestIcmpPing)
|
118 |
RunTestIf("env", qa_env.TestGanetiCommands)
|
119 |
|
120 |
|
121 |
def SetupCluster(rapi_user, rapi_secret): |
122 |
"""Initializes the cluster.
|
123 |
|
124 |
@param rapi_user: Login user for RAPI
|
125 |
@param rapi_secret: Login secret for RAPI
|
126 |
|
127 |
"""
|
128 |
RunTestIf("create-cluster", qa_cluster.TestClusterInit,
|
129 |
rapi_user, rapi_secret) |
130 |
|
131 |
# Test on empty cluster
|
132 |
RunTestIf("node-list", qa_node.TestNodeList)
|
133 |
RunTestIf("instance-list", qa_instance.TestInstanceList)
|
134 |
RunTestIf("job-list", qa_job.TestJobList)
|
135 |
|
136 |
RunTestIf("create-cluster", qa_node.TestNodeAddAll)
|
137 |
if not qa_config.TestEnabled("create-cluster"): |
138 |
# consider the nodes are already there
|
139 |
qa_node.MarkNodeAddedAll() |
140 |
|
141 |
RunTestIf("test-jobqueue", qa_cluster.TestJobqueue)
|
142 |
|
143 |
# enable the watcher (unconditionally)
|
144 |
RunTest(qa_daemon.TestResumeWatcher) |
145 |
|
146 |
RunTestIf("node-list", qa_node.TestNodeList)
|
147 |
|
148 |
# Test listing fields
|
149 |
RunTestIf("node-list", qa_node.TestNodeListFields)
|
150 |
RunTestIf("instance-list", qa_instance.TestInstanceListFields)
|
151 |
RunTestIf("job-list", qa_job.TestJobListFields)
|
152 |
RunTestIf("instance-export", qa_instance.TestBackupListFields)
|
153 |
|
154 |
RunTestIf("node-info", qa_node.TestNodeInfo)
|
155 |
|
156 |
|
157 |
def RunClusterTests(): |
158 |
"""Runs tests related to gnt-cluster.
|
159 |
|
160 |
"""
|
161 |
for test, fn in [ |
162 |
("create-cluster", qa_cluster.TestClusterInitDisk),
|
163 |
("cluster-renew-crypto", qa_cluster.TestClusterRenewCrypto),
|
164 |
("cluster-verify", qa_cluster.TestClusterVerify),
|
165 |
("cluster-reserved-lvs", qa_cluster.TestClusterReservedLvs),
|
166 |
# TODO: add more cluster modify tests
|
167 |
("cluster-modify", qa_cluster.TestClusterModifyEmpty),
|
168 |
("cluster-modify", qa_cluster.TestClusterModifyBe),
|
169 |
("cluster-modify", qa_cluster.TestClusterModifyDisk),
|
170 |
("cluster-rename", qa_cluster.TestClusterRename),
|
171 |
("cluster-info", qa_cluster.TestClusterVersion),
|
172 |
("cluster-info", qa_cluster.TestClusterInfo),
|
173 |
("cluster-info", qa_cluster.TestClusterGetmaster),
|
174 |
("cluster-redist-conf", qa_cluster.TestClusterRedistConf),
|
175 |
("cluster-copyfile", qa_cluster.TestClusterCopyfile),
|
176 |
("cluster-command", qa_cluster.TestClusterCommand),
|
177 |
("cluster-burnin", qa_cluster.TestClusterBurnin),
|
178 |
("cluster-master-failover", qa_cluster.TestClusterMasterFailover),
|
179 |
("cluster-master-failover",
|
180 |
qa_cluster.TestClusterMasterFailoverWithDrainedQueue), |
181 |
("cluster-oob", qa_cluster.TestClusterOob),
|
182 |
("rapi", qa_rapi.TestVersion),
|
183 |
("rapi", qa_rapi.TestEmptyCluster),
|
184 |
("rapi", qa_rapi.TestRapiQuery),
|
185 |
]: |
186 |
RunTestIf(test, fn) |
187 |
|
188 |
|
189 |
def RunRepairDiskSizes(): |
190 |
"""Run the repair disk-sizes test.
|
191 |
|
192 |
"""
|
193 |
RunTestIf("cluster-repair-disk-sizes", qa_cluster.TestClusterRepairDiskSizes)
|
194 |
|
195 |
|
196 |
def RunOsTests(): |
197 |
"""Runs all tests related to gnt-os.
|
198 |
|
199 |
"""
|
200 |
if qa_config.TestEnabled("rapi"): |
201 |
rapi_getos = qa_rapi.GetOperatingSystems |
202 |
else:
|
203 |
rapi_getos = None
|
204 |
|
205 |
for fn in [ |
206 |
qa_os.TestOsList, |
207 |
qa_os.TestOsDiagnose, |
208 |
]: |
209 |
RunTestIf("os", fn)
|
210 |
|
211 |
for fn in [ |
212 |
qa_os.TestOsValid, |
213 |
qa_os.TestOsInvalid, |
214 |
qa_os.TestOsPartiallyValid, |
215 |
]: |
216 |
RunTestIf("os", fn, rapi_getos)
|
217 |
|
218 |
for fn in [ |
219 |
qa_os.TestOsModifyValid, |
220 |
qa_os.TestOsModifyInvalid, |
221 |
qa_os.TestOsStatesNonExisting, |
222 |
]: |
223 |
RunTestIf("os", fn)
|
224 |
|
225 |
|
226 |
def RunCommonInstanceTests(instance): |
227 |
"""Runs a few tests that are common to all disk types.
|
228 |
|
229 |
"""
|
230 |
RunTestIf("instance-shutdown", qa_instance.TestInstanceShutdown, instance)
|
231 |
RunTestIf(["instance-shutdown", "instance-console", "rapi"], |
232 |
qa_rapi.TestRapiStoppedInstanceConsole, instance) |
233 |
RunTestIf(["instance-shutdown", "instance-modify"], |
234 |
qa_instance.TestInstanceStoppedModify, instance) |
235 |
RunTestIf("instance-shutdown", qa_instance.TestInstanceStartup, instance)
|
236 |
|
237 |
# Test shutdown/start via RAPI
|
238 |
RunTestIf(["instance-shutdown", "rapi"], |
239 |
qa_rapi.TestRapiInstanceShutdown, instance) |
240 |
RunTestIf(["instance-shutdown", "rapi"], |
241 |
qa_rapi.TestRapiInstanceStartup, instance) |
242 |
|
243 |
RunTestIf("instance-list", qa_instance.TestInstanceList)
|
244 |
|
245 |
RunTestIf("instance-info", qa_instance.TestInstanceInfo, instance)
|
246 |
|
247 |
RunTestIf("instance-modify", qa_instance.TestInstanceModify, instance)
|
248 |
RunTestIf(["instance-modify", "rapi"], |
249 |
qa_rapi.TestRapiInstanceModify, instance) |
250 |
|
251 |
RunTestIf("instance-console", qa_instance.TestInstanceConsole, instance)
|
252 |
RunTestIf(["instance-console", "rapi"], |
253 |
qa_rapi.TestRapiInstanceConsole, instance) |
254 |
|
255 |
DOWN_TESTS = qa_config.Either([ |
256 |
"instance-reinstall",
|
257 |
"instance-rename",
|
258 |
"instance-grow-disk",
|
259 |
]) |
260 |
|
261 |
# shutdown instance for any 'down' tests
|
262 |
RunTestIf(DOWN_TESTS, qa_instance.TestInstanceShutdown, instance) |
263 |
|
264 |
# now run the 'down' state tests
|
265 |
RunTestIf("instance-reinstall", qa_instance.TestInstanceReinstall, instance)
|
266 |
RunTestIf(["instance-reinstall", "rapi"], |
267 |
qa_rapi.TestRapiInstanceReinstall, instance) |
268 |
# RAPI reinstall will leave the instance up by default, so we have
|
269 |
# to stop it again
|
270 |
RunTestIf(["instance-reinstall", "rapi"], |
271 |
qa_rapi.TestRapiInstanceShutdown, instance) |
272 |
|
273 |
if qa_config.TestEnabled("instance-rename"): |
274 |
rename_source = instance["name"]
|
275 |
rename_target = qa_config.get("rename", None) |
276 |
# perform instance rename to the same name
|
277 |
RunTest(qa_instance.TestInstanceRenameAndBack, |
278 |
rename_source, rename_source) |
279 |
RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
|
280 |
rename_source, rename_source) |
281 |
if rename_target is not None: |
282 |
# perform instance rename to a different name, if we have one configured
|
283 |
RunTest(qa_instance.TestInstanceRenameAndBack, |
284 |
rename_source, rename_target) |
285 |
RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
|
286 |
rename_source, rename_target) |
287 |
|
288 |
RunTestIf(["instance-grow-disk"], qa_instance.TestInstanceGrowDisk, instance)
|
289 |
|
290 |
# and now start the instance again
|
291 |
RunTestIf(DOWN_TESTS, qa_instance.TestInstanceStartup, instance) |
292 |
|
293 |
RunTestIf("instance-reboot", qa_instance.TestInstanceReboot, instance)
|
294 |
|
295 |
RunTestIf("tags", qa_tags.TestInstanceTags, instance)
|
296 |
|
297 |
RunTestIf("cluster-verify", qa_cluster.TestClusterVerify)
|
298 |
|
299 |
RunTestIf("rapi", qa_rapi.TestInstance, instance)
|
300 |
|
301 |
# Lists instances, too
|
302 |
RunTestIf("node-list", qa_node.TestNodeList)
|
303 |
|
304 |
# Some jobs have been run, let's test listing them
|
305 |
RunTestIf("job-list", qa_job.TestJobList)
|
306 |
|
307 |
|
308 |
def RunCommonNodeTests(): |
309 |
"""Run a few common node tests.
|
310 |
|
311 |
"""
|
312 |
RunTestIf("node-volumes", qa_node.TestNodeVolumes)
|
313 |
RunTestIf("node-storage", qa_node.TestNodeStorage)
|
314 |
RunTestIf("node-oob", qa_node.TestOutOfBand)
|
315 |
|
316 |
|
317 |
def RunGroupListTests(): |
318 |
"""Run tests for listing node groups.
|
319 |
|
320 |
"""
|
321 |
RunTestIf("group-list", qa_group.TestGroupList)
|
322 |
RunTestIf("group-list", qa_group.TestGroupListFields)
|
323 |
|
324 |
|
325 |
def RunGroupRwTests(): |
326 |
"""Run tests for adding/removing/renaming groups.
|
327 |
|
328 |
"""
|
329 |
RunTestIf("group-rwops", qa_group.TestGroupAddRemoveRename)
|
330 |
RunTestIf("group-rwops", qa_group.TestGroupAddWithOptions)
|
331 |
RunTestIf("group-rwops", qa_group.TestGroupModify)
|
332 |
RunTestIf(["group-rwops", "rapi"], qa_rapi.TestRapiNodeGroups) |
333 |
RunTestIf(["group-rwops", "tags"], qa_tags.TestGroupTags, |
334 |
qa_group.GetDefaultGroup()) |
335 |
|
336 |
|
337 |
def RunExportImportTests(instance, pnode, snode): |
338 |
"""Tries to export and import the instance.
|
339 |
|
340 |
@param pnode: current primary node of the instance
|
341 |
@param snode: current secondary node of the instance, if any,
|
342 |
otherwise None
|
343 |
|
344 |
"""
|
345 |
if qa_config.TestEnabled("instance-export"): |
346 |
RunTest(qa_instance.TestInstanceExportNoTarget, instance) |
347 |
|
348 |
expnode = qa_config.AcquireNode(exclude=pnode) |
349 |
try:
|
350 |
name = RunTest(qa_instance.TestInstanceExport, instance, expnode) |
351 |
|
352 |
RunTest(qa_instance.TestBackupList, expnode) |
353 |
|
354 |
if qa_config.TestEnabled("instance-import"): |
355 |
newinst = qa_config.AcquireInstance() |
356 |
try:
|
357 |
RunTest(qa_instance.TestInstanceImport, newinst, pnode, |
358 |
expnode, name) |
359 |
RunTest(qa_instance.TestInstanceRemove, newinst) |
360 |
finally:
|
361 |
qa_config.ReleaseInstance(newinst) |
362 |
finally:
|
363 |
qa_config.ReleaseNode(expnode) |
364 |
|
365 |
if qa_config.TestEnabled(["rapi", "inter-cluster-instance-move"]): |
366 |
newinst = qa_config.AcquireInstance() |
367 |
try:
|
368 |
if snode is None: |
369 |
excl = [pnode] |
370 |
else:
|
371 |
excl = [pnode, snode] |
372 |
tnode = qa_config.AcquireNode(exclude=excl) |
373 |
try:
|
374 |
RunTest(qa_rapi.TestInterClusterInstanceMove, instance, newinst, |
375 |
pnode, snode, tnode) |
376 |
finally:
|
377 |
qa_config.ReleaseNode(tnode) |
378 |
finally:
|
379 |
qa_config.ReleaseInstance(newinst) |
380 |
|
381 |
|
382 |
def RunDaemonTests(instance): |
383 |
"""Test the ganeti-watcher script.
|
384 |
|
385 |
"""
|
386 |
RunTest(qa_daemon.TestPauseWatcher) |
387 |
|
388 |
RunTestIf("instance-automatic-restart",
|
389 |
qa_daemon.TestInstanceAutomaticRestart, instance) |
390 |
RunTestIf("instance-consecutive-failures",
|
391 |
qa_daemon.TestInstanceConsecutiveFailures, instance) |
392 |
|
393 |
RunTest(qa_daemon.TestResumeWatcher) |
394 |
|
395 |
|
396 |
def RunHardwareFailureTests(instance, pnode, snode): |
397 |
"""Test cluster internal hardware failure recovery.
|
398 |
|
399 |
"""
|
400 |
RunTestIf("instance-failover", qa_instance.TestInstanceFailover, instance)
|
401 |
RunTestIf(["instance-failover", "rapi"], |
402 |
qa_rapi.TestRapiInstanceFailover, instance) |
403 |
|
404 |
RunTestIf("instance-migrate", qa_instance.TestInstanceMigrate, instance)
|
405 |
RunTestIf(["instance-migrate", "rapi"], |
406 |
qa_rapi.TestRapiInstanceMigrate, instance) |
407 |
|
408 |
if qa_config.TestEnabled("instance-replace-disks"): |
409 |
othernode = qa_config.AcquireNode(exclude=[pnode, snode]) |
410 |
try:
|
411 |
RunTestIf("rapi", qa_rapi.TestRapiInstanceReplaceDisks, instance)
|
412 |
RunTest(qa_instance.TestReplaceDisks, |
413 |
instance, pnode, snode, othernode) |
414 |
finally:
|
415 |
qa_config.ReleaseNode(othernode) |
416 |
|
417 |
RunTestIf("node-evacuate", qa_node.TestNodeEvacuate, pnode, snode)
|
418 |
|
419 |
RunTestIf("node-failover", qa_node.TestNodeFailover, pnode, snode)
|
420 |
|
421 |
RunTestIf("instance-disk-failure", qa_instance.TestInstanceMasterDiskFailure,
|
422 |
instance, pnode, snode) |
423 |
RunTestIf("instance-disk-failure",
|
424 |
qa_instance.TestInstanceSecondaryDiskFailure, instance, |
425 |
pnode, snode) |
426 |
|
427 |
|
428 |
def RunQa(): |
429 |
"""Main QA body.
|
430 |
|
431 |
"""
|
432 |
rapi_user = "ganeti-qa"
|
433 |
rapi_secret = utils.GenerateSecret() |
434 |
|
435 |
RunEnvTests() |
436 |
SetupCluster(rapi_user, rapi_secret) |
437 |
|
438 |
# Load RAPI certificate
|
439 |
qa_rapi.Setup(rapi_user, rapi_secret) |
440 |
|
441 |
RunClusterTests() |
442 |
RunOsTests() |
443 |
|
444 |
RunTestIf("tags", qa_tags.TestClusterTags)
|
445 |
|
446 |
RunCommonNodeTests() |
447 |
RunGroupListTests() |
448 |
RunGroupRwTests() |
449 |
|
450 |
pnode = qa_config.AcquireNode(exclude=qa_config.GetMasterNode()) |
451 |
try:
|
452 |
RunTestIf("node-readd", qa_node.TestNodeReadd, pnode)
|
453 |
RunTestIf("node-modify", qa_node.TestNodeModify, pnode)
|
454 |
RunTestIf("delay", qa_cluster.TestDelay, pnode)
|
455 |
finally:
|
456 |
qa_config.ReleaseNode(pnode) |
457 |
|
458 |
pnode = qa_config.AcquireNode() |
459 |
try:
|
460 |
RunTestIf("tags", qa_tags.TestNodeTags, pnode)
|
461 |
|
462 |
if qa_rapi.Enabled():
|
463 |
RunTest(qa_rapi.TestNode, pnode) |
464 |
|
465 |
if qa_config.TestEnabled("instance-add-plain-disk"): |
466 |
for use_client in [True, False]: |
467 |
rapi_instance = RunTest(qa_rapi.TestRapiInstanceAdd, pnode, |
468 |
use_client) |
469 |
RunCommonInstanceTests(rapi_instance) |
470 |
RunTest(qa_rapi.TestRapiInstanceRemove, rapi_instance, use_client) |
471 |
del rapi_instance
|
472 |
|
473 |
if qa_config.TestEnabled("instance-add-plain-disk"): |
474 |
instance = RunTest(qa_instance.TestInstanceAddWithPlainDisk, pnode) |
475 |
RunCommonInstanceTests(instance) |
476 |
RunGroupListTests() |
477 |
RunTestIf("cluster-epo", qa_cluster.TestClusterEpo)
|
478 |
RunExportImportTests(instance, pnode, None)
|
479 |
RunDaemonTests(instance) |
480 |
RunRepairDiskSizes() |
481 |
RunTest(qa_instance.TestInstanceRemove, instance) |
482 |
del instance
|
483 |
|
484 |
multinode_tests = [ |
485 |
("instance-add-drbd-disk",
|
486 |
qa_instance.TestInstanceAddWithDrbdDisk), |
487 |
] |
488 |
|
489 |
for name, func in multinode_tests: |
490 |
if qa_config.TestEnabled(name):
|
491 |
snode = qa_config.AcquireNode(exclude=pnode) |
492 |
try:
|
493 |
instance = RunTest(func, pnode, snode) |
494 |
RunCommonInstanceTests(instance) |
495 |
RunGroupListTests() |
496 |
RunTest(qa_group.TestAssignNodesIncludingSplit, |
497 |
constants.INITIAL_NODE_GROUP_NAME, |
498 |
pnode["primary"], snode["primary"]) |
499 |
if qa_config.TestEnabled("instance-convert-disk"): |
500 |
RunTest(qa_instance.TestInstanceShutdown, instance) |
501 |
RunTest(qa_instance.TestInstanceConvertDisk, instance, snode) |
502 |
RunTest(qa_instance.TestInstanceStartup, instance) |
503 |
RunExportImportTests(instance, pnode, snode) |
504 |
RunHardwareFailureTests(instance, pnode, snode) |
505 |
RunRepairDiskSizes() |
506 |
RunTest(qa_instance.TestInstanceRemove, instance) |
507 |
del instance
|
508 |
finally:
|
509 |
qa_config.ReleaseNode(snode) |
510 |
|
511 |
if qa_config.TestEnabled(["instance-add-plain-disk", "instance-export"]): |
512 |
for shutdown in [False, True]: |
513 |
instance = RunTest(qa_instance.TestInstanceAddWithPlainDisk, pnode) |
514 |
expnode = qa_config.AcquireNode(exclude=pnode) |
515 |
try:
|
516 |
if shutdown:
|
517 |
# Stop instance before exporting and removing it
|
518 |
RunTest(qa_instance.TestInstanceShutdown, instance) |
519 |
RunTest(qa_instance.TestInstanceExportWithRemove, instance, expnode) |
520 |
RunTest(qa_instance.TestBackupList, expnode) |
521 |
finally:
|
522 |
qa_config.ReleaseNode(expnode) |
523 |
del expnode
|
524 |
del instance
|
525 |
|
526 |
finally:
|
527 |
qa_config.ReleaseNode(pnode) |
528 |
|
529 |
RunTestIf("create-cluster", qa_node.TestNodeRemoveAll)
|
530 |
|
531 |
RunTestIf("cluster-destroy", qa_cluster.TestClusterDestroy)
|
532 |
|
533 |
|
534 |
@rapi.client.UsesRapiClient
|
535 |
def main(): |
536 |
"""Main program.
|
537 |
|
538 |
"""
|
539 |
parser = optparse.OptionParser(usage="%prog [options] <config-file>")
|
540 |
parser.add_option("--yes-do-it", dest="yes_do_it", |
541 |
action="store_true",
|
542 |
help="Really execute the tests")
|
543 |
(qa_config.options, args) = parser.parse_args() |
544 |
|
545 |
if len(args) == 1: |
546 |
(config_file, ) = args |
547 |
else:
|
548 |
parser.error("Wrong number of arguments.")
|
549 |
|
550 |
if not qa_config.options.yes_do_it: |
551 |
print ("Executing this script irreversibly destroys any Ganeti\n" |
552 |
"configuration on all nodes involved. If you really want\n"
|
553 |
"to start testing, supply the --yes-do-it option.")
|
554 |
sys.exit(1)
|
555 |
|
556 |
qa_config.Load(config_file) |
557 |
|
558 |
qa_utils.StartMultiplexer(qa_config.GetMasterNode()["primary"])
|
559 |
try:
|
560 |
RunQa() |
561 |
finally:
|
562 |
qa_utils.CloseMultiplexers() |
563 |
|
564 |
if __name__ == "__main__": |
565 |
main() |