From b7329c9c00529f994669cc47083835952cd37690 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 10 Sep 2008 17:06:39 +0000 Subject: [PATCH] Do not use jobs in gnt-instance _ExpandNames() In the gnt-instance script, _ExpandNames() uses jobs to query instance names. This is not optimal, so we change it to use queries. Reviewed-by: ultrotter --- scripts/gnt-instance | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/gnt-instance b/scripts/gnt-instance index de4421827..80416d583 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -69,8 +69,8 @@ def _ExpandMultiNames(mode, names): if mode == _SHUTDOWN_CLUSTER: if names: raise errors.OpPrereqError("Cluster filter mode takes no arguments") - op = opcodes.OpQueryInstances(output_fields=["name"], names=[]) - idata = SubmitOpCode(op) + client = GetClient() + idata = client.QueryInstances([], ["name"]) inames = [row[0] for row in idata] elif mode in (_SHUTDOWN_NODES_BOTH, @@ -78,9 +78,8 @@ def _ExpandMultiNames(mode, names): _SHUTDOWN_NODES_SEC): if not names: raise errors.OpPrereqError("No node names passed") - op = opcodes.OpQueryNodes(output_fields=["name", "pinst_list", - "sinst_list"], names=names) - ndata = SubmitOpCode(op) + client = GetClient() + ndata = client.QueryNodes(names, ["name", "pinst_list", "sinst_list"]) ipri = [row[1] for row in ndata] pri_names = list(itertools.chain(*ipri)) isec = [row[2] for row in ndata] @@ -97,8 +96,8 @@ def _ExpandMultiNames(mode, names): elif mode == _SHUTDOWN_INSTANCES: if not names: raise errors.OpPrereqError("No instance names passed") - op = opcodes.OpQueryInstances(output_fields=["name"], names=names) - idata = SubmitOpCode(op) + client = GetClient() + idata = client.QueryInstances(names, ["name"]) inames = [row[0] for row in idata] else: -- GitLab