kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: kvm@vger.kernel.org
Cc: Pekka Enberg <penberg@kernel.org>,
	Asias He <asias.hejun@gmail.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH 2/2] kvm tools: Improve "kvm setup" info and error messages
Date: Tue, 25 Oct 2011 15:10:53 +0300	[thread overview]
Message-ID: <1319544653-6670-3-git-send-email-penberg@kernel.org> (raw)
In-Reply-To: <1319544653-6670-1-git-send-email-penberg@kernel.org>

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 <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 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


      parent reply	other threads:[~2011-10-25 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25 12:10 [RFC/PATCH] kvm tools, bios: Don't include glibc headers Pekka Enberg
2011-10-25 12:10 ` [PATCH 1/2] kvm tools: Kill double slash from kvm__get_dir() Pekka Enberg
2011-10-25 12:10 ` Pekka Enberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319544653-6670-3-git-send-email-penberg@kernel.org \
    --to=penberg@kernel.org \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).