From 220cde0b82152f245fec5bbd56370e829aebd231 Mon Sep 17 00:00:00 2001 From: Guido Trotter Date: Fri, 24 Apr 2009 16:13:29 +0000 Subject: [PATCH] gnt-instance info --all Don't show all instances info by default, but require --all to be passed for this time consuming operation. Reviewed-by: iustinp --- scripts/gnt-instance | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 9572e58..62a1f03 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -1084,6 +1084,15 @@ def ShowInstanceConfig(opts, args): @return: the desired exit code """ + if not args and not opts.show_all: + ToStderr("No instance selected." + " Please pass in --all if you want to query all instances.\n" + "Note that this can take a long time on a big cluster.") + return 1 + elif args and opts.show_all: + ToStderr("Cannot use --all if you specify instance names.") + return 1 + retcode = 0 op = opcodes.OpQueryInstanceData(instances=args, static=opts.static) result = SubmitOpCode(op) @@ -1360,7 +1369,11 @@ commands = { make_option("-s", "--static", dest="static", action="store_true", default=False, help="Only show configuration data, not runtime data"), - ], "[-s] [...]", + make_option("--all", dest="show_all", + default=False, action="store_true", + help="Show info on all instances on the cluster." + " This can take a long time to run, use wisely."), + ], "[-s] {--all | ...}", "Show information on the specified instance(s)"), 'list': (ListInstances, ARGS_ANY, [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT], -- 1.7.10.4