Revision 71dca138
b/lib/tools/burnin.py | ||
---|---|---|
41 | 41 |
from ganeti import pathutils |
42 | 42 |
|
43 | 43 |
from ganeti.confd import client as confd_client |
44 |
from ganeti.runtime import (GetClient) |
|
44 | 45 |
|
45 | 46 |
|
46 | 47 |
USAGE = ("\tburnin -o OS_NAME [options...] instance_name ...") |
... | ... | |
545 | 546 |
else: |
546 | 547 |
names = [] |
547 | 548 |
try: |
548 |
op = opcodes.OpNodeQuery(output_fields=["name", "offline", "drained"], |
|
549 |
names=names, use_locking=True) |
|
550 |
result = self.ExecOp(True, op) |
|
549 |
qcl = GetClient(query=True) |
|
550 |
result = qcl.QueryNodes(names, ["name", "offline", "drained"], False) |
|
551 | 551 |
except errors.GenericError, err: |
552 | 552 |
err_code, msg = cli.FormatError(err) |
553 | 553 |
Err(msg, exit_code=err_code) |
554 |
finally: |
|
555 |
qcl.Close() |
|
554 | 556 |
self.nodes = [data[0] for data in result if not (data[1] or data[2])] |
555 | 557 |
|
556 | 558 |
op_diagnose = opcodes.OpOsDiagnose(output_fields=["name", |
... | ... | |
748 | 750 |
islice(cycle(self.nodes), 2, None), |
749 | 751 |
self.instances) |
750 | 752 |
|
753 |
qcl = GetClient(query=True) |
|
751 | 754 |
for pnode, snode, enode, instance in mytor: |
752 | 755 |
Log("instance %s", instance, indent=1) |
753 | 756 |
# read the full name of the instance |
754 |
nam_op = opcodes.OpInstanceQuery(output_fields=["name"], |
|
755 |
names=[instance], use_locking=True) |
|
756 |
full_name = self.ExecOp(False, nam_op)[0][0] |
|
757 |
full_name = qcl.QueryInstances([instance], ["name"], False) |
|
757 | 758 |
|
758 | 759 |
if self.opts.iallocator: |
759 | 760 |
pnode = snode = None |
... | ... | |
804 | 805 |
Log(import_log_msg, indent=2) |
805 | 806 |
Log("remove export", indent=2) |
806 | 807 |
self.ExecOrQueue(instance, [exp_op, rem_op, imp_op, erem_op]) |
808 |
qcl.Close() |
|
807 | 809 |
|
808 | 810 |
@staticmethod |
809 | 811 |
def StopInstanceOp(instance): |
Also available in: Unified diff