提交 961ba2b9 编写于 作者: P Peter Krempa

qemuDomainValidateStorageSource: Allow masking out blockdev support

In case of 'sd' cards we'll use pre-blockdev code also if qemu supports
blockdev. In that specific case we'll need to mask out blockdev support
for 'sd' disks. Plumb in a boolean to allow it.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 6cd8234f
......@@ -5137,11 +5137,15 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,
int
qemuDomainValidateStorageSource(virStorageSourcePtr src,
virQEMUCapsPtr qemuCaps)
virQEMUCapsPtr qemuCaps,
bool maskBlockdev)
{
int actualType = virStorageSourceGetActualType(src);
bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV);
if (maskBlockdev)
blockdev = false;
if (src->format == VIR_STORAGE_FILE_COW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("'cow' storage format is not supported"));
......@@ -8290,7 +8294,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
if (n->format == VIR_STORAGE_FILE_ISO)
n->format = VIR_STORAGE_FILE_RAW;
if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0)
if (qemuDomainValidateStorageSource(n, priv->qemuCaps, false) < 0)
return -1;
qemuDomainPrepareStorageSourceConfig(n, cfg, priv->qemuCaps);
......@@ -13133,7 +13137,7 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDefPtr disk,
qemuDomainObjPrivatePtr priv,
virQEMUDriverConfigPtr cfg)
{
if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0)
if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps, true) < 0)
return -1;
qemuDomainPrepareStorageSourceConfig(disk->src, cfg, priv->qemuCaps);
......@@ -13169,7 +13173,7 @@ qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDefPtr disk,
if (qemuBlockStorageSourceNeedsStorageSliceLayer(src))
src->sliceStorage->nodename = g_strdup_printf("libvirt-%u-slice-sto", src->id);
if (qemuDomainValidateStorageSource(src, priv->qemuCaps) < 0)
if (qemuDomainValidateStorageSource(src, priv->qemuCaps, false) < 0)
return -1;
qemuDomainPrepareStorageSourceConfig(src, cfg, priv->qemuCaps);
......
......@@ -1237,7 +1237,8 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
int
qemuDomainValidateStorageSource(virStorageSourcePtr src,
virQEMUCapsPtr qemuCaps);
virQEMUCapsPtr qemuCaps,
bool maskBlockdev);
int
......
......@@ -2297,7 +2297,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk,
}
for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
if (qemuDomainValidateStorageSource(n, qemuCaps) < 0)
if (qemuDomainValidateStorageSource(n, qemuCaps, false) < 0)
return -1;
}
......
......@@ -294,7 +294,7 @@ testQemuDiskXMLToProps(const void *opaque)
if (testQemuDiskXMLToJSONFakeSecrets(n) < 0)
return -1;
if (qemuDomainValidateStorageSource(n, data->qemuCaps) < 0)
if (qemuDomainValidateStorageSource(n, data->qemuCaps, false) < 0)
return -1;
qemuDomainPrepareDiskSourceData(disk, n);
......@@ -529,7 +529,7 @@ testQemuImageCreate(const void *opaque)
src->capacity = UINT_MAX * 2ULL;
src->physical = UINT_MAX + 1ULL;
if (qemuDomainValidateStorageSource(src, data->qemuCaps) < 0)
if (qemuDomainValidateStorageSource(src, data->qemuCaps, false) < 0)
return -1;
if (qemuBlockStorageSourceCreateGetStorageProps(src, &protocolprops) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册