kvm tools: Attach default 'root=' only if required

This patch fixes a case where the 'root=' parameter was passed twice
when using virtio-9p root mode.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Sasha Levin
2015-06-01 16:39:47 +01:00
committed by Will Deacon
parent ea98b68eb1
commit ff42603fdb
+3 -4
View File
@@ -739,11 +739,10 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
strlcat(real_cmdline, " init=/bin/sh ", sizeof(real_cmdline));
}
if (!strstr(real_cmdline, "root="))
strlcat(real_cmdline, " root=/dev/vda rw ", sizeof(real_cmdline));
if (using_rootfs)
strcat(real_cmdline, " root=/dev/root rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p");
strcat(real_cmdline, " root=/dev/root rw rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p");
else if (!strstr(real_cmdline, "root="))
strlcat(real_cmdline, " root=/dev/vda rw ", sizeof(real_cmdline));
if (image_count) {
kvm->nr_disks = image_count;