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(a)redhat.com>