qemu: Escape commas for qemuBuildDriveDevStr

Add comma escaping for disk->vendor and disk->product when being
built for the command line (and not from hotplug).

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Sukrit Bhatnagar 2018-04-17 04:26:23 +05:30 committed by John Ferlan
parent a55cd7193a
commit 2234777dd0

View File

@ -2114,11 +2114,15 @@ qemuBuildDriveDevStr(const virDomainDef *def,
virBufferAsprintf(&opt, ",wwn=0x%s", disk->wwn);
}
if (disk->vendor)
virBufferAsprintf(&opt, ",vendor=%s", disk->vendor);
if (disk->vendor) {
virBufferAddLit(&opt, ",vendor=");
virQEMUBuildBufferEscapeComma(&opt, disk->vendor);
}
if (disk->product)
virBufferAsprintf(&opt, ",product=%s", disk->product);
if (disk->product) {
virBufferAddLit(&opt, ",product=");
virQEMUBuildBufferEscapeComma(&opt, disk->product);
}
if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_REMOVABLE)) {