|Summary:||libvirtd.service is missing 'After=nfs.target'|
|Product:||[Fedora] Fedora||Reporter:||Anders Blomdell <anders.blomdell>|
|Component:||libvirt||Assignee:||Libvirt Maintainers <libvirt-maint>|
|Status:||CLOSED WONTFIX||QA Contact:||Fedora Extras Quality Assurance <extras-qa>|
|Version:||20||CC:||berrange, clalancette, crobinso, itamar, jforbes, jyang, laine, libvirt-maint, veillard, virt-maint|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2014-02-14 14:14:35 UTC||Type:||Bug|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
|Cloudforms Team:||---||Target Upstream Version:|
Description Anders Blomdell 2014-01-28 18:02:18 UTC
Description of problem: livirtd.service does not contain 'After=nfs.target', hence shutting down a machine with active VM's might take a long time since the nfs-server might disappear before the VM's are properly shut down (and increasing the likelyhood of disk corruption). Version-Release number of selected component (if applicable): libvirt-daemon-126.96.36.199-1.fc20.x86_64 How reproducible: Always Steps to Reproduce: 1. Create a virtual machine with locally mounted nfs disks 2. Reboot the physical machine Actual results: Machine takes a long time to reboot, since the VM's hangs on non-accessible disks. Ample of time to se what happens by using the debug-shell.service. Expected results: VM's should shut down cleanly, then the physical machine should reboot.
Comment 1 Cole Robinson 2014-02-11 22:55:08 UTC
I don't think this is something that we should generally add to libvirt: while your use case happens to want some ordering between the host libvirt and host nfs service, this is not generally true. This basically stems from your host machine being a multi role server that the VMs depend on. If you are sharing samba from your host with your guest, do we need to add After=smbd ? Etc, etc. My suggestion is to override the libvirt unit file with your own custom one which adds the depedencies you need.
Comment 2 Anders Blomdell 2014-02-12 06:17:02 UTC
I obviously wasn't clear enough, the NFS disks is shared via a local NFS storage pool, and I think this usage case should be handled the same way as ISCSI (which has the correct After= rule in libvirtd.service), observe that this does not imply thet libvirtd requires NFS, only that if NFS is started on the machine, libvirtd will be stopped before NFS is brought down.
Comment 3 Cole Robinson 2014-02-12 15:22:57 UTC
Here's the commit adding After=iscsi commit 443ec5c8c36e05819eae6157211b3691bebfe970 Author: Fritz Elfert <email@example.com> Date: Thu Feb 28 21:46:19 2013 +0100 libvirt does not logout of iscsi targets, causing system hang on shutdown There's a quite old bug entry here: https://bugzilla.redhat.com/show_bug.cgi?id=700010 I just stumbled over that very issue on F18. Doing a little bit debugging of the shutdown sequence, it turns out that - at least on my F18 installation - libvirtd is shutdown *after* iscsid, which makes it impossible for libvirt to perform the logout of the iscsi session properly. This patch simply adds another startup dependancy on iscsid.service which in turn delays iscsid shutdown until after libvirtd has stopped. Having that applied, the system shuts down properly again. Signed-off-by: Eric Blake <firstname.lastname@example.org> I may be wrong about everything below, so someone jump in to correct me if needed. My understanding of iscsi is that even using iscsi as a client requires interacting with iscsid locally. In this case libvirt provides storage pool functionality to be an iscsi client. So we need to ensure that iscsid is running before libvirt so we can autostart the pool. And that libvirtd is stopped before iscsid so logout/cleanup can be confirmed. For _any_ use of libvirt + iscsi this is a requirement. However, nfs systemd services are only about nfs as a _server_. If you configured libvirt to point to a non-localhost NFS server, you could disable all NFS daemons on your local machine. So your suggestion of After=nfs is only relevant to the case when your localhost is also an NFS server. Which is a local configuration issue, and not something that generally applies to libvirt functionality. So my original position still stands, but I'll leave this open for a bit in case you want to rebut.
Comment 4 Anders Blomdell 2014-02-12 21:28:33 UTC
Of course you could disable all NFS functionality (in fact that is the default), and I did not say that I wanted a Wants= or a Requires=, so I still think that the NFS case is very similar to the iscsi case (i.e. the After=iscsi does in no way imply that iscsi has to be started, it only says that if it is started, libvirtd will be started afterwards and shut down before). So I still does not understand the difference between these two cases.
Comment 5 Cole Robinson 2014-02-13 15:16:21 UTC
The difference is that for libvirt iscsi pool/client to work, regardless of where the iscsi share is, libvirtd always has to be started after iscsid. For libvirt NFS pools to work, it has no requirement on host nfs services. In your case, the only reason the After=nfs helps is because your host is also an NFS server. Following that logic, do we have to add an after smbd, or gluster, or rbd/ceph for the case that the host might be exporting those resources to guests as well? What if guests are talking to host mysql or postgres ? The problem you are describing is not specific to NFS and it wouldn't scale to add After= for every host service that might be shared with VMs. The iscsi dep is only because iscsi is different in this regard, so any iscsi pool usage will always require that dep.
Comment 6 Anders Blomdell 2014-02-14 12:01:50 UTC
Since I don't want to modify upstream systemd files, I guess that the solution is a dummy service to enforce ordering? [Unit] Description=Enforce local libvirtd dependency kludge Wants=network.target Requires=nfs.target Requires=libvirtd.service After=network.target After=nfs.target Before=libvirtd.service [Service] Type=oneshot RemainAfterExit=yes StandardOutput=journal ExecStart=/bin/echo Start ExecStop=/bin/echo Stop [Install] WantedBy=libvirtd.service This seems to do what I want, so it's OK to close this now.
Comment 7 Daniel Berrange 2014-02-14 12:18:33 UTC
NB you don't need to create dummy services. You can override any aspect of any existing service, without editing the original distro provided file. Just create /etc/systemd/system/libvirtd.service.d/myoverride.conf and put any systemd conf in there and it'll override the regular libvirtd.service setting.
Comment 8 Anders Blomdell 2014-02-14 14:00:00 UTC
Had totally missed that, great thanks!
Comment 9 Cole Robinson 2014-02-14 14:14:35 UTC
Sounds like another solution was reached, so closing