1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

qemu: command: Move disk 'serial' into frontend parameter formatter

Disk serial is not a property of the image but of the disk frontend.
Account for this appropriately.
This commit is contained in:
Peter Krempa 2017-11-14 13:50:52 +01:00
parent 20acab7642
commit ccc1d910ce

View File

@ -1625,6 +1625,7 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
static void
qemuBuildDiskFrontendAttributes(virDomainDiskDefPtr disk,
virQEMUCapsPtr qemuCaps,
virBufferPtr buf)
{
/* generate geometry command string */
@ -1640,6 +1641,12 @@ qemuBuildDiskFrontendAttributes(virDomainDiskDefPtr disk,
virBufferAsprintf(buf, ",trans=%s",
virDomainDiskGeometryTransTypeToString(disk->geometry.trans));
}
if (disk->serial &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) {
virBufferAddLit(buf, ",serial=");
virBufferEscape(buf, '\\', " ", "%s", disk->serial);
}
}
@ -1703,13 +1710,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
if (disk->src->readonly)
virBufferAddLit(&opt, ",readonly=on");
qemuBuildDiskFrontendAttributes(disk, &opt);
if (disk->serial &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) {
virBufferAddLit(&opt, ",serial=");
virBufferEscape(&opt, '\\', " ", "%s", disk->serial);
}
qemuBuildDiskFrontendAttributes(disk, qemuCaps, &opt);
if (disk->cachemode) {
virBufferAsprintf(&opt, ",cache=%s",