[PATCH] qemu: Add quotes to kernel command line of direct kernel boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When passing kernel command line arguments, it is possible to have
spaces. The arguments should be protected in qoutes.

In http://libvirt.org/formatdomain.html "direct kernel boot" section,
there is an example.
  ...
  <os>
    <type>hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <kernel>/root/f8-i386-vmlinuz</kernel>
    <initrd>/root/f8-i386-initrd</initrd>
    <cmdline>console=ttyS0 ks=http://example.com/f8-i386/os/</cmdline>
  </os>
  ...
If the contents in <cmdline> are passed as-is to qemu, then qemu will see
  qemu ... -append console=ttyS0 ks=http://example.com/f8-i386/os/ ...
It must be quoted, so let qemu see
  qemu ... -append "console=ttyS0 ks=http://example.com/f8-i386/os/"; ...

Signed-off-by: Zhou Zheng Sheng <zhshzhou@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8c32a4d..80b562d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4849,7 +4849,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (def->os.initrd)
             virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
         if (def->os.cmdline)
-            virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
+            virCommandAddArgList(cmd, "-append", "\"", def->os.cmdline, "\"", NULL);
     } else {
         virCommandAddArgList(cmd, "-bootloader", def->os.bootloader, NULL);
     }

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]