qemu: process: Move clearing of the BLOCKDEV capability to qemuProcessPrepareQEMUCaps

Start aggregating all capability post-processing code in one place.

The comment was modified while moving it as it was mentioning floppies
which are no longer clearing the blockdev capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-11-24 09:23:54 +01:00
parent dbbc9a3c40
commit 3a075524d9

View File

@ -5502,6 +5502,7 @@ qemuProcessPrepareQEMUCaps(virDomainObjPtr vm,
virFileCachePtr qemuCapsCache)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
size_t i;
virObjectUnref(priv->qemuCaps);
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(qemuCapsCache,
@ -5510,6 +5511,14 @@ qemuProcessPrepareQEMUCaps(virDomainObjPtr vm,
vm->def->os.machine)))
return -1;
/* clear the 'blockdev' capability for VMs which have disks that need -drive */
for (i = 0; i < vm->def->ndisks; i++) {
if (qemuDiskBusNeedsDriveArg(vm->def->disks[i]->bus)) {
virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
break;
}
}
return 0;
}
@ -6273,15 +6282,6 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
qemuProcessPrepareAllowReboot(vm);
/* clear the 'blockdev' capability for VMs which have disks that need
* -drive or which have floppies where we can't reliably get the QOM path */
for (i = 0; i < vm->def->ndisks; i++) {
if (qemuDiskBusNeedsDriveArg(vm->def->disks[i]->bus)) {
virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
break;
}
}
/*
* Normally PCI addresses are assigned in the virDomainCreate
* or virDomainDefine methods. We might still need to assign