From ccc1d910ced9e2f3f6c62eacd57fdede0e71bf0a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 14 Nov 2017 13:50:52 +0100 Subject: [PATCH] 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. --- 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", -- GitLab