Bug 1331552

Summary: libvirt should not disable auto_login of iscsi-targets that are *not* used by libvirt.
Product: [Fedora] Fedora Reporter: Fritz Elfert <fritz>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 24CC: agedosier, berrange, clalancette, crobinso, dyuan, fritz, itamar, jferlan, laine, libvirt-maint, lmen, veillard, virt-maint, yisun
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.3.3.1-4.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-26 20:55:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch none

Description Fritz Elfert 2016-04-28 19:13:17 UTC
Description of problem:
I have a setup where multiple iscsi targets are used for *both* libvirt (as a storage-pool) as well as the host system itself (as general storage). Of course, the desired autologin-mode for targets used as host storage is "automatic". However, whenever libvirtd starts, *all* targets are switched into manual mode. When the system is rebooted, then the next start fails for all the host-mounted filsystems.

I found this mail which i believe is the original reasoning for that
behavior:
https://www.redhat.com/archives/libvir-list/2010-November/msg00548.html

However: Since quite some time the mentioned behavior of iscsiadm has been changed and therefore the reasoning is obsolete. Instead, when performing discovery with iscsiadm, libvirt should use the --op nonpersistent argument in order to prevent any persistent changes in the first place, it then can safely skip the subsequent disabling of auto-login mode.

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. configure an iscsi storage pool for libvirt
2. use another iscsi target as host storage with auto-logon enabled
3. startup libvirt
4. reboot

Actual results:
The configured host storage fails, because no auto-login is performed.
Depending on the mount-point subsequent services may fail, if they depend on the mounted filesystem.

Expected results:
The configured host storage should automatically become available upon reboot.

Additional info:

Comment 1 Cole Robinson 2016-04-29 11:13:33 UTC
jferlan this seems like your area, any thoughts?

Comment 2 Fritz Elfert 2016-04-29 11:23:47 UTC
BTW: I'll try to come up with a patch over the weekend ...

Comment 3 John Ferlan 2016-04-29 12:57:45 UTC
My initial thought would be that changing the libvirt iSCSI backend code to utilize some new iscsiadm switch/option would only be valid if that switch option were available; otherwise, the existing mechanism would have to be used (and we'd need to document that). I don't stay current with the changes in iscsiadm, so I assume that switch would "do the right thing".

Whatever patches are developed need to take into account that an 'iscsiadm' may not have that switch. Checking for that in configure.ac is I'm sure possible, but I'm not the expert to know the "how" to do that.  You will end up with "WITH_" type conditionals that would then be used in the iSCSI storage backend to decide whether or not to use the switch.

Comment 4 Cole Robinson 2016-04-29 13:27:59 UTC
On latest RHEL6 at least the iscsiadm man page says it supports --op nonpersistent, so maybe we can use it unconditionally since we don't support RHEL5 host anymore.

Comment 5 Fritz Elfert 2016-04-29 16:10:30 UTC
If you look into iscsiadm's upstream git, you can see, that support for nonpersistent mode was added long time in March 2010 even before the original mail above was written. It just happened that - at that time - it was not yet released.
So: I'm certain, that this is supported even in older releases now (no need for a configure check!). See this commit: https://github.com/open-iscsi/open-iscsi/commit/ad873767436f1cc242f0d4a522a2fce7133795c1

Comment 6 Fritz Elfert 2016-04-29 17:11:50 UTC
Even in RHEL5.6 (checked against CentOS, because old RHEL sources are hard to find) this is supported since iscsi-initiator-utils-6.2.0.872-6.el5.src.rpm (released around Apr 2011).

Comment 7 Fritz Elfert 2016-04-29 21:48:56 UTC
Created attachment 1152419 [details]
proposed patch

This patch fixes the problem on my test system:
 - Non-libvirt related targets stay in automatic login mode
 - libvirt-related target stay in manual login mode
 - The whole setup "survives" a reboot.

Comment 8 Fritz Elfert 2016-04-29 21:56:30 UTC
As I have shown in Comments 5 and 6, the used "nonpersistent" feature is generally available since ~ April 2011. Therefore, I found it unnecessary to add a configure check. (According to https://access.redhat.com/support/policy/updates/errata RHEL 5.6 is EOL (EUS for 5.6 ended July 31, 2013 - almost 3 years ago!)

Comment 9 Cole Robinson 2016-04-30 19:21:02 UTC
Thanks for the patch! Please send it to libvir-list so it gets the proper attention

Comment 10 Cole Robinson 2016-05-02 20:13:32 UTC
Patch was sent:

http://www.redhat.com/archives/libvir-list/2016-May/msg00002.html

Comment 11 John Ferlan 2016-05-18 12:38:58 UTC
Adjustments to original patch were sent:

http://www.redhat.com/archives/libvir-list/2016-May/msg01162.html

reviewed, ACK'd, and pushed.


commit 56057900dc53df490d953d56de1195ebfa025bdd
Author: Fritz Elfert <fritz>
Date:   Fri May 13 11:19:09 2016 -0400

    util: Remove disabling of autologin for iscsi-targets


...
$ git describe 56057900dc53df490d953d56de1195ebfa025bdd
v1.3.4-340-g5605790
$

Comment 12 Cole Robinson 2016-06-23 19:40:13 UTC
I hit some conflicts backporting this to f23, so moving to f24

Comment 13 Fedora Update System 2016-06-23 22:31:43 UTC
libvirt-1.3.3.1-4.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b2f402a414

Comment 14 Fedora Update System 2016-06-25 00:31:53 UTC
libvirt-1.3.3.1-4.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b2f402a414

Comment 15 Fedora Update System 2016-06-26 20:54:46 UTC
libvirt-1.3.3.1-4.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.