From nobody Thu Mar 28 23:49:28 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1570439650; cv=none; d=zoho.com; s=zohoarc; b=SyKDUeQ7KSYhdgL+IrzZWn45OjhFe2z51aA3xD4xBNIqthSWZA31BA7KwzubHhyLKLqE7d/UR9QSd4uB5pchSYBKtZhcskzqidEWPkwB9upCtck5eFEExnzEbtTeXH7EvOrtbbfTgWCSFy92vE96KUJhTnY72Ll0ui/mOHNS+0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570439650; 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:ARC-Authentication-Results; bh=7qUBeYNN3iAKD8D+DRUSI/ezPO1ngNEJrUUMBQ5WY7k=; b=Qb1xWvbnaGcT4q9n5VhfD++F1mPYgwg+yLF9X+LJ42fJERF3VDvRSjeuKvJ85K5ed4/Bs3lPKo+pMPZBtf69QcjkavMTiS5H0/AWZHiqadl0xPUWuD9nMsW2PihAvN7aGFxn85uyTn08TFzBXUn7ue2nVB4FA3W05Y8voxeG+So= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570439650568522.9846995860664; Mon, 7 Oct 2019 02:14:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 083883082199; Mon, 7 Oct 2019 09:14:09 +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 D54E219C7F; Mon, 7 Oct 2019 09:14:08 +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 8B34E24F30; Mon, 7 Oct 2019 09:14:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x979BW0x031549 for ; Mon, 7 Oct 2019 05:11:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1AEDB5C22F; Mon, 7 Oct 2019 09:11:32 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9863A5C223 for ; Mon, 7 Oct 2019 09:11:29 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 11:11:19 +0200 Message-Id: <0629563efafd3e36c6f0b80991009c3ad9867360.1570439448.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] qemu_driver: Fix comment of qemuStateCleanup() 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 07 Oct 2019 09:14:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The comment says that the function kills domains and networks. This is obviously not the case. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7d14588409..99db99e23a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1154,7 +1154,7 @@ qemuStateStop(void) /** * qemuStateCleanup: * - * Shutdown the QEMU daemon, it will stop all active domains and networks + * Release resources allocated by QEMU driver (no domain is shut off thoug= h) */ static int qemuStateCleanup(void) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 23:49:28 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1570439502; cv=none; d=zoho.com; s=zohoarc; b=cHCcmiZd+DjZkIO09+Xa/T9/hF6sx/sH2y10YTjPA+WjpWy4sXKkg202cmnpY5p/59lbTABDZQF0Kpx4cYq2TG7tOtAJ/mGaJIk8kfs9L4lPowdzujBW9h4hKGrnhn/c8anP9pInsV6KTFNzCdAsjGUlVvAnj1Y7NDTratbZUJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570439502; 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:ARC-Authentication-Results; bh=4RtoYj2KtB+oOFjFdhRx/GkTpMku24TG/J3C57PiCEY=; b=YJfaopZKhcUCy2G1YOFstBOMDUrwCNd/9VWyiRLa8g8UcooMmgFB3aG50N9DU8hRqzjsuiKUR8DgJZdpKaVp2vrEBCbpmpCn0shk6P2QFahOwkS7kv/Mp+XCFx9OrN46C64mc/ZoJ0aFQdmyfyqB80oTHTKshE/Rjl8FT0Gxmew= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570439502435741.3866874216404; Mon, 7 Oct 2019 02:11:42 -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 4DAA610C093A; Mon, 7 Oct 2019 09:11:40 +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 6DC695D772; Mon, 7 Oct 2019 09:11:38 +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 B72DD2551C; Mon, 7 Oct 2019 09:11:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x979BWUK031554 for ; Mon, 7 Oct 2019 05:11:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id E0C0C5C22F; Mon, 7 Oct 2019 09:11:32 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 683D25C223 for ; Mon, 7 Oct 2019 09:11:32 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 11:11:20 +0200 Message-Id: <1d9c8fc00c8e01c02bd462a99f1ebdbd8289792f.1570439448.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] driver: Introduce virDriverShouldAutostart() 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: , 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.6.2 (mx1.redhat.com [10.5.110.66]); Mon, 07 Oct 2019 09:11:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Some of objects we manage can be autostarted on libvirtd startup (e.g. domains, network, storage pools). The idea was that when the host is started up these objects are started too without need of user intervention. However, with the latest daemon split and switch to socket activated, short lived daemons (we put --timeout 120 onto each daemon's command line) this doesn't do what we want it to. The problem is not new though, we already had the session daemon come and go and we circumvented this problem by documenting it (see v4.10.0-92-g61b4e8aaf1). But now that we meet the same problem at all fronts it's time to deal with it. The solution implemented in this commit is to have a file (one per each driver) that: 1) if doesn't exist, is created and autostart is allowed for given driver, 2) if it does exist, then autostart is suppressed for given driver. All the files live in a location that doesn't survive host reboots (/var/run/ for instance) and thus the file is automatically not there on fresh host boot. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/driver.c | 39 +++++++++++++++++++++++++++++++++++++++ src/driver.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 43 insertions(+) diff --git a/src/driver.c b/src/driver.c index ed2d943ddf..305c4c624b 100644 --- a/src/driver.c +++ b/src/driver.c @@ -29,6 +29,7 @@ #include "virfile.h" #include "virlog.h" #include "virmodule.h" +#include "virstring.h" #include "virthread.h" #include "configmake.h" =20 @@ -69,6 +70,44 @@ virDriverLoadModule(const char *name, =20 /* XXX unload modules, but we can't until we can unregister libvirt driver= s */ =20 +/** + * virDriverShouldAutostart: + * @dir: driver's run state directory (usually /var/run/libvirt/$driver) + * @autostart: whether driver should initiate autostart + * + * Automatic starting of libvirt's objects (e.g. domains, networks, storage + * pools, etc.) doesn't play nice with using '--timeout' on daemon's comma= nd + * line because the objects are attempted to autostart on every start of + * corresponding driver/daemon. To resolve this problem, a file is created= in + * driver's private directory (which doesn't survive host's reboot) and th= us + * autostart is attempted only once. + */ +int +virDriverShouldAutostart(const char *dir, + bool *autostart) +{ + VIR_AUTOFREE(char *) path =3D NULL; + + *autostart =3D false; + + if (virAsprintf(&path, "%s/autostarted", dir) < 0) + return -1; + + if (virFileExists(path)) { + VIR_DEBUG("Autostart file %s exists, skipping autostart", path); + return 0; + } + + VIR_DEBUG("Autostart file %s does not exist, do autostart", path); + *autostart =3D true; + + if (virFileTouch(path, 0600) < 0) + return -1; + + return 0; +} + + virThreadLocal connectInterface; virThreadLocal connectNetwork; virThreadLocal connectNWFilter; diff --git a/src/driver.h b/src/driver.h index 68c0004d86..faf4788a4f 100644 --- a/src/driver.h +++ b/src/driver.h @@ -114,6 +114,9 @@ int virDriverLoadModule(const char *name, const char *regfunc, bool required); =20 +int virDriverShouldAutostart(const char *name, + bool *autostart); + virConnectPtr virGetConnectInterface(void); virConnectPtr virGetConnectNetwork(void); virConnectPtr virGetConnectNWFilter(void); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index eeab820eca..c818bc807a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1346,6 +1346,7 @@ virStreamClass; =20 # driver.h virConnectValidateURIPath; +virDriverShouldAutostart; virGetConnectInterface; virGetConnectNetwork; virGetConnectNodeDev; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 23:49:28 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1570439654; cv=none; d=zoho.com; s=zohoarc; b=Xcz/xxAVJCpDI0x5cI2FxwjLZn0KCJs6PhPxK+VXE4dQR3YAMOxkn+DmVqQJ6GK+6glnLwuXL7JvtPVU8/1uJX1vjTOp4BEkodVQ55OPs88f4TveNzqck1L7edAOM4MFqN8ISOYaKBM6Ucffvs/siPwYZFRNDbV3h79CU0dux4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570439654; 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:ARC-Authentication-Results; bh=9IzvtjPV2Ay4X3oVou5dVv4LUCSIRmkwqI5t1FRF3m0=; b=WE39crAaAhd7OlKi2Nlz/QzL4CMTHjitw4UeV0kLWTibQ4HkpO7l0psJKgU8pg5oLPdwuBanZdLOekKGs7sgUcH8FWQUp/W0G6lxOxqgUp7Mcy7+GXXaZ4fOIzp82jfBn7z7LG2Bi79H/9/ODa5Xfz8cBP4G5Id3PCicfViV4cc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570439654522750.5740101485771; Mon, 7 Oct 2019 02:14:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8541618C4272; Mon, 7 Oct 2019 09:14: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 5CBA860C05; Mon, 7 Oct 2019 09:14: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 190E024F33; Mon, 7 Oct 2019 09:14:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x979BZ3X031572 for ; Mon, 7 Oct 2019 05:11:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 991345C241; Mon, 7 Oct 2019 09:11:35 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 204B45C553 for ; Mon, 7 Oct 2019 09:11:33 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 11:11:21 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] lib: autostart objects exactly once 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Mon, 07 Oct 2019 09:14:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1755303 With the recent work in daemon split and socket activation daemons can come and go. They can and will be started many times during a session which results in objects being autostarted multiple times. This is not optimal. Use virDriverShouldAutostart() to determine if autostart should be done or not. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/bhyve/bhyve_driver.c | 8 +++++++- src/libxl/libxl_driver.c | 12 +++++++++--- src/lxc/lxc_driver.c | 7 ++++++- src/network/bridge_driver.c | 12 +++++++++--- src/qemu/qemu_driver.c | 7 ++++++- src/storage/storage_driver.c | 7 ++++++- 6 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index c52def7607..fb0996bd2a 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1218,6 +1218,8 @@ bhyveStateInitialize(bool privileged, virStateInhibitCallback callback ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { + bool autostart =3D true; + if (!privileged) { VIR_INFO("Not running privileged, disabling driver"); return VIR_DRV_STATE_INIT_SKIPPED; @@ -1301,7 +1303,11 @@ bhyveStateInitialize(bool privileged, =20 virBhyveProcessReconnectAll(bhyve_driver); =20 - bhyveAutostartDomains(bhyve_driver); + if (virDriverShouldAutostart(BHYVE_STATE_DIR, &autostart) < 0) + goto cleanup; + + if (autostart) + bhyveAutostartDomains(bhyve_driver); =20 return VIR_DRV_STATE_INIT_COMPLETE; =20 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 45de6b24c6..ea643b8a3f 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -655,6 +655,7 @@ libxlStateInitialize(bool privileged, libxlDriverConfigPtr cfg; char *driverConf =3D NULL; char ebuf[1024]; + bool autostart =3D true; =20 if (!libxlDriverShouldLoad(privileged)) return VIR_DRV_STATE_INIT_SKIPPED; @@ -800,9 +801,14 @@ libxlStateInitialize(bool privileged, NULL, NULL) < 0) goto error; =20 - virDomainObjListForEach(libxl_driver->domains, false, - libxlAutostartDomain, - libxl_driver); + if (virDriverShouldAutostart(cfg->stateDir, &autostart) < 0) + goto error; + + if (autostart) { + virDomainObjListForEach(libxl_driver->domains, false, + libxlAutostartDomain, + libxl_driver); + } =20 virDomainObjListForEach(libxl_driver->domains, false, libxlDomainManagedSaveLoad, diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index cf1dd1428e..a69589e50c 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1541,6 +1541,7 @@ static int lxcStateInitialize(bool privileged, { virCapsPtr caps =3D NULL; virLXCDriverConfigPtr cfg =3D NULL; + bool autostart =3D true; =20 /* Check that the user is root, silently disable if not */ if (!privileged) { @@ -1630,7 +1631,11 @@ static int lxcStateInitialize(bool privileged, NULL, NULL) < 0) goto cleanup; =20 - virLXCProcessAutostartAll(lxc_driver); + if (virDriverShouldAutostart(cfg->stateDir, &autostart) < 0) + goto cleanup; + + if (autostart) + virLXCProcessAutostartAll(lxc_driver); =20 virObjectUnref(caps); return VIR_DRV_STATE_INIT_COMPLETE; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index ae2e4f09f8..c05157c3ca 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -715,6 +715,7 @@ networkStateInitialize(bool privileged, int ret =3D VIR_DRV_STATE_INIT_ERROR; char *configdir =3D NULL; char *rundir =3D NULL; + bool autostart =3D true; #ifdef WITH_FIREWALLD DBusConnection *sysbus =3D NULL; #endif @@ -815,9 +816,14 @@ networkStateInitialize(bool privileged, networkReloadFirewallRules(network_driver, true); networkRefreshDaemons(network_driver); =20 - virNetworkObjListForEach(network_driver->networks, - networkAutostartConfig, - network_driver); + if (virDriverShouldAutostart(network_driver->stateDir, &autostart) < 0) + goto error; + + if (autostart) { + virNetworkObjListForEach(network_driver->networks, + networkAutostartConfig, + network_driver); + } =20 network_driver->networkEventState =3D virObjectEventStateNew(); =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 99db99e23a..bc0ede2fb0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -673,6 +673,7 @@ qemuStateInitialize(bool privileged, gid_t run_gid =3D -1; char *hugepagePath =3D NULL; char *memoryBackingPath =3D NULL; + bool autostart =3D true; size_t i; =20 if (VIR_ALLOC(qemu_driver) < 0) @@ -1035,7 +1036,11 @@ qemuStateInitialize(bool privileged, =20 qemuProcessReconnectAll(qemu_driver); =20 - qemuAutostartDomains(qemu_driver); + if (virDriverShouldAutostart(cfg->stateDir, &autostart) < 0) + goto error; + + if (autostart) + qemuAutostartDomains(qemu_driver); =20 return VIR_DRV_STATE_INIT_COMPLETE; =20 diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index d160ff34fe..c536535c6c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -258,6 +258,7 @@ storageStateInitialize(bool privileged, { VIR_AUTOFREE(char *) configdir =3D NULL; VIR_AUTOFREE(char *) rundir =3D NULL; + bool autostart =3D true; =20 if (VIR_ALLOC(driver) < 0) return VIR_DRV_STATE_INIT_ERROR; @@ -319,7 +320,11 @@ storageStateInitialize(bool privileged, =20 storagePoolUpdateAllState(); =20 - storageDriverAutostart(); + if (virDriverShouldAutostart(driver->stateDir, &autostart) < 0) + goto error; + + if (autostart) + storageDriverAutostart(); =20 driver->storageEventState =3D virObjectEventStateNew(); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 23:49:28 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1570439503; cv=none; d=zoho.com; s=zohoarc; b=ZLpq0SyM5vLr89OCsOt2LbEtnPAwQ94dJbBhs/zZxnjyXAxs0OMQ3OeFpz99rwLa2TW8M6fcxPGyUm8+swG9g18HGSQL7H0qvgSrBAXW/Hihdy5tV9rgSYq495/d4WRHJxLRMMfTJjsJzFWLGH7HTowGgb8rfeIlblCPhu/J/JI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570439503; 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:ARC-Authentication-Results; bh=visq8oWax08F2QQwOl1VR84aZrFYqRbesZja8hDO8Lo=; b=WGQglhp2qnQBpNZMHXVZL7NS8xc/mPsfxrCxuitVBYWj4XH9Oh8igJQb74DhSGeh/UPx4VVTbb8/e+ObniILtX6qhkJY+6Foo6EAsZMl2Ro5R3OEjixBk2qKmvVNjEIOKApDxNULAE3TpooaBcbALNdwU/FPnsto6MHivylIC9M= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570439503097196.49961089480655; Mon, 7 Oct 2019 02:11:43 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1CBCA18CB8E6; Mon, 7 Oct 2019 09:11:41 +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 BF1811001B01; Mon, 7 Oct 2019 09:11:40 +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 AFE962551F; Mon, 7 Oct 2019 09:11:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x979BalT031577 for ; Mon, 7 Oct 2019 05:11:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 67A775C223; Mon, 7 Oct 2019 09:11:36 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E50E65C241 for ; Mon, 7 Oct 2019 09:11:35 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 11:11:22 +0200 Message-Id: <0bb3900ce6b07158e0a8a0e550653a077ce771a9.1570439448.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] news: Document autostart fix 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Mon, 07 Oct 2019 09:11:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/news.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 9fd8f65515..d9c402e6bb 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -45,6 +45,21 @@
+ + + lib: autostart objects exactly once + + + If libvirtd or any of the sub-daemons is started with socket + activation then objects might be autostarted more than once. + For instance, if a domain under qemu:///session + URI is mark as autostarted and the session daemon is started the= n the + domain is started with it. If user shuts the domain down and the + session daemon is started again, the user's wish to keep the + domain shut off is ignored and the domain is autostarted again. + This is now fixed. + +
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 23:49:28 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1570439516; cv=none; d=zoho.com; s=zohoarc; b=KE6t6GbtGVZ9Ur+Q64SBpRELIVV4p2RBMpQEmfelnIZE2y+wz9p626fhtmZcJw4iWA8vGm4X5ujSpDoZU6aMQYNwj8dLAEsWoQ4V6/tzzzrw7Sp4cOOskX75skLNtdf8Kz/7adGInc0nmlXB3QDg/svUPp7D/T5FmrB/TeRgsMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570439516; 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:ARC-Authentication-Results; bh=liH5TW+a/Ce5Ug2td4j6Qx5Om4Gvqp20+4nPzTsD5Ps=; b=fssW06jMoJMV6jcxtFgRtKf1fn1Y5YfiQz8A3+pH/jKGCVOzcxr/JmweTntn6kYUF6FoQd7+T5j3gqDqALro+/DPCzxXxc0vdqQlAXhAiSjPEqNBls8a6CyzBW2Gyct5a9whEpy49lW5mYOQ/jJJeUkxMIWBJibd7IsAJQvPAKg= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570439516749618.5418928193513; Mon, 7 Oct 2019 02:11:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B356010CC1F2; Mon, 7 Oct 2019 09:11:54 +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 8ADEA60606; Mon, 7 Oct 2019 09:11:54 +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 4B4011803B47; Mon, 7 Oct 2019 09:11:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x979Bb19031585 for ; Mon, 7 Oct 2019 05:11:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 371525C241; Mon, 7 Oct 2019 09:11:37 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id B47F85C223 for ; Mon, 7 Oct 2019 09:11:36 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 11:11:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] Revert "src: Document autostart for session demon" 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Mon, 07 Oct 2019 09:11:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This reverts commit 61b4e8aaf1bce07f282c152de556c3d6aa8d65be. After previous commits this is no longer needed. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/libvirt-domain.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index e200dcc7d0..65c73be312 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -6696,11 +6696,6 @@ virDomainCreateWithFiles(virDomainPtr domain, unsign= ed int nfiles, * configured to be automatically started when the host * machine boots. * - * Please note that this might result in unexpected behaviour if - * used for some session URIs. Since the session daemon is started - * with --timeout it comes and goes and as it does so it - * autostarts domains which might have been shut off recently. - * * Returns -1 in case of error, 0 in case of success */ int --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list