From nobody Tue May 7 18:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1615394290; cv=none; d=zohomail.com; s=zohoarc; b=PnrlT/U1X2UIRwQWwHt+tx24ARdWAGjPYAA93ZZlbIc3ty96yPvzJRb3td4u4kcg6bqDfF2bPscOLWr9CNEsf+IeDgjcAAhBTiiu4uBVqnTox/HBMEFo2qZv1fUH+CvmvasRfYOMagii4K4K8dr1GLq+W5Im5WZkW3Jk6Qt3pAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615394290; 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=ZHvr7Xp9ktIzUX3Osq5ds4TzcM8tcG1+Uw8IyAyoQvQ=; b=UasxztN4IT/LamTfywHj2u0tfOIzc++Ter9bJV07Xsm6IujMtD+NDh9/LH966Buf/EW9Liy5CAi2yCOyxV1+DAjzDm4Yg95mD5MGyYdY4hJzoWDDyaMghrcxfPnGrfaWbUwJ3upLjx+U0X5czR/T7vgPiAvK4u8bER1NHsULcA0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615394290503428.23651771147763; Wed, 10 Mar 2021 08:38:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-9-s9qN1CNcmRaNXiqNxPwQ-1; Wed, 10 Mar 2021 11:38:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E85EE108BD06; Wed, 10 Mar 2021 16:37:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8B4059453; Wed, 10 Mar 2021 16:37:59 +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 314041809C8B; Wed, 10 Mar 2021 16:37:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12AGbsq9022471 for ; Wed, 10 Mar 2021 11:37:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8C76418A9E; Wed, 10 Mar 2021 16:37:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id E009F6062F for ; Wed, 10 Mar 2021 16:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615394289; 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=ZHvr7Xp9ktIzUX3Osq5ds4TzcM8tcG1+Uw8IyAyoQvQ=; b=eSNWhqYWcJgLZxXm1tfsqf+wEEBDiFVAyEp48CeeRsPQlQLGDZO4uOtbE/ync0FPi1eifl w2BJzw/qNn4jcVelXLq29vWOBmFn7N9p09ClpCv6bThxpd9OicvcX2nBcT6CxO8fAw8lHm 7ef99AhVJhSU5ZQZUfYoq3DoC9CtGnQ= X-MC-Unique: 9-s9qN1CNcmRaNXiqNxPwQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] virnetdaemon: Introduce virNetDaemonQuitExecRestart Date: Wed, 10 Mar 2021 17:37:47 +0100 Message-Id: <8041ec6afedce00a7fd537411a3dd658370c2107.1615394109.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Recent changes which meant to fix daemon shutdown broke the exec-restart capability of virtlogd and virtlockd, since the code actually closed all the sockets and shut down all the internals. Add virNetDaemonQuitExecRestart, which requests a shutdown of the process, but keeps all the services open and registered since they are preserved across the restart. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/libvirt_remote.syms | 1 + src/rpc/virnetdaemon.c | 19 +++++++++++++++++++ src/rpc/virnetdaemon.h | 1 + 3 files changed, 21 insertions(+) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 3cd84a0854..605271bcb2 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -85,6 +85,7 @@ virNetDaemonNew; virNetDaemonNewPostExecRestart; virNetDaemonPreExecRestart; virNetDaemonQuit; +virNetDaemonQuitExecRestart; virNetDaemonRemoveShutdownInhibition; virNetDaemonRun; virNetDaemonSetShutdownCallbacks; diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index 327540c4b4..cac60ef488 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -76,6 +76,7 @@ struct _virNetDaemon { bool quit; bool finished; bool graceful; + bool execRestart; unsigned int autoShutdownTimeout; size_t autoShutdownInhibitions; @@ -857,6 +858,10 @@ virNetDaemonRun(virNetDaemonPtr dmn) virHashForEach(dmn->servers, daemonServerProcessClients, NULL); + /* don't shutdown services when performing an exec-restart */ + if (dmn->quit && dmn->execRestart) + goto cleanup; + if (dmn->quit && dmn->finishTimer =3D=3D -1) { virHashForEach(dmn->servers, daemonServerClose, NULL); if (dmn->shutdownPrepareCb && dmn->shutdownPrepareCb() < 0) @@ -912,6 +917,20 @@ virNetDaemonQuit(virNetDaemonPtr dmn) virObjectUnlock(dmn); } + +void +virNetDaemonQuitExecRestart(virNetDaemonPtr dmn) +{ + virObjectLock(dmn); + + VIR_DEBUG("Exec-restart requested %p", dmn); + dmn->quit =3D true; + dmn->execRestart =3D true; + + virObjectUnlock(dmn); +} + + static int daemonServerClose(void *payload, const char *key G_GNUC_UNUSED, diff --git a/src/rpc/virnetdaemon.h b/src/rpc/virnetdaemon.h index fcc6e1fdff..b3d81b6aaf 100644 --- a/src/rpc/virnetdaemon.h +++ b/src/rpc/virnetdaemon.h @@ -75,6 +75,7 @@ void virNetDaemonSetStateStopWorkerThread(virNetDaemonPtr= dmn, void virNetDaemonRun(virNetDaemonPtr dmn); void virNetDaemonQuit(virNetDaemonPtr dmn); +void virNetDaemonQuitExecRestart(virNetDaemonPtr dmn); bool virNetDaemonHasClients(virNetDaemonPtr dmn); --=20 2.29.2 From nobody Tue May 7 18:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1615394302; cv=none; d=zohomail.com; s=zohoarc; b=GvDQ+mk1+FRz6tMxMiWQtXdjxbx+qyVsR6TEtwGG7xjlfpdT0/JC6wyaGShY6GzZgWEXwutqZu9q5KA1oGQsDrykJbeWA7NCnhYGy2xJx6dBUKBm1TyqtXTqce98wA4zAiOl/NTFg4/Hq/j53JR/2gD0jgt4Ee32oqusUY9DbT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615394302; 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=yvRSs3vNXhwFGTtkAljvKHNnlj2Tr+7sAO0ZvYX411Y=; b=ZlVljyh1D2ICWqPPa7Tt2wBsgZq4/NzSnezO80UF13T5dqXJW5zBfQH+lQ7omXBh81rm3BrErGeRP44OF0HOTJd64u6rBHNjj6yrYUll8AFCZJnS8wwzpLzM97dG12zgWQdUnF2RaqSOh7XdutNBdXT9qttZ5Z4DCG1TTxrzO0k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615394302763226.93867234970787; Wed, 10 Mar 2021 08:38:22 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-j-UM_FDrM9yuqjpwNICeLA-1; Wed, 10 Mar 2021 11:38:19 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CAFB108BD0D; Wed, 10 Mar 2021 16:38:12 +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 7212010429A1; Wed, 10 Mar 2021 16:38:12 +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 1C5074EA69; Wed, 10 Mar 2021 16:38:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12AGbtUe022478 for ; Wed, 10 Mar 2021 11:37:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id A880718A9E; Wed, 10 Mar 2021 16:37:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067A06062F for ; Wed, 10 Mar 2021 16:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615394301; 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=yvRSs3vNXhwFGTtkAljvKHNnlj2Tr+7sAO0ZvYX411Y=; b=jPwod62SHVCCaDNX/jsh9UjAMayCTf6m9cXXgWRFHCXQekpky0MsOSOkDELcyDC3VZqPEZ EmKIG+6E1cNTQtCY8CvmrYG0BKDHtLMdYIvqz2RbYc06l/+1xqdCZVZmq0rLFHb7WNbZKW shKCTNXr+LD0NCKHCXGquHNUruoj/R4= X-MC-Unique: j-UM_FDrM9yuqjpwNICeLA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] virtlo(g|ck)d: Fix exec-restart Date: Wed, 10 Mar 2021 17:37:48 +0100 Message-Id: <592a5049c1cd4a719f75e06a80e4ab09180b246c.1615394109.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 94e45d1042e broke exec-restart of virtlogd and virtlockd as the code waiting for the daemon shutdown closed the daemons before exec-restarting. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1912243 Fixes: 94e45d1042e Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/locking/lock_daemon.c | 2 +- src/logging/log_daemon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 04038d2668..ffde2017ac 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -336,7 +336,7 @@ virLockDaemonExecRestartHandler(virNetDaemonPtr dmn, void *opaque G_GNUC_UNUSED) { execRestart =3D true; - virNetDaemonQuit(dmn); + virNetDaemonQuitExecRestart(dmn); } static int diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index aa76dcd329..e81de50899 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -283,7 +283,7 @@ virLogDaemonExecRestartHandler(virNetDaemonPtr dmn, void *opaque G_GNUC_UNUSED) { execRestart =3D true; - virNetDaemonQuit(dmn); + virNetDaemonQuitExecRestart(dmn); } static int --=20 2.29.2