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

Chris Lalancette clalance at redhat.com
Wed Mar 26 22:16:39 UTC 2008

     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

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 at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-iscsi-sysfs4.patch
Type: text/x-patch
Size: 5331 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080326/f3f8c91a/attachment-0001.bin>

More information about the libvir-list mailing list