]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Modify 'kvm setup' parameters
authorSasha Levin <levinsasha928@gmail.com>
Thu, 13 Oct 2011 09:32:45 +0000 (11:32 +0200)
committerPekka Enberg <penberg@kernel.org>
Thu, 13 Oct 2011 16:39:00 +0000 (19:39 +0300)
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 <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-setup.c

index a2e893ce922d92110b7fa2234e4a3ceb811fde2c..4410653263415f37035643ed8963b6b1ed03cd0e 100644 (file)
 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;
 }