Revision 3ecf6786 testing/ganeti.qa.py
b/testing/ganeti.qa.py | ||
---|---|---|
94 | 94 |
|
95 | 95 |
""" |
96 | 96 |
if not first == second: |
97 |
raise Error, (msg or '%r == %r' % (first, second))
|
|
97 |
raise Error(msg or '%r == %r' % (first, second)) |
|
98 | 98 |
|
99 | 99 |
|
100 | 100 |
def GetSSHCommand(node, cmd, strict=True): |
... | ... | |
174 | 174 |
del tmp_flt |
175 | 175 |
|
176 | 176 |
if len(instances) == 0: |
177 |
raise OutOfInstancesError, ("No instances left")
|
|
177 |
raise OutOfInstancesError("No instances left") |
|
178 | 178 |
|
179 | 179 |
inst = instances[0] |
180 | 180 |
inst['_used'] = True |
... | ... | |
203 | 203 |
del tmp_flt |
204 | 204 |
|
205 | 205 |
if len(nodes) == 0: |
206 |
raise OutOfNodesError, ("No nodes left")
|
|
206 |
raise OutOfNodesError("No nodes left") |
|
207 | 207 |
|
208 | 208 |
# Get node with least number of uses |
209 | 209 |
def compare(a, b): |
... | ... | |
229 | 229 |
|
230 | 230 |
""" |
231 | 231 |
if len(cfg['nodes']) < 1: |
232 |
raise Error, ("Need at least one node")
|
|
232 |
raise Error("Need at least one node") |
|
233 | 233 |
if len(cfg['instances']) < 1: |
234 |
raise Error, ("Need at least one instance")
|
|
234 |
raise Error("Need at least one instance") |
|
235 | 235 |
# TODO: Add more checks |
236 | 236 |
|
237 | 237 |
|
... | ... | |
322 | 322 |
print "Not enough instances, continuing anyway." |
323 | 323 |
|
324 | 324 |
if len(instances) < 1: |
325 |
raise Error, ("Burnin needs at least one instance")
|
|
325 |
raise Error("Burnin needs at least one instance") |
|
326 | 326 |
|
327 | 327 |
# Run burnin |
328 | 328 |
try: |
... | ... | |
368 | 368 |
# {{{ Node tests |
369 | 369 |
def _NodeAdd(node): |
370 | 370 |
if node.get('_added', False): |
371 |
raise Error, ("Node %s already in cluster" % node['primary'])
|
|
371 |
raise Error("Node %s already in cluster" % node['primary']) |
|
372 | 372 |
|
373 | 373 |
cmd = ['gnt-node', 'add'] |
374 | 374 |
if node.get('secondary', None): |
... | ... | |
529 | 529 |
break |
530 | 530 |
time.sleep(5) |
531 | 531 |
else: |
532 |
raise Error, ("xm shutdown failed")
|
|
532 |
raise Error("xm shutdown failed") |
|
533 | 533 |
|
534 | 534 |
|
535 | 535 |
def _ResetWatcherDaemon(node): |
... | ... | |
563 | 563 |
break |
564 | 564 |
time.sleep(15) |
565 | 565 |
else: |
566 |
raise Error, ("Daemon didn't restart instance in time")
|
|
566 |
raise Error("Daemon didn't restart instance in time") |
|
567 | 567 |
|
568 | 568 |
cmd = ['gnt-instance', 'info', inst_name] |
569 | 569 |
AssertEqual(StartSSH(master['primary'], |
... | ... | |
593 | 593 |
check_until = time.time() + 330 |
594 | 594 |
while time.time() <= check_until: |
595 | 595 |
if _InstanceRunning(node, inst_name): |
596 |
raise Error, ("Instance started when it shouldn't")
|
|
596 |
raise Error("Instance started when it shouldn't") |
|
597 | 597 |
time.sleep(30) |
598 | 598 |
|
599 | 599 |
cmd = ['gnt-instance', 'info', inst_name] |
... | ... | |
623 | 623 |
if len(args) == 1: |
624 | 624 |
config_file = args[0] |
625 | 625 |
else: |
626 |
raise SyntaxError, ("Exactly one configuration file is expected")
|
|
626 |
raise Error("Exactly one configuration file is expected")
|
|
627 | 627 |
|
628 | 628 |
if not options.yes_do_it: |
629 | 629 |
print ("Executing this script irreversibly destroys any Ganeti\n" |
Also available in: Unified diff