* [PATCH] kvm tools: Enable kernel DHCP autoconf by default
@ 2011-08-09 17:53 Pekka Enberg
2011-08-10 0:03 ` Asias He
0 siblings, 1 reply; 3+ messages in thread
From: Pekka Enberg @ 2011-08-09 17:53 UTC (permalink / raw)
To: kvm
Cc: Pekka Enberg, Asias He, Avi Kivity, Cyrill Gorcunov, Ingo Molnar,
Linus Torvalds, Prasad Joshi, Sasha Levin
As we boot to '/bin/sh' by default, enable kernel DHCP autoconfiguration too.
The guest kernel needs to be configured with the following configuration
options:
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
Cc: Asias He <asias.hejun@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
tools/kvm/README | 3 +++
tools/kvm/builtin-run.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/kvm/README b/tools/kvm/README
index 5b85461..2cf9364 100644
--- a/tools/kvm/README
+++ b/tools/kvm/README
@@ -70,6 +70,9 @@ linux-0.2.img.bz2
- For virtio-rng device (--rng):
CONFIG_HW_RANDOM_VIRTIO=y
+ - For kernel DHCP autoconf (when booting to /bin/sh):
+ CONFIG_IP_PNP=y
+ CONFIG_IP_PNP_DHCP=y
5. And finally, launch the hypervisor:
diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index fa5de27..af7f59c 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -601,7 +601,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
using_rootfs = 1;
if (!strstr(real_cmdline, "init="))
- strlcat(real_cmdline, " init=/bin/sh ", sizeof(real_cmdline));
+ strlcat(real_cmdline, " init=/bin/sh ip=dhcp ", sizeof(real_cmdline));
}
if (!strstr(real_cmdline, "root="))
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm tools: Enable kernel DHCP autoconf by default
2011-08-09 17:53 [PATCH] kvm tools: Enable kernel DHCP autoconf by default Pekka Enberg
@ 2011-08-10 0:03 ` Asias He
2011-08-10 5:00 ` Pekka Enberg
0 siblings, 1 reply; 3+ messages in thread
From: Asias He @ 2011-08-10 0:03 UTC (permalink / raw)
To: Pekka Enberg
Cc: kvm, Avi Kivity, Cyrill Gorcunov, Ingo Molnar, Linus Torvalds,
Prasad Joshi, Sasha Levin
On 08/10/2011 01:53 AM, Pekka Enberg wrote:
> As we boot to '/bin/sh' by default, enable kernel DHCP autoconfiguration too.
> The guest kernel needs to be configured with the following configuration
> options:
>
> CONFIG_IP_PNP=y
> CONFIG_IP_PNP_DHCP=y
>
> Cc: Asias He <asias.hejun@gmail.com>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Prasad Joshi <prasadjoshi124@gmail.com>
> Cc: Sasha Levin <levinsasha928@gmail.com>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>
> ---
> tools/kvm/README | 3 +++
> tools/kvm/builtin-run.c | 2 +-
> 2 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/tools/kvm/README b/tools/kvm/README
> index 5b85461..2cf9364 100644
> --- a/tools/kvm/README
> +++ b/tools/kvm/README
> @@ -70,6 +70,9 @@ linux-0.2.img.bz2
> - For virtio-rng device (--rng):
> CONFIG_HW_RANDOM_VIRTIO=y
>
> + - For kernel DHCP autoconf (when booting to /bin/sh):
> + CONFIG_IP_PNP=y
> + CONFIG_IP_PNP_DHCP=y
>
> 5. And finally, launch the hypervisor:
>
> diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
> index fa5de27..af7f59c 100644
> --- a/tools/kvm/builtin-run.c
> +++ b/tools/kvm/builtin-run.c
> @@ -601,7 +601,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
> using_rootfs = 1;
>
> if (!strstr(real_cmdline, "init="))
> - strlcat(real_cmdline, " init=/bin/sh ", sizeof(real_cmdline));
> + strlcat(real_cmdline, " init=/bin/sh ip=dhcp ", sizeof(real_cmdline));
> }
>
> if (!strstr(real_cmdline, "root="))
'ip=dhcp' makes kernel try to use nfs as root fs which results in a long
time 'wait and fail' and finally fallback to 9p as root fs.
[ 1.688000] Sending DHCP requests ., OK
[ 1.695000] IP-Config: Got DHCP answer from 192.168.33.1, my address
is 192.168.33.15
[ 1.699000] IP-Config: Complete:
[ 1.700000] device=eth0, addr=192.168.33.15, mask=255.255.255.0,
gw=192.168.33.1,
[ 1.703000] host=192.168.33.15, domain=stu.buaa.edu.cn,
nis-domain=(none),
[ 1.706000] bootserver=192.168.33.1, rootserver=192.168.33.1,
rootpath=
[ 36.769000] VFS: Unable to mount root fs via NFS, trying floppy.
[ 36.771000] VFS: Mounted root (9p filesystem) on device 0:14.
--
Best Regards,
Asias He
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm tools: Enable kernel DHCP autoconf by default
2011-08-10 0:03 ` Asias He
@ 2011-08-10 5:00 ` Pekka Enberg
0 siblings, 0 replies; 3+ messages in thread
From: Pekka Enberg @ 2011-08-10 5:00 UTC (permalink / raw)
To: Asias He
Cc: kvm, Avi Kivity, Cyrill Gorcunov, Ingo Molnar, Linus Torvalds,
Prasad Joshi, Sasha Levin
On Wed, 10 Aug 2011, Asias He wrote:
> On 08/10/2011 01:53 AM, Pekka Enberg wrote:
>> As we boot to '/bin/sh' by default, enable kernel DHCP autoconfiguration too.
>> The guest kernel needs to be configured with the following configuration
>> options:
>>
>> CONFIG_IP_PNP=y
>> CONFIG_IP_PNP_DHCP=y
>>
>> Cc: Asias He <asias.hejun@gmail.com>
>> Cc: Avi Kivity <avi@redhat.com>
>> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
>> Cc: Ingo Molnar <mingo@elte.hu>
>> Cc: Linus Torvalds <torvalds@linux-foundation.org>
>> Cc: Prasad Joshi <prasadjoshi124@gmail.com>
>> Cc: Sasha Levin <levinsasha928@gmail.com>
>> Signed-off-by: Pekka Enberg <penberg@kernel.org>
>> ---
>> tools/kvm/README | 3 +++
>> tools/kvm/builtin-run.c | 2 +-
>> 2 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/tools/kvm/README b/tools/kvm/README
>> index 5b85461..2cf9364 100644
>> --- a/tools/kvm/README
>> +++ b/tools/kvm/README
>> @@ -70,6 +70,9 @@ linux-0.2.img.bz2
>> - For virtio-rng device (--rng):
>> CONFIG_HW_RANDOM_VIRTIO=y
>>
>> + - For kernel DHCP autoconf (when booting to /bin/sh):
>> + CONFIG_IP_PNP=y
>> + CONFIG_IP_PNP_DHCP=y
>>
>> 5. And finally, launch the hypervisor:
>>
>> diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
>> index fa5de27..af7f59c 100644
>> --- a/tools/kvm/builtin-run.c
>> +++ b/tools/kvm/builtin-run.c
>> @@ -601,7 +601,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>> using_rootfs = 1;
>>
>> if (!strstr(real_cmdline, "init="))
>> - strlcat(real_cmdline, " init=/bin/sh ", sizeof(real_cmdline));
>> + strlcat(real_cmdline, " init=/bin/sh ip=dhcp ", sizeof(real_cmdline));
>> }
>>
>> if (!strstr(real_cmdline, "root="))
>
> 'ip=dhcp' makes kernel try to use nfs as root fs which results in a long
> time 'wait and fail' and finally fallback to 9p as root fs.
>
> [ 1.688000] Sending DHCP requests ., OK
> [ 1.695000] IP-Config: Got DHCP answer from 192.168.33.1, my address
> is 192.168.33.15
> [ 1.699000] IP-Config: Complete:
> [ 1.700000] device=eth0, addr=192.168.33.15, mask=255.255.255.0,
> gw=192.168.33.1,
> [ 1.703000] host=192.168.33.15, domain=stu.buaa.edu.cn,
> nis-domain=(none),
> [ 1.706000] bootserver=192.168.33.1, rootserver=192.168.33.1,
> rootpath=
> [ 36.769000] VFS: Unable to mount root fs via NFS, trying floppy.
> [ 36.771000] VFS: Mounted root (9p filesystem) on device 0:14.
I reverted the patch for now. Thanks, Asias!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-10 5:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-09 17:53 [PATCH] kvm tools: Enable kernel DHCP autoconf by default Pekka Enberg
2011-08-10 0:03 ` Asias He
2011-08-10 5:00 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox