From: Anthony PERARD Subject: Re: [PATCH for-xen-4.5] tools/hotplug: fix systemd service files for dom0 Date: Thu, 23 Oct 2014 18:17:45 +0100 Message-ID: <20141023171745.GG8718@perard.uk.xensource.com> References: <1413364318-32048-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1413364318-32048-1-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Ian Jackson , Stefano Stabellini , Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Oct 15, 2014 at 11:11:58AM +0200, Olaf Hering wrote: > ConditionVirtualization= checks if systemd runs in some sort of guest. > It is not supposed to detect host capabilities. The current > implementation happens to work because systemd-detect-virt from v208 > returns also 'xen' in a dom0. In v210 and later 'none' is returned and > all service files are not started. > > Adjust the checks to detect a dom0 vs. native boot. Mounting xenfs > depends on /proc/xen, but should only be done for pvops because xenfs > exists only there. All other service files should not be started in > domU. The file /proc/xen/capabilities exists in both dom0 and domU in a > pvops kernel, but only in dom0 it contains 'control_d'. The existing > ExecStartPre= check will prevent starting in a domU. > > ConditionVirtualization=!xen is true in a dom0. But this check is broken > in systemd v208, so its not used. > > Signed-off-by: Olaf Hering > Cc: Ian Campbell > Cc: Ian Jackson > Cc: Stefano Stabellini > Cc: Wei Liu > --- > > I'm having a hard time to get a pvops dom0, so this is only tested with SUSE dom0. I've tested this patch in both dom0 and bare metal (with Linux 3.17.1 and systemd v216) and it mostly works, only one unit does not work, var-lib-xenstored.mount. (for some reason, ConditionVirtualization=xen, is still true on dom0 with systemd v216, even so systemd-detect-virt is returning 'none' ...) > tools/hotplug/Linux/systemd/proc-xen.mount.in | 3 ++- > tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in | 2 +- > tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in | 2 +- > tools/hotplug/Linux/systemd/xen-watchdog.service.in | 2 +- > tools/hotplug/Linux/systemd/xenconsoled.service.in | 2 +- > tools/hotplug/Linux/systemd/xendomains.service.in | 2 +- > tools/hotplug/Linux/systemd/xenstored.service.in | 2 +- > tools/hotplug/Linux/systemd/xenstored.socket.in | 2 +- > tools/hotplug/Linux/systemd/xenstored_ro.socket.in | 2 +- > 9 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/tools/hotplug/Linux/systemd/proc-xen.mount.in b/tools/hotplug/Linux/systemd/proc-xen.mount.in > index f0c4f3a..64ebe7f 100644 > --- a/tools/hotplug/Linux/systemd/proc-xen.mount.in > +++ b/tools/hotplug/Linux/systemd/proc-xen.mount.in > @@ -1,6 +1,7 @@ > [Unit] > Description=Mount /proc/xen files > -ConditionVirtualization=xen > +ConditionPathExists=/proc/xen > +ConditionPathExists=!/proc/xen/capabilities > RefuseManualStop=true > > [Mount] > diff --git a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in > index 1e930ed..64b560f 100644 > --- a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in > +++ b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in > @@ -1,6 +1,6 @@ > [Unit] > Description=mount xenstore file system > -ConditionVirtualization=xen > +ConditionPathExists=/proc/xen/capabilities On my systemd, var/lib/xenstored is not mounted because ConditionPathExists=/proc/xen/capabilities was not met even so proc-xen.mount is mounted. So there is probably a dependency missing on proc-xen.mount. > RefuseManualStop=true > > [Mount] -- Anthony PERARD