From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: [PATCH 6/7] kvm tools: Modify 'kvm setup' parameters Date: Thu, 13 Oct 2011 11:32:45 +0200 Message-ID: <1318498366-7824-6-git-send-email-levinsasha928@gmail.com> References: <1318498366-7824-1-git-send-email-levinsasha928@gmail.com> Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, Sasha Levin To: penberg@cs.helsinki.fi Return-path: Received: from mail-bw0-f46.google.com ([209.85.214.46]:46808 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754269Ab1JMJdV (ORCPT ); Thu, 13 Oct 2011 05:33:21 -0400 Received: by mail-bw0-f46.google.com with SMTP id zt4so1179124bkb.19 for ; Thu, 13 Oct 2011 02:33:20 -0700 (PDT) In-Reply-To: <1318498366-7824-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: This patch makes the name as the default parameter, this makes usability easier since this is the only parameter available at the moment anyway. Suggested-by: Ingo Molnar Signed-off-by: Sasha Levin --- tools/kvm/builtin-setup.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c index a2e893c..4410653 100644 --- a/tools/kvm/builtin-setup.c +++ b/tools/kvm/builtin-setup.c @@ -25,13 +25,11 @@ static const char *instance_name; static const char * const setup_usage[] = { - "kvm setup [-n name]", + "kvm setup [name]", NULL }; static const struct option setup_options[] = { - OPT_GROUP("General options:"), - OPT_STRING('n', "name", &instance_name, "name", "Instance name"), OPT_END() }; @@ -40,8 +38,12 @@ static void parse_setup_options(int argc, const char **argv) while (argc != 0) { argc = parse_options(argc, argv, setup_options, setup_usage, PARSE_OPT_STOP_AT_NON_OPTION); - if (argc != 0) + if (argc != 0 && instance_name) kvm_setup_help(); + else + instance_name = argv[0]; + argv++; + argc--; } } @@ -219,6 +221,8 @@ int kvm_cmd_setup(int argc, const char **argv, const char *prefix) pr_info("Your new rootfs named %s has been created.\n" "You can now start it by running 'kvm run -d %s'\n", instance_name, instance_name); + else + perror("Error creating rootfs"); return r; } -- 1.7.7