[Libvir] [PATCH]: Make the iscsi backend work with updated iscsiadm tools

All, Updated versions of the iscsi-initiator-utils changed the output structure from the "iscsiadm -m session -P 3" command, which is being used in storage_backend_iscsi.c to gather the scsi devices available in a pool and present them as volumes. Consequently, when starting an iSCSI pool on a machine with a newer version of the iscsi tools, you can successfully define the pool, but will fail to find any LUNs on it. The attached patch lessens our dependency on this command by groping around sysfs for the information, instead of parsing it from the iscsiadm command. We still parse the command to get target, channel, id, and lun numbers, but then we cruise through sysfs looking for the corresponding /dev/sd? devices ourselves. This makes the libvirt iSCSI backend work for both older iscsiadm and newer iscsiadm. After much wrangling with iscsiadm and friends, I came to the conclusion that this is the best we can do with the current state of the iscsi tools; from what I can tell, there is no (simple) way to get away from parsing the iscsiadm output. This is a repost of a patch I had originally posted on 2/21; this patch incorporates Jim's comments at that time, and also adds better error checking and error strings. Please review and commit as appropriate. Signed-off-by: Chris Lalancette <clalance@redhat.com>

On Wed, Mar 26, 2008 at 06:16:39PM -0400, Chris Lalancette wrote:
All, Updated versions of the iscsi-initiator-utils changed the output structure from the "iscsiadm -m session -P 3" command, which is being used in storage_backend_iscsi.c to gather the scsi devices available in a pool and present them as volumes. Consequently, when starting an iSCSI pool on a machine with a newer version of the iscsi tools, you can successfully define the pool, but will fail to find any LUNs on it.
The attached patch lessens our dependency on this command by groping around sysfs for the information, instead of parsing it from the iscsiadm command. We still parse the command to get target, channel, id, and lun numbers, but then we cruise through sysfs looking for the corresponding /dev/sd? devices ourselves. This makes the libvirt iSCSI backend work for both older iscsiadm and newer iscsiadm.
After much wrangling with iscsiadm and friends, I came to the conclusion that this is the best we can do with the current state of the iscsi tools; from what I can tell, there is no (simple) way to get away from parsing the iscsiadm output.
This is a repost of a patch I had originally posted on 2/21; this patch incorporates Jim's comments at that time, and also adds better error checking and error strings. Please review and commit as appropriate.
okay, fine by me, applied and commited, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Chris Lalancette
-
Daniel Veillard