From nobody Sun Feb 8 18:09:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1661353261; cv=none; d=zohomail.com; s=zohoarc; b=doxg7LgEYmgFNQyA5SwheS33gOU1XVeendwEreHA2exfmhqOTC31wEKX81m+nHO9Po3GUGZ075P2amS6di5OLhYwJc68xoJmrhjcPib6t/DBuq9N5PyawG6UkrbbYeS+3Fb7ZWlKio80+fgmZ5ncjLElrb11yI2Zy7HsyyR8MYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661353261; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MKw9OQIytaahQqV+x8wMIxlTt8Lwb+rknPP/4feRkEw=; b=GhFxPbIBgxpoRKRKF8PQvjDp6ov49Uv02uGLDn/RBZDrAvT4yc4w2BfVuerdKz1zp9Z3Xp9TJFuA2J466BuTAS3Z87+Q0IyARG9wORK84t7vWRpj9uftSnPhjpfX3wySd7RjHfsoAphAZ7blzO4EwJ1SxKGgorZ6SGVSvGxKGTs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1661353261806913.8905031775078; Wed, 24 Aug 2022 08:01:01 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-262-RpCsuTz6N1qCmoMfhvYsxQ-1; Wed, 24 Aug 2022 11:00:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6568D1C05140; Wed, 24 Aug 2022 15:00:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 522412026D4C; Wed, 24 Aug 2022 15:00:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 665161946A43; Wed, 24 Aug 2022 15:00:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 145171946A42 for ; Wed, 24 Aug 2022 13:43:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 06965945D7; Wed, 24 Aug 2022 13:43:56 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id A62E79459C for ; Wed, 24 Aug 2022 13:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661353260; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MKw9OQIytaahQqV+x8wMIxlTt8Lwb+rknPP/4feRkEw=; b=XeKiwMPkTUij5/Vi2vu1awtDPIuocQZYXf/5bfz9GF1ekoGt6I2Do66ue56cadcMYw4arZ +FUI2zXgtjDE6Us8csLsT/Vvp1NR27FRdUqLnGpHIx11L5GLzEIf7XG2Ij7FNdLP9F8oU4 /y8HiBP+SMaPX1fGYeHm+KUmTx0vyCY= X-MC-Unique: RpCsuTz6N1qCmoMfhvYsxQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 17/17] qemu & conf: move BeginNestedJob & BeginJobNowait into src/conf Date: Wed, 24 Aug 2022 15:43:40 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1661353263327100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Kristina Hanicova Reviewed-by: J=C3=A1n Tomko --- src/conf/virdomainjob.c | 44 +++++++++++++++++++++++++++++++++++++++ src/conf/virdomainjob.h | 6 ++++++ src/libvirt_private.syms | 2 ++ src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domainjob.c | 44 --------------------------------------- src/qemu/qemu_domainjob.h | 7 ------- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 2 +- 8 files changed, 55 insertions(+), 54 deletions(-) diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c index 763fbfba00..fe418bcb30 100644 --- a/src/conf/virdomainjob.c +++ b/src/conf/virdomainjob.c @@ -558,6 +558,50 @@ int virDomainObjBeginAsyncJob(virDomainObj *obj, return 0; } =20 +int +virDomainObjBeginNestedJob(virDomainObj *obj, + virDomainAsyncJob asyncJob) +{ + if (asyncJob !=3D obj->job->asyncJob) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected async job %d type expected %d"), + asyncJob, obj->job->asyncJob); + return -1; + } + + if (obj->job->asyncOwner !=3D virThreadSelfID()) { + VIR_WARN("This thread doesn't seem to be the async job owner: %llu= ", + obj->job->asyncOwner); + } + + return virDomainObjBeginJobInternal(obj, obj->job, + VIR_JOB_ASYNC_NESTED, + VIR_AGENT_JOB_NONE, + VIR_ASYNC_JOB_NONE, + false); +} + +/** + * virDomainObjBeginJobNowait: + * + * @obj: domain object + * @job: virDomainJob to start + * + * Acquires job for a domain object which must be locked before + * calling. If there's already a job running it returns + * immediately without any error reported. + * + * Returns: see virDomainObjBeginJobInternal + */ +int +virDomainObjBeginJobNowait(virDomainObj *obj, + virDomainJob job) +{ + return virDomainObjBeginJobInternal(obj, obj->job, job, + VIR_AGENT_JOB_NONE, + VIR_ASYNC_JOB_NONE, true); +} + /* * obj must be locked and have a reference before calling * diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h index 3cd02ef4ae..c101334596 100644 --- a/src/conf/virdomainjob.h +++ b/src/conf/virdomainjob.h @@ -257,6 +257,12 @@ int virDomainObjBeginAsyncJob(virDomainObj *obj, virDomainJobOperation operation, unsigned long apiFlags) G_GNUC_WARN_UNUSED_RESULT; +int virDomainObjBeginNestedJob(virDomainObj *obj, + virDomainAsyncJob asyncJob) + G_GNUC_WARN_UNUSED_RESULT; +int virDomainObjBeginJobNowait(virDomainObj *obj, + virDomainJob job) + G_GNUC_WARN_UNUSED_RESULT; =20 void virDomainObjEndJob(virDomainObj *obj); void virDomainObjEndAgentJob(virDomainObj *obj); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8befe7ebe0..03e186fe50 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1191,6 +1191,8 @@ virDomainObjBeginAgentJob; virDomainObjBeginAsyncJob; virDomainObjBeginJob; virDomainObjBeginJobInternal; +virDomainObjBeginJobNowait; +virDomainObjBeginNestedJob; virDomainObjCanSetJob; virDomainObjClearJob; virDomainObjEndAgentJob; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c494d75790..c526773633 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5968,7 +5968,7 @@ qemuDomainObjEnterMonitorInternal(virDomainObj *obj, =20 if (asyncJob !=3D VIR_ASYNC_JOB_NONE) { int ret; - if ((ret =3D qemuDomainObjBeginNestedJob(obj, asyncJob)) < 0) + if ((ret =3D virDomainObjBeginNestedJob(obj, asyncJob)) < 0) return ret; if (!virDomainObjIsActive(obj)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index 99dcdb49b9..a170fdd97d 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -655,50 +655,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj) obj->job->asyncOwner =3D 0; } =20 -int -qemuDomainObjBeginNestedJob(virDomainObj *obj, - virDomainAsyncJob asyncJob) -{ - if (asyncJob !=3D obj->job->asyncJob) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected async job %d type expected %d"), - asyncJob, obj->job->asyncJob); - return -1; - } - - if (obj->job->asyncOwner !=3D virThreadSelfID()) { - VIR_WARN("This thread doesn't seem to be the async job owner: %llu= ", - obj->job->asyncOwner); - } - - return virDomainObjBeginJobInternal(obj, obj->job, - VIR_JOB_ASYNC_NESTED, - VIR_AGENT_JOB_NONE, - VIR_ASYNC_JOB_NONE, - false); -} - -/** - * qemuDomainObjBeginJobNowait: - * - * @obj: domain object - * @job: virDomainJob to start - * - * Acquires job for a domain object which must be locked before - * calling. If there's already a job running it returns - * immediately without any error reported. - * - * Returns: see qemuDomainObjBeginJobInternal - */ -int -qemuDomainObjBeginJobNowait(virDomainObj *obj, - virDomainJob job) -{ - return virDomainObjBeginJobInternal(obj, obj->job, job, - VIR_AGENT_JOB_NONE, - VIR_ASYNC_JOB_NONE, true); -} - void qemuDomainObjAbortAsyncJob(virDomainObj *obj) { diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index 1cf9fcc113..c3de401aa5 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -69,13 +69,6 @@ int qemuDomainAsyncJobPhaseFromString(virDomainAsyncJob = job, void qemuDomainEventEmitJobCompleted(virQEMUDriver *driver, virDomainObj *vm); =20 -int qemuDomainObjBeginNestedJob(virDomainObj *obj, - virDomainAsyncJob asyncJob) - G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginJobNowait(virDomainObj *obj, - virDomainJob job) - G_GNUC_WARN_UNUSED_RESULT; - void qemuDomainObjAbortAsyncJob(virDomainObj *obj); void qemuDomainObjSetJobPhase(virDomainObj *obj, int phase); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e61a4e329b..a7ad1b1139 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18808,7 +18808,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, int rv; =20 if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT) - rv =3D qemuDomainObjBeginJobNowait(vm, VIR_JOB_QUERY); + rv =3D virDomainObjBeginJobNowait(vm, VIR_JOB_QUERY); else rv =3D virDomainObjBeginJob(vm, VIR_JOB_QUERY); =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 68a9efc7df..3efeeb64c5 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8106,7 +8106,7 @@ void qemuProcessStop(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); =20 if (asyncJob !=3D VIR_ASYNC_JOB_NONE) { - if (qemuDomainObjBeginNestedJob(vm, asyncJob) < 0) + if (virDomainObjBeginNestedJob(vm, asyncJob) < 0) goto cleanup; } else if (vm->job->asyncJob !=3D VIR_ASYNC_JOB_NONE && vm->job->asyncOwner =3D=3D virThreadSelfID() && --=20 2.37.1