提交 f8f020da 编写于 作者: P Peter Krempa

conf: Move qemuDiskGetActualType to virDomainDiskGetActualType

All the data for getting the actual type is present in the domain
config. There is no need to have this function private to the qemu
driver and it will be re-used later in other parts of libvirt
上级 dca5ce4c
......@@ -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)
......
......@@ -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);
......
......@@ -198,6 +198,7 @@ virDomainDiskErrorPolicyTypeToString;
virDomainDiskFindByBusAndDst;
virDomainDiskGeometryTransTypeFromString;
virDomainDiskGeometryTransTypeToString;
virDomainDiskGetActualType;
virDomainDiskHostDefClear;
virDomainDiskHostDefCopy;
virDomainDiskHostDefFree;
......
......@@ -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,
......
......@@ -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)
......
......@@ -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);
......
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册