]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: avoid adding "" in smbios arguments
authorEric Blake <eblake@redhat.com>
Wed, 1 Dec 2010 23:50:59 +0000 (16:50 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 7 Dec 2010 15:35:05 +0000 (08:35 -0700)
The log lists things like -smbios type=1,vendor="Red Hat", which
is great for shell parsing, but not so great when you realize that
execve() then passes those literal "" on as part of the command
line argument, such that qemu sets SMBIOS with extra literal quotes.

The eventual addition of virCommand is needed before we have the API
to shell-quote a string representation of a command line, so that the
log can still be pasted into a shell, but without inserting extra
bytes into the execve() arguments.

* src/qemu/qemu_conf.c (qemuBuildSmbiosBiosStr)
(qemuBuildSmbiosSystemStr): Qemu doesn't like quotes around uuid
arguments, and the remaining quotes are passed literally to
smbios, making <smbios mode='host'/> inaccurate.  Removing the
quotes makes the log harder to parse, but that can be fixed later
with virCommand improvements.
* tests/qemuxml2argvdata/qemuxml2argv-smbios.args: 'Fix' test; it
will need fixing again once virCommand learns how to shell-quote a
potential command line.

src/qemu/qemu_conf.c
tests/qemuxml2argvdata/qemuxml2argv-smbios.args

index 3e47e4f97f3101691ddb631a326b5c559a877bc1..69f3652a698e35e996ef883cd9f6f1d67dcb5b6a 100644 (file)
@@ -3622,16 +3622,16 @@ static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def)
 
     /* 0:Vendor */
     if (def->bios_vendor)
-        virBufferVSprintf(&buf, ",vendor=\"%s\"", def->bios_vendor);
+        virBufferVSprintf(&buf, ",vendor=%s", def->bios_vendor);
     /* 0:BIOS Version */
     if (def->bios_version)
-        virBufferVSprintf(&buf, ",version=\"%s\"", def->bios_version);
+        virBufferVSprintf(&buf, ",version=%s", def->bios_version);
     /* 0:BIOS Release Date */
     if (def->bios_date)
-        virBufferVSprintf(&buf, ",date=\"%s\"", def->bios_date);
+        virBufferVSprintf(&buf, ",date=%s", def->bios_date);
     /* 0:System BIOS Major Release and 0:System BIOS Minor Release */
     if (def->bios_release)
-        virBufferVSprintf(&buf, ",release=\"%s\"", def->bios_release);
+        virBufferVSprintf(&buf, ",release=%s", def->bios_release);
 
     if (virBufferError(&buf)) {
         virReportOOMError();
@@ -3658,23 +3658,23 @@ static char *qemuBuildSmbiosSystemStr(virSysinfoDefPtr def)
 
     /* 1:Manufacturer */
     if (def->system_manufacturer)
-        virBufferVSprintf(&buf, ",manufacturer=\"%s\"",
+        virBufferVSprintf(&buf, ",manufacturer=%s",
                           def->system_manufacturer);
      /* 1:Product Name */
     if (def->system_product)
-        virBufferVSprintf(&buf, ",product=\"%s\"", def->system_product);
+        virBufferVSprintf(&buf, ",product=%s", def->system_product);
     /* 1:Version */
     if (def->system_version)
-        virBufferVSprintf(&buf, ",version=\"%s\"", def->system_version);
+        virBufferVSprintf(&buf, ",version=%s", def->system_version);
     /* 1:Serial Number */
     if (def->system_serial)
-        virBufferVSprintf(&buf, ",serial=\"%s\"", def->system_serial);
+        virBufferVSprintf(&buf, ",serial=%s", def->system_serial);
     /* 1:UUID */
     if (def->system_uuid)
-        virBufferVSprintf(&buf, ",uuid=\"%s\"", def->system_uuid);
+        virBufferVSprintf(&buf, ",uuid=%s", def->system_uuid);
     /* 1:SKU Number */
     if (def->system_sku)
-        virBufferVSprintf(&buf, ",sku=\"%s\"", def->system_sku);
+        virBufferVSprintf(&buf, ",sku=%s", def->system_sku);
 
     if (virBufferError(&buf)) {
         virReportOOMError();
index d5bd2892a99c9eff969dc408e176df487fb51058..bd3ede4310b8387997a4bd92741961fe5298fea0 100644 (file)
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -smbios type=0,vendor="QEmu/KVM",version="0.13" -smbios type=1,manufacturer="Fedora",product="Virt-Manager",version="0.8.2-3.fc14",serial="32dfcb37-5af1-552b-357c-be8c3aa38310",uuid="c7a5fdbd-edaf-9455-926a-d65c16db1809" -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -smbios type=0,vendor=QEmu/KVM,version=0.13 -smbios type=1,manufacturer=Fedora,product=Virt-Manager,version=0.8.2-3.fc14,serial=32dfcb37-5af1-552b-357c-be8c3aa38310,uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb