From: Ingo Molnar Subject: Re: [PATCH V4] kvm tool: Use the root partition of the host to boot the guest machine Date: Tue, 19 Apr 2011 16:38:43 +0200 Message-ID: <20110419143843.GA28605@elte.hu> References: <1303223344-3515-1-git-send-email-prasadjoshi124@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, penberg@kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, levinsasha928@gmail.com, chaitanyakulkarni15@gmail.com To: Prasad Joshi Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:39590 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752464Ab1DSOiy (ORCPT ); Tue, 19 Apr 2011 10:38:54 -0400 Content-Disposition: inline In-Reply-To: <1303223344-3515-1-git-send-email-prasadjoshi124@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: * Prasad Joshi wrote: > The kvm run command should automatically pickup the image file to boot if one is > not explicitly specified. > > Changes since V1: > - Deallocate variable 'line' when fopen(/proc/mounts) fails > > Changes since V2: > - Instead of searching from /proc/mounts, use the device file /dev/root to > detect the device file for root file system > - Added a helper function get_host_image() to return the image to be used to > boot the virtual machine. > > Changes since V3: > - The link '/dev/root' might be missing on some of the systems. Switched back > to using /proc/mounts file. > - Some simple reformatting > > Signed-off-by: Prasad Joshi > --- > tools/kvm/kvm-run.c | 109 +++++++++++++++++++++++++++++++++++++++++++++----- > 1 files changed, 98 insertions(+), 11 deletions(-) Looks good here, with your patch applied 'kvm run' will now boot host userspace with zero configuration needed (!), when there's a bzImage built in that kernel tree: aldebaran:~/linux/linux/tools/kvm> ./kvm run [...] Welcome to Fedora release 16 (Rawhide)! Tested-by: Ingo Molnar I noticed two quirks: 1) i mentioned this earlier, 'kvm run' will display a lengthy help screen or will just run the bzImage - depending on whether the file is present. Assymetric tool behavior like that is not very consistent - i'd suggest to print an intermediate help screen instead: ./kvm run No kernel image found - please see 'kvm run --help' for more options This informs the user of two things: a) that it tried to find a kernel image but failed to find it b) how to get the larger help text. 2) I get this: Warning: Unable to open /dev/net/tun This is a meaningless error message to the user. What is a '/dev/net/tun' and why does the user care? A much better error message would be something like: Info: Tried to activate transparent guest networking but was unable to open /dev/net/tun See "kvm run --help" about networking setup details. Thanks, Ingo