[PATCH 6/7] kvm tools: Modify 'kvm setup' parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux