Re: [PATCH v2 3/9] qemu: Use qemuAssignDeviceDiskDriveAlias

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

 



On Tue, Jul 19, 2016 at 10:30:46AM -0400, John Ferlan wrote:
Rather than open code build the drive alias command in multiple places,
use the helper to ensure consistency.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
src/qemu/qemu_command.c      | 12 ++++++++++--
src/qemu/qemu_driver.c       |  3 +--
src/qemu/qemu_hotplug.c      |  3 +--
src/qemu/qemu_migration.c    |  9 +++------
src/qemu/qemu_monitor_json.c |  2 +-
src/qemu/qemu_monitor_text.c |  8 ++++++--
6 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index affd0b0..482f993 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1245,7 +1245,11 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
    }

    if (emitDeviceSyntax) {
-        virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
+        char *drivealias = qemuAssignDeviceDiskDriveAlias(disk->info.alias);
+        if (!drivealias)
+            goto error;
+        virBufferAsprintf(&opt, ",id=%s", drivealias);
+        VIR_FREE(drivealias);

Creating a separate 'qemuAliasDiskDriveBuf' would get rid of the extra
free and error handling.

On the other hand, this way both 'id' and its value are on the same
line.

Jan

--
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]