From patchwork Thu Oct 26 15:25:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olaf Hering X-Patchwork-Id: 10028567 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAD706032C for ; Thu, 26 Oct 2017 15:28:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC9F928E7D for ; Thu, 26 Oct 2017 15:28:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B16A028E81; Thu, 26 Oct 2017 15:28:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29A9B28E80 for ; Thu, 26 Oct 2017 15:28:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7k2m-0002LO-Co; Thu, 26 Oct 2017 15:26:04 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7k2k-0002LI-2b for xen-devel@lists.xen.org; Thu, 26 Oct 2017 15:26:02 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id E5/06-05089-98EF1F95; Thu, 26 Oct 2017 15:26:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRWlGSWpSXmKPExsUSuHLSIt2Ofx8 jDTafV7NY8nExiwOjx9Hdv5kCGKNYM/OS8isSWDM6HvxlLrjnUTG1axtrA+Myxy5GLg4WgdtM El1zfjB2MXJySAgUSjw9s4Wpi5EDyBaRePI/DaRGSOAkk8TiWZ9ZQGrYBJQk9h48DlYvIpAqM WNqN1icWcBPYt//6awgtrCAr8SiORvAalgEVCU27L3JDmLzChhL/Dj5hwlil7zE+wX3GScwci 9gZFjFqF6cWlSWWqRrrJdUlJmeUZKbmJmja2hgrJebWlycmJ6ak5hUrJecn7uJEehdBiDYwdj 8xekQoyQHk5IoL8OeD5FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHg7/36MFBIsSk1PrUjLzAGG GUxagoNHSYR3H0iat7ggMbc4Mx0idYrRnuPYpst/mDh+TLoCJDtu3gWSz2a+bmAWYsnLz0uVE ue9A9ImANKWUZoHNxQWF5cYZaWEeRmBzhTiKUgtys0sQZV/xSjOwagkzMsAMoUnM68EbvcroL OYgM5qUv0AclZJIkJKqoExP0ncYuk7Z8mI++IcOxeG393Uxrfu4kLhmZF7DgXd/9d9y+fVZ83 W9zUtEXdcBWz+/ov+xXfu/M466etTVxxaK/Jptqj7Y4UNW4UrHuS80q8u+dYx7UejiPqiN/O3 p3eIpSkxWq4Mjo+NfRq7ZEZGY15z41Ht36tcm8LX97zTUJinMm1WXjG/EktxRqKhFnNRcSIA/ JOElIYCAAA= X-Env-Sender: olaf@aepfle.de X-Msg-Ref: server-5.tower-31.messagelabs.com!1509031560!108881645!1 X-Originating-IP: [81.169.146.162] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: QmFkIElQOiA4MS4xNjkuMTQ2LjE2MiA9PiA1ODg3NDY=\n,sa_preprocessor: QmFkIElQOiA4MS4xNjkuMTQ2LjE2MiA9PiA1ODg3NDY=\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10659 invoked from network); 26 Oct 2017 15:26:00 -0000 Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.162) by server-5.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 26 Oct 2017 15:26:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1509031560; s=domk; d=aepfle.de; h=Date:Subject:Cc:To:From; bh=TaXCdo/Ct+Gia4Jx4hBtGCjXqc9qOpKs5oHc+CQjFFU=; b=WNlukwWOZJpYKxh8PsFBbn7JOpU3iGIUy7NFij5hwDJ4u1kBxa0Eg/p2ztiHD0xOho vwnEhYWy9upJuPma5qwVxVm0XfXlIa6CnUsR4BVnVaheX4Hct7AkRlXl8n0XPZJ4C4MU YbMXm8bG4hrbZ/Fm64G50w9aMLH+Py+zsqBC8= X-RZG-AUTH: :P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QDiZbDmui9LcK/RdXt7GAQpV1nK0XLk0FfrHA2zt2fWWcN43WM7gmJI9GNIbK1VMoLDVZG X-RZG-CLASS-ID: mo00 Received: from sender ([2001:a61:3466:92ff:fcda:6e93:35f6:d572]) by smtp.strato.de (RZmta 42.8 AUTH) with ESMTPSA id m0591at9QFPlpzz (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 26 Oct 2017 17:25:47 +0200 (CEST) From: Olaf Hering To: xen-devel@lists.xen.org, Ian Jackson , Wei Liu Date: Thu, 26 Oct 2017 17:25:36 +0200 Message-Id: <20171026152536.17072-1-olaf@aepfle.de> X-Mailer: git-send-email 2.14.2 Cc: Olaf Hering , Vasilis Liaskovitis Subject: [Xen-devel] [PATCH v1] tools/hotplug: convert proc-xen.mount to proc-xen.service X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP An upcoming change in systemd will mount xenfs right away, along with all other system mounts. This improves the detection of the virtualization environment, which is currently racy. Some parts of systemd rely on the presence of /proc/xen/capabilities, which will only exist if xenfs is mounted. Since xenfs is mounted by the proc-xen.mount unit, it will be processed very late. Other units may be processed earlier, and if they make use of ConditionVirtualization*= failures may occour. Unfortunately mounting xenfs by systemd as an API filesystem will lead to errors when proc-xen.mount is processed. Since that mount point already exists the unit is considered as failed, and other units that depend on proc-xen.mount will not start. To avoid this the existing proc-xen.mount will be converted into proc-xen.service, which just mounts xenfs manually. All dependencies are updated by this change. The existing conditionals in proc-xen.mount will prevent failures with existing systemd based installations: ConditionPathExists=!/proc/xen/capabilities will prevent execution with a new systemd that mounts xenfs. And this conditional, in combination with ConditionPathExists=/proc/xen, will trigger execution with an old systemd. An absolute path to the mount binary has to be used. /bin/mount is expected to be universally available, nowaways it is a symlink to /usr/bin/mount. Signed-off-by: Olaf Hering --- based on 4.10.0-rc2 Please run autogen.sh: tools/configure.ac | 2 +- tools/hotplug/Linux/systemd/Makefile | 6 +++--- .../Linux/systemd/{proc-xen.mount.in => proc-xen.service.in} | 8 ++++---- tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in | 4 ++-- tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 4 ++-- tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in | 4 ++-- tools/hotplug/Linux/systemd/xen-watchdog.service.in | 4 ++-- tools/hotplug/Linux/systemd/xenconsoled.service.in | 4 ++-- tools/hotplug/Linux/systemd/xendomains.service.in | 4 ++-- tools/hotplug/Linux/systemd/xendriverdomain.service.in | 4 ++-- tools/hotplug/Linux/systemd/xenstored.service.in | 6 +++--- 11 files changed, 25 insertions(+), 25 deletions(-) rename tools/hotplug/Linux/systemd/{proc-xen.mount.in => proc-xen.service.in} (60%) diff --git a/tools/configure.ac b/tools/configure.ac index d1a3a78d87..7b18421fa0 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -441,7 +441,7 @@ AX_AVAILABLE_SYSTEMD() AS_IF([test "x$systemd" = "xy"], [ AC_CONFIG_FILES([ - hotplug/Linux/systemd/proc-xen.mount + hotplug/Linux/systemd/proc-xen.service hotplug/Linux/systemd/var-lib-xenstored.mount hotplug/Linux/systemd/xen-init-dom0.service hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile index a5d41d86ef..855ff3747f 100644 --- a/tools/hotplug/Linux/systemd/Makefile +++ b/tools/hotplug/Linux/systemd/Makefile @@ -3,10 +3,10 @@ include $(XEN_ROOT)/tools/Rules.mk XEN_SYSTEMD_MODULES = xen.conf -XEN_SYSTEMD_MOUNT = proc-xen.mount -XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount +XEN_SYSTEMD_MOUNT = var-lib-xenstored.mount -XEN_SYSTEMD_SERVICE = xenstored.service +XEN_SYSTEMD_SERVICE = proc-xen.service +XEN_SYSTEMD_SERVICE += xenstored.service XEN_SYSTEMD_SERVICE += xenconsoled.service XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service XEN_SYSTEMD_SERVICE += xendomains.service diff --git a/tools/hotplug/Linux/systemd/proc-xen.mount.in b/tools/hotplug/Linux/systemd/proc-xen.service.in similarity index 60% rename from tools/hotplug/Linux/systemd/proc-xen.mount.in rename to tools/hotplug/Linux/systemd/proc-xen.service.in index 64ebe7f9b1..76f0097b75 100644 --- a/tools/hotplug/Linux/systemd/proc-xen.mount.in +++ b/tools/hotplug/Linux/systemd/proc-xen.service.in @@ -4,7 +4,7 @@ ConditionPathExists=/proc/xen ConditionPathExists=!/proc/xen/capabilities RefuseManualStop=true -[Mount] -What=xenfs -Where=/proc/xen -Type=xenfs +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/bin/mount -t xenfs xenfs /proc/xen diff --git a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in index 11a7d50edc..5d171f82e8 100644 --- a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in +++ b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in @@ -1,7 +1,7 @@ [Unit] Description=mount xenstore file system -Requires=proc-xen.mount -After=proc-xen.mount +Requires=proc-xen.service +After=proc-xen.service ConditionPathExists=/proc/xen/capabilities RefuseManualStop=true diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in index 3befadcea3..c560fbe1b7 100644 --- a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in +++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in @@ -1,7 +1,7 @@ [Unit] Description=xen-init-dom0, initialise Dom0 configuration (xenstore nodes, JSON configuration stub) -Requires=xenstored.service proc-xen.mount -After=xenstored.service proc-xen.mount +Requires=xenstored.service proc-xen.service +After=xenstored.service proc-xen.service ConditionPathExists=/proc/xen/capabilities [Service] diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in index f56775bc87..1b95104823 100644 --- a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in +++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in @@ -1,7 +1,7 @@ [Unit] Description=qemu for xen dom0 disk backend -Requires=proc-xen.mount xenstored.service -After=proc-xen.mount xenstored.service xenconsoled.service +Requires=proc-xen.service xenstored.service +After=proc-xen.service xenstored.service xenconsoled.service Before=xendomains.service libvirtd.service libvirt-guests.service RefuseManualStop=true ConditionPathExists=/proc/xen/capabilities diff --git a/tools/hotplug/Linux/systemd/xen-watchdog.service.in b/tools/hotplug/Linux/systemd/xen-watchdog.service.in index 1eecd2a616..3b9aff5e3b 100644 --- a/tools/hotplug/Linux/systemd/xen-watchdog.service.in +++ b/tools/hotplug/Linux/systemd/xen-watchdog.service.in @@ -1,7 +1,7 @@ [Unit] Description=Xen-watchdog - run xen watchdog daemon -Requires=proc-xen.mount -After=proc-xen.mount xendomains.service +Requires=proc-xen.service +After=proc-xen.service xendomains.service ConditionPathExists=/proc/xen/capabilities [Service] diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in index 8e333b114e..2a01262ecd 100644 --- a/tools/hotplug/Linux/systemd/xenconsoled.service.in +++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in @@ -1,7 +1,7 @@ [Unit] Description=Xenconsoled - handles logging from guest consoles and hypervisor -Requires=proc-xen.mount xenstored.service -After=proc-xen.mount xenstored.service +Requires=proc-xen.service xenstored.service +After=proc-xen.service xenstored.service ConditionPathExists=/proc/xen/capabilities [Service] diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in index c7bfb61eb4..f89460da35 100644 --- a/tools/hotplug/Linux/systemd/xendomains.service.in +++ b/tools/hotplug/Linux/systemd/xendomains.service.in @@ -1,7 +1,7 @@ [Unit] Description=Xendomains - start and stop guests on boot and shutdown -Requires=proc-xen.mount xenstored.service -After=proc-xen.mount xenstored.service xenconsoled.service xen-init-dom0.service +Requires=proc-xen.service xenstored.service +After=proc-xen.service xenstored.service xenconsoled.service xen-init-dom0.service After=network-online.target After=remote-fs.target ConditionPathExists=/proc/xen/capabilities diff --git a/tools/hotplug/Linux/systemd/xendriverdomain.service.in b/tools/hotplug/Linux/systemd/xendriverdomain.service.in index c39ec04182..c3b0a32147 100644 --- a/tools/hotplug/Linux/systemd/xendriverdomain.service.in +++ b/tools/hotplug/Linux/systemd/xendriverdomain.service.in @@ -1,7 +1,7 @@ [Unit] Description=Xen driver domain device daemon -Requires=proc-xen.mount -After=proc-xen.mount +Requires=proc-xen.service +After=proc-xen.service ConditionVirtualization=xen [Service] diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in index 80c1d408a5..da1f197d11 100644 --- a/tools/hotplug/Linux/systemd/xenstored.service.in +++ b/tools/hotplug/Linux/systemd/xenstored.service.in @@ -1,7 +1,7 @@ [Unit] Description=The Xen xenstore -Requires=proc-xen.mount var-lib-xenstored.mount -After=proc-xen.mount var-lib-xenstored.mount +Requires=proc-xen.service var-lib-xenstored.mount +After=proc-xen.service var-lib-xenstored.mount Before=libvirtd.service libvirt-guests.service RefuseManualStop=true ConditionPathExists=/proc/xen/capabilities @@ -15,5 +15,5 @@ ExecStart=@XEN_SCRIPT_DIR@/launch-xenstore [Install] WantedBy=multi-user.target -Also=proc-xen.mount +Also=proc-xen.service Also=var-lib-xenstored.mount