kvm tools: Enable kernel DHCP autoconf by default
PATCH 1/1 kvm tools: Enable kernel DHCP autoconf by default
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
--- tools/kvm/README | 3 +++ tools/kvm/builtin-run.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-)
tools/kvm/README +3 -0
@@ -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:
tools/kvm/builtin-run.c +1 -1
@@ -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=" ))
Signature · 1 line
1.7.0.4
Quoted 39 lines · Pekka Enberg
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=yCc Asias He <[email protected]>Cc Avi Kivity <[email protected]>Cc Cyrill Gorcunov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Linus Torvalds <[email protected]>Cc Prasad Joshi <[email protected]>Cc Sasha Levin <[email protected]>Signed-off-by Pekka Enberg <[email protected]>--- tools/kvm/README | 3 +++ tools/kvm/builtin-run.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-)tools/kvm/README +3
-0@@ -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:tools/kvm/builtin-run.c +0
-0
tools/kvm/builtin-run.c int kvm_cmd_run(int argc, const char **argv, const char *prefix) · line 607
Quoted 8 lines
tools/kvm/builtin-run.c +1
-1@@ -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.
Signature · 2 lines
Best Regards, Asias He
Quoted 52 lines · Asias He
Quoted 39 lines · Pekka Enberg
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=yCc Asias He <[email protected]>Cc Avi Kivity <[email protected]>Cc Cyrill Gorcunov <[email protected]>Cc Ingo Molnar <[email protected]>Cc Linus Torvalds <[email protected]>Cc Prasad Joshi <[email protected]>Cc Sasha Levin <[email protected]>Signed-off-by Pekka Enberg <[email protected]>--- tools/kvm/README | 3 +++ tools/kvm/builtin-run.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-)tools/kvm/README +3
-0@@ -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:tools/kvm/builtin-run.c +0
-0tools/kvm/builtin-run.c int kvm_cmd_run(int argc, const char **argv, const char *prefix) · line 607
Quoted 8 lines
tools/kvm/builtin-run.c +1
-1@@ -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.
Quoted 12 lines
[ 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!