On 02/23/2015 04:39 AM, Michal Privoznik wrote: > There's been a bug report appearing on the qemu-devel list, that > libvirt is unable to pass spaces in disk serial number [1]. Not only > our RNG schema forbids that, the code is not prepared either. However, > with a bit of escaping (if needed) we can allow spaces there. > > 1: https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg04041.html > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > docs/schemas/domaincommon.rng | 2 +- > src/qemu/qemu_command.c | 5 ++-- > .../qemuxml2argvdata/qemuxml2argv-disk-serial.args | 6 +++++ > .../qemuxml2argvdata/qemuxml2argv-disk-serial.xml | 27 ++++++++++++++++++++++ > tests/qemuxml2argvtest.c | 5 ++++ > 5 files changed, 42 insertions(+), 3 deletions(-) > create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args > create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml > > @@ -3616,7 +3616,8 @@ qemuBuildDriveStr(virConnectPtr conn, > virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) { > if (qemuSafeSerialParamValue(disk->serial) < 0) > goto error; > - virBufferAsprintf(&opt, ",serial=%s", disk->serial); > + virBufferAddLit(&opt, ",serial="); > + virBufferEscapeShell(&opt, disk->serial); NACK to this hunk. We do NOT want shell escaping, because we are NOT invoking the shell directly. As proof: > } > > if (disk->cachemode) { > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args > new file mode 100644 > index 0000000..8b08cfb > --- /dev/null > +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args > @@ -0,0 +1,6 @@ > +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ > +/usr/libexec/qemu-kvm -S -M pc -cpu qemu32 -m 214 -smp 1 -nographic -nodefaults \ > +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ > +-drive 'file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-1,serial='\'' WD-WMAP9A966149'\''' \ your patch is passing the equivalent of serial="' WD-WMAP9a966149'" (including the single quotes, which were not present in your XML). The log file output will need shell escaping, but we already do that. Needs a v2. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list