[libvirt] libvirt does not logout of iscsi targets, causing system hang on shutdown

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi guys, 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. My local fix (diff) is attached. It 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. I was asked to post that here for discussion... So please consider this trivial change for the next update. Cheers -Fritz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlEvwhoACgkQboM4mAMyprB9agCgpIkGbSBKpfB4e0q6aqSMVGam rMoAnAtBpp3nFbleWLxJTbCt9EKO9Yx3 =2hHf -----END PGP SIGNATURE-----

On 02/28/2013 01:46 PM, Fritz Elfert wrote:
Hi guys,
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.
My local fix (diff) is attached. It 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.
I was asked to post that here for discussion... So please consider this trivial change for the next update.
+++ /etc/systemd/system/libvirtd.service 2013-02-28 06:34:41.341905146 +0100 @@ -7,6 +7,7 @@ Description=Virtualization daemon Before=libvirt-guests.service After=network.target +After=iscsid.service
Makes sense to me. My biggest doubt was whether this would make a system that previously did not use iscsid now suddenly start to require a service. But if I understood 'man systemd.unit' correctly, adding an 'After=' without a 'Wants=' or 'Requires=' is valid, and merely means that _if_ iscsid is enabled, then systemd will enforce the ordering, but that libvirtd will manage just fine even when iscsid is disabled. I'm not much of a systemd expert, so I'll wait until morning before pushing, to give anyone else a chance to disagree with my analysis or provide a more kosher fix. Otherwise, you have my ACK, and I think this deserves to be in 1.0.3. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/28/2013 11:38 PM, Eric Blake wrote:
On 02/28/2013 01:46 PM, Fritz Elfert wrote:
Hi guys,
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.
My local fix (diff) is attached. It 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.
I was asked to post that here for discussion... So please consider this trivial change for the next update.
+++ /etc/systemd/system/libvirtd.service 2013-02-28 06:34:41.341905146 +0100 @@ -7,6 +7,7 @@ Description=Virtualization daemon Before=libvirt-guests.service After=network.target +After=iscsid.service
Makes sense to me. My biggest doubt was whether this would make a system that previously did not use iscsid now suddenly start to require a service. But if I understood 'man systemd.unit' correctly, adding an 'After=' without a 'Wants=' or 'Requires=' is valid, and merely means that _if_ iscsid is enabled, then systemd will enforce the ordering, but that libvirtd will manage just fine even when iscsid is disabled.
I'm not much of a systemd expert, so I'll wait until morning before pushing, to give anyone else a chance to disagree with my analysis or provide a more kosher fix. Otherwise, you have my ACK, and I think this deserves to be in 1.0.3.
I wasn't shure either, so I just tried it out adding another After=idontexist.service. System rebooted and started libvirtd without complaining about the missing entry. - -Fritz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlEv4a4ACgkQboM4mAMyprCECQCdGdP6TN1Gp7iBCr9RroHPOMfo yagAoKgY0av/W4IIJopF7H9qdOz3bLqS =WyKi -----END PGP SIGNATURE-----

On 02/28/2013 03:38 PM, Eric Blake wrote:
On 02/28/2013 01:46 PM, Fritz Elfert wrote:
Hi guys,
There's a quite old bug entry here:
+++ /etc/systemd/system/libvirtd.service 2013-02-28 06:34:41.341905146 +0100 @@ -7,6 +7,7 @@ Description=Virtualization daemon Before=libvirt-guests.service After=network.target +After=iscsid.service
Makes sense to me. My biggest doubt was whether this would make a system that previously did not use iscsid now suddenly start to require a service. But if I understood 'man systemd.unit' correctly, adding an 'After=' without a 'Wants=' or 'Requires=' is valid, and merely means that _if_ iscsid is enabled, then systemd will enforce the ordering, but that libvirtd will manage just fine even when iscsid is disabled.
I'm not much of a systemd expert, so I'll wait until morning before pushing, to give anyone else a chance to disagree with my analysis or provide a more kosher fix. Otherwise, you have my ACK, and I think this deserves to be in 1.0.3.
Pushed now, as follows: From ba67de22ba7e4021885e55cbc2d0bb456bbc48bc Mon Sep 17 00:00:00 2001 From: Fritz Elfert <fritz@fritz-elfert.de> Date: Thu, 28 Feb 2013 21:46:19 +0100 Subject: [PATCH] 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. My local fix (diff) is attached. It 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. --- daemon/libvirtd.service.in | 1 + 1 file changed, 1 insertion(+) diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in index 98dd5a0..aa5913b 100644 --- a/daemon/libvirtd.service.in +++ b/daemon/libvirtd.service.in @@ -8,6 +8,7 @@ Description=Virtualization daemon Before=libvirt-guests.service After=network.target After=dbus.service +After=iscsid.service [Service] EnvironmentFile=-/etc/sysconfig/libvirtd -- 1.8.1.4 -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Fritz Elfert