提交 514822db 编写于 作者: P Peter Krempa

qemuCheckDiskConfig: Remove and untangle callers

Remove the function and passing of 'def' through the callers.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 8b5cf013
...@@ -1114,23 +1114,6 @@ qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk) ...@@ -1114,23 +1114,6 @@ qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk)
} }
/**
* qemuCheckDiskConfig:
* @disk: disk definition
* @qemuCaps: qemu capabilities, may be NULL for cold-plug check
*
* Perform disk definition config validity checks. Returns -1 on error with
* error reported.
*/
int
qemuCheckDiskConfig(virDomainDiskDefPtr disk G_GNUC_UNUSED,
const virDomainDef *def G_GNUC_UNUSED,
virQEMUCapsPtr qemuCaps G_GNUC_UNUSED)
{
return 0;
}
/* QEMU 1.2 and later have a binary flag -enable-fips that must be /* QEMU 1.2 and later have a binary flag -enable-fips that must be
* used for VNC auth to obey FIPS settings; but the flag only * used for VNC auth to obey FIPS settings; but the flag only
* exists on Linux, and with no way to probe for it via QMP. Our * exists on Linux, and with no way to probe for it via QMP. Our
...@@ -1449,7 +1432,6 @@ qemuBuildDiskFrontendAttributes(virDomainDiskDefPtr disk, ...@@ -1449,7 +1432,6 @@ qemuBuildDiskFrontendAttributes(virDomainDiskDefPtr disk,
static char * static char *
qemuBuildDriveStr(virDomainDiskDefPtr disk, qemuBuildDriveStr(virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps) virQEMUCapsPtr qemuCaps)
{ {
g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
...@@ -1475,10 +1457,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, ...@@ -1475,10 +1457,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
return NULL; return NULL;
} }
/* if we are using -device this will be checked elsewhere */
if (qemuCheckDiskConfig(disk, def, qemuCaps) < 0)
return NULL;
virBufferAsprintf(&opt, "if=%s", virBufferAsprintf(&opt, "if=%s",
virDomainDiskQEMUBusTypeToString(disk->bus)); virDomainDiskQEMUBusTypeToString(disk->bus));
virBufferAsprintf(&opt, ",index=%d", idx); virBufferAsprintf(&opt, ",index=%d", idx);
...@@ -1618,9 +1596,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, ...@@ -1618,9 +1596,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
g_autofree char *scsiVPDDeviceId = NULL; g_autofree char *scsiVPDDeviceId = NULL;
int controllerModel; int controllerModel;
if (qemuCheckDiskConfig(disk, def, qemuCaps) < 0)
return NULL;
if (!qemuDomainCheckCCWS390AddressSupport(def, &disk->info, qemuCaps, disk->dst)) if (!qemuDomainCheckCCWS390AddressSupport(def, &disk->info, qemuCaps, disk->dst))
return NULL; return NULL;
...@@ -2131,7 +2106,6 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommandPtr cmd, ...@@ -2131,7 +2106,6 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommandPtr cmd,
static int static int
qemuBuildDiskSourceCommandLine(virCommandPtr cmd, qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps) virQEMUCapsPtr qemuCaps)
{ {
g_autoptr(qemuBlockStorageSourceChainData) data = NULL; g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
...@@ -2151,7 +2125,7 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd, ...@@ -2151,7 +2125,7 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
!(copyOnReadProps = qemuBlockStorageGetCopyOnReadProps(disk))) !(copyOnReadProps = qemuBlockStorageGetCopyOnReadProps(disk)))
return -1; return -1;
} else { } else {
if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, def, qemuCaps))) if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, qemuCaps)))
return -1; return -1;
} }
...@@ -2181,7 +2155,7 @@ qemuBuildDiskCommandLine(virCommandPtr cmd, ...@@ -2181,7 +2155,7 @@ qemuBuildDiskCommandLine(virCommandPtr cmd,
{ {
g_autofree char *optstr = NULL; g_autofree char *optstr = NULL;
if (qemuBuildDiskSourceCommandLine(cmd, disk, def, qemuCaps) < 0) if (qemuBuildDiskSourceCommandLine(cmd, disk, qemuCaps) < 0)
return -1; return -1;
if (!qemuDiskBusNeedsDriveArg(disk->bus)) { if (!qemuDiskBusNeedsDriveArg(disk->bus)) {
...@@ -9979,7 +9953,6 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) ...@@ -9979,7 +9953,6 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
*/ */
qemuBlockStorageSourceAttachDataPtr qemuBlockStorageSourceAttachDataPtr
qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk, qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps) virQEMUCapsPtr qemuCaps)
{ {
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL; g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
...@@ -9987,7 +9960,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk, ...@@ -9987,7 +9960,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
if (VIR_ALLOC(data) < 0) if (VIR_ALLOC(data) < 0)
return NULL; return NULL;
if (!(data->driveCmd = qemuBuildDriveStr(disk, def, qemuCaps)) || if (!(data->driveCmd = qemuBuildDriveStr(disk, qemuCaps)) ||
!(data->driveAlias = qemuAliasDiskDriveFromDisk(disk))) !(data->driveAlias = qemuAliasDiskDriveFromDisk(disk)))
return NULL; return NULL;
...@@ -10049,7 +10022,6 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src, ...@@ -10049,7 +10022,6 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src,
*/ */
qemuBlockStorageSourceChainDataPtr qemuBlockStorageSourceChainDataPtr
qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk, qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps) virQEMUCapsPtr qemuCaps)
{ {
g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL; g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL;
...@@ -10058,7 +10030,7 @@ qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk, ...@@ -10058,7 +10030,7 @@ qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk,
if (VIR_ALLOC(data) < 0) if (VIR_ALLOC(data) < 0)
return NULL; return NULL;
if (!(elem = qemuBuildStorageSourceAttachPrepareDrive(disk, def, qemuCaps))) if (!(elem = qemuBuildStorageSourceAttachPrepareDrive(disk, qemuCaps)))
return NULL; return NULL;
if (qemuBuildStorageSourceAttachPrepareCommon(disk->src, elem, qemuCaps) < 0) if (qemuBuildStorageSourceAttachPrepareCommon(disk->src, elem, qemuCaps) < 0)
......
...@@ -105,7 +105,6 @@ bool qemuDiskBusNeedsDriveArg(int bus); ...@@ -105,7 +105,6 @@ bool qemuDiskBusNeedsDriveArg(int bus);
qemuBlockStorageSourceAttachDataPtr qemuBlockStorageSourceAttachDataPtr
qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk, qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps); virQEMUCapsPtr qemuCaps);
int int
qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src, qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src,
...@@ -115,7 +114,6 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src, ...@@ -115,7 +114,6 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr src,
qemuBlockStorageSourceChainDataPtr qemuBlockStorageSourceChainDataPtr
qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk, qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps); virQEMUCapsPtr qemuCaps);
...@@ -200,9 +198,6 @@ int qemuGetDriveSourceString(virStorageSourcePtr src, ...@@ -200,9 +198,6 @@ int qemuGetDriveSourceString(virStorageSourcePtr src,
bool bool
qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk); qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk);
int qemuCheckDiskConfig(virDomainDiskDefPtr disk,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps);
bool bool
qemuCheckFips(void); qemuCheckFips(void);
......
...@@ -8143,8 +8143,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, ...@@ -8143,8 +8143,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
} }
if (virDomainDiskTranslateSourcePool(disk) < 0) if (virDomainDiskTranslateSourcePool(disk) < 0)
return -1; return -1;
if (qemuCheckDiskConfig(disk, vmdef, NULL) < 0)
return -1;
if (qemuCheckDiskConfigAgainstDomain(vmdef, disk) < 0) if (qemuCheckDiskConfigAgainstDomain(vmdef, disk) < 0)
return -1; return -1;
if (virDomainDiskInsert(vmdef, disk) < 0) if (virDomainDiskInsert(vmdef, disk) < 0)
......
...@@ -713,7 +713,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, ...@@ -713,7 +713,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
priv->qemuCaps))) priv->qemuCaps)))
goto cleanup; goto cleanup;
} else { } else {
if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, vm->def, if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk,
priv->qemuCaps))) priv->qemuCaps)))
goto cleanup; goto cleanup;
} }
......
...@@ -283,8 +283,7 @@ testQemuDiskXMLToProps(const void *opaque) ...@@ -283,8 +283,7 @@ testQemuDiskXMLToProps(const void *opaque)
virDomainDiskInsert(vmdef, disk) < 0) virDomainDiskInsert(vmdef, disk) < 0)
return -1; return -1;
if (qemuCheckDiskConfig(disk, vmdef, data->qemuCaps) < 0 || if (qemuValidateDomainDeviceDefDisk(disk, vmdef, data->qemuCaps) < 0) {
qemuValidateDomainDeviceDefDisk(disk, vmdef, data->qemuCaps) < 0) {
VIR_TEST_VERBOSE("invalid configuration for disk"); VIR_TEST_VERBOSE("invalid configuration for disk");
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册