mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-30 16:35:24 +00:00
hypervisor: domain_job: add maxQueuedJobs
This patch adds a new variable maxQueuedJobs into the job object as it is the last hypervisor-based part of the begin job. Since this patch, it will not be necessary to propagate driver structure into the job functions. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
6ba0ead714
commit
fe3df84a9c
@ -155,6 +155,7 @@ struct _virDomainJobObj {
|
||||
virCond cond; /* Use to coordinate jobs */
|
||||
|
||||
int jobsQueued;
|
||||
unsigned int maxQueuedJobs;
|
||||
|
||||
/* The following members are for VIR_JOB_* */
|
||||
virDomainJob active; /* currently running job */
|
||||
|
@ -1758,6 +1758,7 @@ static void *
|
||||
qemuDomainObjPrivateAlloc(void *opaque)
|
||||
{
|
||||
g_autoptr(qemuDomainObjPrivate) priv = g_new0(qemuDomainObjPrivate, 1);
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(opaque);
|
||||
|
||||
if (virDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) {
|
||||
virReportSystemError(errno, "%s",
|
||||
@ -1770,6 +1771,8 @@ qemuDomainObjPrivateAlloc(void *opaque)
|
||||
|
||||
priv->blockjobs = virHashNew(virObjectUnref);
|
||||
|
||||
priv->job.maxQueuedJobs = cfg->maxQueuedJobs;
|
||||
|
||||
/* agent commands block by default, user can choose different behavior */
|
||||
priv->agentTimeout = VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK;
|
||||
priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX;
|
||||
|
@ -723,7 +723,7 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj)
|
||||
* -1 otherwise.
|
||||
*/
|
||||
static int ATTRIBUTE_NONNULL(1)
|
||||
qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
||||
qemuDomainObjBeginJobInternal(virQEMUDriver *driver G_GNUC_UNUSED,
|
||||
virDomainObj *obj,
|
||||
virDomainJob job,
|
||||
virDomainAgentJob agentJob,
|
||||
@ -734,7 +734,6 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
||||
unsigned long long now;
|
||||
unsigned long long then;
|
||||
bool nested = job == VIR_JOB_ASYNC_NESTED;
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
const char *blocker = NULL;
|
||||
const char *agentBlocker = NULL;
|
||||
int ret = -1;
|
||||
@ -763,8 +762,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
||||
retry:
|
||||
if (job != VIR_JOB_ASYNC &&
|
||||
job != VIR_JOB_DESTROY &&
|
||||
cfg->maxQueuedJobs &&
|
||||
priv->job.jobsQueued > cfg->maxQueuedJobs) {
|
||||
priv->job.maxQueuedJobs &&
|
||||
priv->job.jobsQueued > priv->job.maxQueuedJobs) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -907,8 +906,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
||||
_("cannot acquire state change lock"));
|
||||
}
|
||||
ret = -2;
|
||||
} else if (cfg->maxQueuedJobs &&
|
||||
priv->job.jobsQueued > cfg->maxQueuedJobs) {
|
||||
} else if (priv->job.maxQueuedJobs &&
|
||||
priv->job.jobsQueued > priv->job.maxQueuedJobs) {
|
||||
if (blocker && agentBlocker) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot acquire state change "
|
||||
|
Loading…
x
Reference in New Issue
Block a user