]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Attach default 'root=' only if required
authorSasha Levin <levinsasha928@gmail.com>
Mon, 5 Sep 2011 23:23:53 +0000 (02:23 +0300)
committerPekka Enberg <penberg@kernel.org>
Tue, 6 Sep 2011 17:11:09 +0000 (20:11 +0300)
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>
tools/kvm/builtin-run.c

index b9efde2006e6cf3ed5a4cb7bf2f560dfa803d77e..ef1a3585abe1f008bf10112f80f9dc28d9f97fcb 100644 (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;