From nobody Tue Feb 10 02:59:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530965506238752.1783280519971; Sat, 7 Jul 2018 05:11:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A0EB3082A34; Sat, 7 Jul 2018 12:11:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57E385D6A5; Sat, 7 Jul 2018 12:11:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EC3F34A469; Sat, 7 Jul 2018 12:11:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w67CBEhA005927 for ; Sat, 7 Jul 2018 08:11:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 39D665C301; Sat, 7 Jul 2018 12:11:14 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-46.phx2.redhat.com [10.3.116.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id E971965F44 for ; Sat, 7 Jul 2018 12:11:13 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Sat, 7 Jul 2018 08:11:03 -0400 Message-Id: <20180707121107.7629-6-jferlan@redhat.com> In-Reply-To: <20180707121107.7629-1-jferlan@redhat.com> References: <20180707121107.7629-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 5/9] rpc: Introduce virNetServerWorkerCount X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Sat, 07 Jul 2018 12:11:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Get a count of the number of workers for all servers that are still processing a job. Signed-off-by: John Ferlan --- src/libvirt_remote.syms | 1 + src/rpc/virnetserver.c | 26 ++++++++++++++++++++++++++ src/rpc/virnetserver.h | 2 ++ 3 files changed, 29 insertions(+) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 9ee983fdf2..a8f937f32e 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -136,6 +136,7 @@ virNetServerSetThreadPoolParameters; virNetServerSetTLSContext; virNetServerStart; virNetServerUpdateServices; +virNetServerWorkerCount; =20 =20 # rpc/virnetserverclient.h diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index c426567d86..053ef8a5ab 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -842,6 +842,32 @@ virNetServerQuitRequested(virNetServerPtr srv) } =20 =20 +/* virNetServerWorkerCount: + * @srv: Netserver pointer + * + * Return the number of workers still waiting to be processed. This + * allows the quit requested code to wait for all worker jobs to be + * completed before actually quitting. + */ +size_t +virNetServerWorkerCount(virNetServerPtr srv) +{ + size_t workerCount; + + virObjectLock(srv); + + workerCount =3D virThreadPoolGetCurrentWorkers(srv->workers) + + virThreadPoolGetPriorityWorkers(srv->workers); + + if (workerCount > 0) + VIR_DEBUG("server '%s' still has %zd workers", srv->name, workerCo= unt); + + virObjectUnlock(srv); + + return workerCount; +} + + void virNetServerClose(virNetServerPtr srv) { size_t i; diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h index fcaf48fe14..3b2582e15b 100644 --- a/src/rpc/virnetserver.h +++ b/src/rpc/virnetserver.h @@ -60,6 +60,8 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONVal= uePtr object, =20 void virNetServerQuitRequested(virNetServerPtr srv); =20 +size_t virNetServerWorkerCount(virNetServerPtr srv); + void virNetServerClose(virNetServerPtr srv); =20 virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list