Blame SOURCES/libvirt-conf-Move-qemuDiskGetActualType-to-virDomainDiskGetActualType.patch

c401cc
From 361ee3d8a6a3ac0d44eba8651d9cee5c609bc6b3 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <361ee3d8a6a3ac0d44eba8651d9cee5c609bc6b3@dist-git>
c401cc
From: Peter Krempa <pkrempa@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:55:23 +0100
c401cc
Subject: [PATCH] conf: Move qemuDiskGetActualType to
c401cc
 virDomainDiskGetActualType
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
All the data for getting the actual type is present in the domain
c401cc
config. There is no need to have this function private to the qemu
c401cc
driver and it will be re-used later in other parts of libvirt
c401cc
c401cc
(cherry picked from commit f8f020da0a72e4262784eff6325b155ffd03ca37)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/conf/domain_conf.c   | 10 ++++++++++
c401cc
 src/conf/domain_conf.h   |  1 +
c401cc
 src/libvirt_private.syms |  1 +
c401cc
 src/qemu/qemu_command.c  |  6 +++---
c401cc
 src/qemu/qemu_conf.c     | 10 ----------
c401cc
 src/qemu/qemu_conf.h     |  2 --
c401cc
 src/qemu/qemu_driver.c   |  6 +++---
c401cc
 7 files changed, 18 insertions(+), 18 deletions(-)
c401cc
c401cc
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
c401cc
index 6e833c8..d1617b8 100644
c401cc
--- a/src/conf/domain_conf.c
c401cc
+++ b/src/conf/domain_conf.c
c401cc
@@ -1288,6 +1288,16 @@ error:
c401cc
 }
c401cc
 
c401cc
 
c401cc
+int
c401cc
+virDomainDiskGetActualType(virDomainDiskDefPtr def)
c401cc
+{
c401cc
+    if (def->type == VIR_DOMAIN_DISK_TYPE_VOLUME && def->srcpool)
c401cc
+        return def->srcpool->actualtype;
c401cc
+
c401cc
+    return def->type;
c401cc
+}
c401cc
+
c401cc
+
c401cc
 void virDomainControllerDefFree(virDomainControllerDefPtr def)
c401cc
 {
c401cc
     if (!def)
c401cc
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
c401cc
index 4e6d4e7..00e66ae 100644
c401cc
--- a/src/conf/domain_conf.h
c401cc
+++ b/src/conf/domain_conf.h
c401cc
@@ -2215,6 +2215,7 @@ void virDomainDiskHostDefClear(virDomainDiskHostDefPtr def);
c401cc
 void virDomainDiskHostDefFree(size_t nhosts, virDomainDiskHostDefPtr hosts);
c401cc
 virDomainDiskHostDefPtr virDomainDiskHostDefCopy(size_t nhosts,
c401cc
                                                  virDomainDiskHostDefPtr hosts);
c401cc
+int virDomainDiskGetActualType(virDomainDiskDefPtr def);
c401cc
 int virDomainDeviceFindControllerModel(virDomainDefPtr def,
c401cc
                                        virDomainDeviceInfoPtr info,
c401cc
                                        int controllerType);
c401cc
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
c401cc
index 7df7e73..40b997b 100644
c401cc
--- a/src/libvirt_private.syms
c401cc
+++ b/src/libvirt_private.syms
c401cc
@@ -196,6 +196,7 @@ virDomainDiskErrorPolicyTypeToString;
c401cc
 virDomainDiskFindByBusAndDst;
c401cc
 virDomainDiskGeometryTransTypeFromString;
c401cc
 virDomainDiskGeometryTransTypeToString;
c401cc
+virDomainDiskGetActualType;
c401cc
 virDomainDiskHostDefClear;
c401cc
 virDomainDiskHostDefCopy;
c401cc
 virDomainDiskHostDefFree;
c401cc
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
c401cc
index 749f97b..8923b09 100644
c401cc
--- a/src/qemu/qemu_command.c
c401cc
+++ b/src/qemu/qemu_command.c
c401cc
@@ -3774,7 +3774,7 @@ qemuDomainDiskGetSourceString(virConnectPtr conn,
c401cc
                               virDomainDiskDefPtr disk,
c401cc
                               char **source)
c401cc
 {
c401cc
-    int actualType = qemuDiskGetActualType(disk);
c401cc
+    int actualType = virDomainDiskGetActualType(disk);
c401cc
     char *secret = NULL;
c401cc
     int ret = -1;
c401cc
 
c401cc
@@ -3804,7 +3804,7 @@ qemuDomainDiskGetSourceString(virConnectPtr conn,
c401cc
             goto cleanup;
c401cc
     }
c401cc
 
c401cc
-    ret = qemuGetDriveSourceString(qemuDiskGetActualType(disk),
c401cc
+    ret = qemuGetDriveSourceString(virDomainDiskGetActualType(disk),
c401cc
                                    disk->src,
c401cc
                                    disk->protocol,
c401cc
                                    disk->nhosts,
c401cc
@@ -3832,7 +3832,7 @@ qemuBuildDriveStr(virConnectPtr conn,
c401cc
     int idx = virDiskNameToIndex(disk->dst);
c401cc
     int busid = -1, unitid = -1;
c401cc
     char *source = NULL;
c401cc
-    int actualType = qemuDiskGetActualType(disk);
c401cc
+    int actualType = virDomainDiskGetActualType(disk);
c401cc
 
c401cc
     if (idx < 0) {
c401cc
         virReportError(VIR_ERR_INTERNAL_ERROR,
c401cc
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
c401cc
index af1e3be..9b02886 100644
c401cc
--- a/src/qemu/qemu_conf.c
c401cc
+++ b/src/qemu/qemu_conf.c
c401cc
@@ -1269,16 +1269,6 @@ cleanup:
c401cc
 
c401cc
 
c401cc
 int
c401cc
-qemuDiskGetActualType(virDomainDiskDefPtr def)
c401cc
-{
c401cc
-    if (def->type == VIR_DOMAIN_DISK_TYPE_VOLUME && def->srcpool)
c401cc
-        return def->srcpool->actualtype;
c401cc
-
c401cc
-    return def->type;
c401cc
-}
c401cc
-
c401cc
-
c401cc
-int
c401cc
 qemuTranslateDiskSourcePool(virConnectPtr conn,
c401cc
                             virDomainDiskDefPtr def)
c401cc
 {
c401cc
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
c401cc
index b90c563..e03be95 100644
c401cc
--- a/src/qemu/qemu_conf.h
c401cc
+++ b/src/qemu/qemu_conf.h
c401cc
@@ -300,8 +300,6 @@ int qemuSetUnprivSGIO(virDomainDeviceDefPtr dev);
c401cc
 int qemuDriverAllocateID(virQEMUDriverPtr driver);
c401cc
 virDomainXMLOptionPtr virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver);
c401cc
 
c401cc
-int qemuDiskGetActualType(virDomainDiskDefPtr def);
c401cc
-
c401cc
 int qemuTranslateDiskSourcePool(virConnectPtr conn,
c401cc
                                 virDomainDiskDefPtr def);
c401cc
 
c401cc
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
c401cc
index 641d118..03d94fc 100644
c401cc
--- a/src/qemu/qemu_driver.c
c401cc
+++ b/src/qemu/qemu_driver.c
c401cc
@@ -12143,7 +12143,7 @@ endjob:
c401cc
 static int
c401cc
 qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
c401cc
 {
c401cc
-    int actualType = qemuDiskGetActualType(disk);
c401cc
+    int actualType = virDomainDiskGetActualType(disk);
c401cc
 
c401cc
     switch ((enum virDomainDiskType) actualType) {
c401cc
     case VIR_DOMAIN_DISK_TYPE_BLOCK:
c401cc
@@ -12182,7 +12182,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
c401cc
 static int
c401cc
 qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk)
c401cc
 {
c401cc
-    int actualType = qemuDiskGetActualType(disk);
c401cc
+    int actualType = virDomainDiskGetActualType(disk);
c401cc
 
c401cc
     if (actualType == VIR_DOMAIN_DISK_TYPE_BLOCK &&
c401cc
         disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
c401cc
@@ -12326,7 +12326,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
c401cc
     if (qemuTranslateDiskSourcePool(conn, disk) < 0)
c401cc
         return -1;
c401cc
 
c401cc
-    actualType = qemuDiskGetActualType(disk);
c401cc
+    actualType = virDomainDiskGetActualType(disk);
c401cc
 
c401cc
     switch ((enum virDomainDiskType) actualType) {
c401cc
     case VIR_DOMAIN_DISK_TYPE_BLOCK:
c401cc
-- 
c401cc
1.9.0
c401cc