From: Pekka Enberg Subject: [PATCH 2/2] kvm tools: Improve "kvm setup" info and error messages Date: Tue, 25 Oct 2011 15:10:53 +0300 Message-ID: <1319544653-6670-3-git-send-email-penberg@kernel.org> References: <1319544653-6670-1-git-send-email-penberg@kernel.org> Cc: Pekka Enberg , Asias He , Cyrill Gorcunov , Ingo Molnar , Sasha Levin To: kvm@vger.kernel.org Return-path: Received: from mail-bw0-f46.google.com ([209.85.214.46]:54575 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756446Ab1JYMLJ (ORCPT ); Tue, 25 Oct 2011 08:11:09 -0400 Received: by mail-bw0-f46.google.com with SMTP id zt19so418637bkb.19 for ; Tue, 25 Oct 2011 05:11:09 -0700 (PDT) In-Reply-To: <1319544653-6670-1-git-send-email-penberg@kernel.org> Sender: kvm-owner@vger.kernel.org List-ID: This patch improves the output of 'kvm setup' as follows: [penberg@tux kvm]$ ./kvm setup kvm setup creates a new rootfs under /home/penberg//.kvm-tools/. This can be used later by the '-d' parameter of 'kvm run'. usage: kvm setup [name] [penberg@tux kvm]$ ./kvm setup test-box A new rootfs 'test-box' has been created in '/home/penberg//.kvm-tools/test-box'. You can now start it by running the following command: kvm run -d test-box [penberg@tux kvm]$ ./kvm setup test-box Unable to create rootfs in /home/penberg//.kvm-tools/test-box: File exists Cc: Asias He Cc: Cyrill Gorcunov Cc: Ingo Molnar Cc: Sasha Levin Signed-off-by: Pekka Enberg --- tools/kvm/builtin-setup.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c index dce1748..7deb0ed 100644 --- a/tools/kvm/builtin-setup.c +++ b/tools/kvm/builtin-setup.c @@ -46,8 +46,9 @@ static void parse_setup_options(int argc, const char **argv) void kvm_setup_help(void) { - printf("\nkvm setup creates a new rootfs and stores it under ~/.kvm-tools/ .\n" - "This can be used later by the '-d' parameter of 'kvm run'.\n"); + printf("\nkvm setup creates a new rootfs under %s.\n" + "This can be used later by the '-d' parameter of 'kvm run'.\n", + kvm__get_dir()); usage_with_options(setup_usage, setup_options); } @@ -215,11 +216,13 @@ int kvm_cmd_setup(int argc, const char **argv, const char *prefix) r = do_setup(instance_name); if (r == 0) - 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); + printf("A new rootfs '%s' has been created in '%s%s'.\n\n" + "You can now start it by running the following command:\n\n" + " kvm run -d %s\n", + instance_name, kvm__get_dir(), instance_name, instance_name); else - perror("Error creating rootfs"); + printf("Unable to create rootfs in %s%s: %s\n", + kvm__get_dir(), instance_name, strerror(errno)); return r; } -- 1.7.6.4