[PATCH v2 4/9] qemu: command: Move disk 'serial' into frontend parameter formatter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux