mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: domain: Add helper to check block job support
We need to check that qemu supports block jobs in multiple places. Add a helper to do the check.
This commit is contained in:
parent
88dc7e0c2f
commit
1eccac1d2d
@ -3047,3 +3047,33 @@ qemuDomainGetMonitor(virDomainObjPtr vm)
|
||||
{
|
||||
return ((qemuDomainObjPrivatePtr) vm->privateData)->mon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainSupportsBlockJobs:
|
||||
* @vm: domain object
|
||||
* @modern: pointer to bool that returns whether modern block jobs are supported
|
||||
*
|
||||
* Returns -1 in case when qemu does not support block jobs at all. Otherwise
|
||||
* returns 0 and optionally fills @modern to denote that modern (async) block
|
||||
* jobs are supported.
|
||||
*/
|
||||
int
|
||||
qemuDomainSupportsBlockJobs(virDomainObjPtr vm,
|
||||
bool *modern)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
bool async = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC);
|
||||
bool sync = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC);
|
||||
|
||||
if (!sync && !async) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("block jobs not supported with this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (modern)
|
||||
*modern = async;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -428,6 +428,8 @@ int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
||||
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||
|
||||
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm, bool *modern)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
|
||||
|
||||
void qemuDomObjEndAPI(virDomainObjPtr *vm);
|
||||
|
Loading…
Reference in New Issue
Block a user