diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f6065ed36b1780e38a8a2ec6424275a4f6e22d0f..fc9615f9ea84738638af2a11b0a300fa48df611c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1345,6 +1345,16 @@ error: } +int +virDomainDiskGetActualType(virDomainDiskDefPtr def) +{ + if (def->type == VIR_DOMAIN_DISK_TYPE_VOLUME && def->srcpool) + return def->srcpool->actualtype; + + return def->type; +} + + void virDomainControllerDefFree(virDomainControllerDefPtr def) { if (!def) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4895e814d0dbe4c87c78c90afdbc2a212e3f2917..24cbec3374f6f2819db8fceb8b79d7e6dc747f45 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2252,6 +2252,7 @@ void virDomainDiskHostDefClear(virDomainDiskHostDefPtr def); void virDomainDiskHostDefFree(size_t nhosts, virDomainDiskHostDefPtr hosts); virDomainDiskHostDefPtr virDomainDiskHostDefCopy(size_t nhosts, virDomainDiskHostDefPtr hosts); +int virDomainDiskGetActualType(virDomainDiskDefPtr def); int virDomainDeviceFindControllerModel(virDomainDefPtr def, virDomainDeviceInfoPtr info, int controllerType); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0b28bac26ca932b192fd18162ea6e562f3003024..aae6a3b95c14ad9c986e254c90c0e1b116e7033c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -198,6 +198,7 @@ virDomainDiskErrorPolicyTypeToString; virDomainDiskFindByBusAndDst; virDomainDiskGeometryTransTypeFromString; virDomainDiskGeometryTransTypeToString; +virDomainDiskGetActualType; virDomainDiskHostDefClear; virDomainDiskHostDefCopy; virDomainDiskHostDefFree; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e499d545cc0fcc00c1240377dbd69540feb6adba..e9908f9e65d2683586bb4f25dda5040931614e4b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3869,7 +3869,7 @@ qemuDomainDiskGetSourceString(virConnectPtr conn, virDomainDiskDefPtr disk, char **source) { - int actualType = qemuDiskGetActualType(disk); + int actualType = virDomainDiskGetActualType(disk); char *secret = NULL; int ret = -1; @@ -3899,7 +3899,7 @@ qemuDomainDiskGetSourceString(virConnectPtr conn, goto cleanup; } - ret = qemuGetDriveSourceString(qemuDiskGetActualType(disk), + ret = qemuGetDriveSourceString(virDomainDiskGetActualType(disk), disk->src, disk->protocol, disk->nhosts, @@ -3927,7 +3927,7 @@ qemuBuildDriveStr(virConnectPtr conn, int idx = virDiskNameToIndex(disk->dst); int busid = -1, unitid = -1; char *source = NULL; - int actualType = qemuDiskGetActualType(disk); + int actualType = virDomainDiskGetActualType(disk); if (idx < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ecaaf815adf0880a3afcc30d6a692cd7b0a8dc17..dc4ded35cfead51eb922d60e7f9b6f5f1da40fb4 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1303,16 +1303,6 @@ cleanup: } -int -qemuDiskGetActualType(virDomainDiskDefPtr def) -{ - if (def->type == VIR_DOMAIN_DISK_TYPE_VOLUME && def->srcpool) - return def->srcpool->actualtype; - - return def->type; -} - - int qemuTranslateDiskSourcePool(virConnectPtr conn, virDomainDiskDefPtr def) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 1f44a767950ba31b8146394ac1b25b87e879f6b9..842b740fe818bb80fede114be747d1562a2a8c05 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -305,8 +305,6 @@ int qemuSetUnprivSGIO(virDomainDeviceDefPtr dev); int qemuDriverAllocateID(virQEMUDriverPtr driver); virDomainXMLOptionPtr virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver); -int qemuDiskGetActualType(virDomainDiskDefPtr def); - int qemuTranslateDiskSourcePool(virConnectPtr conn, virDomainDiskDefPtr def); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 59e018de80a52828017b299b7ab139998db494c6..6ddbd2129c1675891b91e07503b443efed5946e5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12260,7 +12260,7 @@ endjob: static int qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) { - int actualType = qemuDiskGetActualType(disk); + int actualType = virDomainDiskGetActualType(disk); switch ((enum virDomainDiskType) actualType) { case VIR_DOMAIN_DISK_TYPE_BLOCK: @@ -12304,7 +12304,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) static int qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk) { - int actualType = qemuDiskGetActualType(disk); + int actualType = virDomainDiskGetActualType(disk); if (actualType == VIR_DOMAIN_DISK_TYPE_BLOCK && disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { @@ -12448,7 +12448,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn, if (qemuTranslateDiskSourcePool(conn, disk) < 0) return -1; - actualType = qemuDiskGetActualType(disk); + actualType = virDomainDiskGetActualType(disk); switch ((enum virDomainDiskType) actualType) { case VIR_DOMAIN_DISK_TYPE_BLOCK: