Disk serial is not a property of the image but of the disk frontend.
Account for this appropriately.
---
src/qemu/qemu_command.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 31df61a944..d286681691 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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",
--
2.14.3