[PATCH 01/10] qemu: Move qemuDeviceDriveHostAlias

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

 



Move function to qemu_alias.c, rename it to qemuDomainDeviceDriveAlias

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_alias.c   | 16 ++++++++++++++++
 src/qemu/qemu_alias.h   |  4 ++++
 src/qemu/qemu_command.c | 15 ---------------
 src/qemu/qemu_command.h |  3 ---
 src/qemu/qemu_hotplug.c |  6 +++---
 5 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index efd9222..26d158b 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -32,6 +32,22 @@
 
 VIR_LOG_INIT("qemu.qemu_alias");
 
+char *
+qemuDomainDeviceDriveAlias(virDomainDiskDefPtr disk,
+                           virQEMUCapsPtr qemuCaps)
+{
+    char *ret;
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+        ignore_value(virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX,
+                                 disk->info.alias));
+    } else {
+        ignore_value(VIR_STRDUP(ret, disk->info.alias));
+    }
+    return ret;
+}
+
+
 int
 qemuDomainDeviceAliasIndex(const virDomainDeviceInfo *info,
                            const char *prefix)
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index a2eaa27..ece3b6a 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -27,9 +27,13 @@
 # include "domain_conf.h"
 
 # include "qemu_capabilities.h"
+# include "qemu_command.h"
 # include "qemu_domain.h"
 # include "qemu_domain_address.h"
 
+char *qemuDomainDeviceDriveAlias(virDomainDiskDefPtr disk,
+                                 virQEMUCapsPtr qemuCaps);
+
 int qemuAssignDeviceChrAlias(virDomainDefPtr def,
                              virDomainChrDefPtr chr,
                              ssize_t idx);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 679f558..a9b5c3b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -259,21 +259,6 @@ qemuBuildObjectCommandlineFromJSON(const char *type,
 }
 
 
-char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
-                               virQEMUCapsPtr qemuCaps)
-{
-    char *ret;
-
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-        ignore_value(virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX,
-                                 disk->info.alias));
-    } else {
-        ignore_value(VIR_STRDUP(ret, disk->info.alias));
-    }
-    return ret;
-}
-
-
 static int
 qemuBuildDeviceAddressStr(virBufferPtr buf,
                           virDomainDefPtr domainDef,
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 776954e..6b3e68b 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -120,9 +120,6 @@ char *qemuBuildNicDevStr(virDomainDefPtr def,
                          size_t vhostfdSize,
                          virQEMUCapsPtr qemuCaps);
 
-char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
-                               virQEMUCapsPtr qemuCaps);
-
 /* Both legacy & current support */
 char *qemuBuildDriveStr(virConnectPtr conn,
                         virDomainDiskDefPtr disk,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index ee305e7..831252d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1,7 +1,7 @@
 /*
  * qemu_hotplug.c: QEMU device hotplug management
  *
- * Copyright (C) 2006-2015 Red Hat, Inc.
+ * Copyright (C) 2006-2016 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -193,7 +193,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
     if (qemuDomainPrepareDisk(driver, vm, disk, newsrc, false) < 0)
         goto cleanup;
 
-    if (!(driveAlias = qemuDeviceDriveHostAlias(disk, priv->qemuCaps)))
+    if (!(driveAlias = qemuDomainDeviceDriveAlias(disk, priv->qemuCaps)))
         goto error;
 
     do {
@@ -359,7 +359,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
         if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
             goto error;
 
-        if (!(drivealias = qemuDeviceDriveHostAlias(disk, priv->qemuCaps)))
+        if (!(drivealias = qemuDomainDeviceDriveAlias(disk, priv->qemuCaps)))
             goto error;
 
         if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
-- 
2.5.0

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