[libvirt] [RFC 5/5]: Rewrite findLuns function

Stefan de Konink skinkie at xs4all.nl
Thu Jun 12 14:27:08 UTC 2008


Chris Lalancette schreef:
> Stefan de Konink wrote:
>> +	n = scandir(sysfs_path, &namelist, notdotdir, versionsort);
>> +	if (n <= 0) {
>> +		/* we didn't find any reasonable entries; return failure */
>> +		virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
>> +							  _("Failed to find any LUNs for session %s: %s"),
>> +							  session, strerror(errno));
>> +
>> +		return -1;
>> +	}
>>
>>
>> Who told you/anyone who wrote this code before that the 0th lun cannot 
>> be a real entry? This assumption is wrong.
> 
> Well, that particular piece of code isn't looking at the 0'th LUN, but there is
> code below that that is.  However, the code here is generally looking for block
> devices, and the 0'th LUN is definitely not a block device.  Given that, I'm not
> sure what else you would want to do with 0th LUN; can you give me some examples?

The 0th LUN can be a perfect block device.



xen01 3:0:0:0 # ls -l
total 0
-r--r--r-- 1 root root 4096 Jun 12 16:25 FUA
-rw-r--r-- 1 root root 4096 Jun 12 16:25 allow_restart
-rw-r--r-- 1 root root 4096 Jun 12 16:25 cache_type
lrwxrwxrwx 1 root root    0 Jun 12 16:23 device -> 
../../../devices/platform/host3/session3/target3:0:0/3:0:0:0
-rw-r--r-- 1 root root 4096 Jun 12 16:25 manage_start_stop
lrwxrwxrwx 1 root root    0 Jun 12 16:25 subsystem -> 
../../../class/scsi_disk
--w------- 1 root root 4096 Jun 12 16:25 uevent


cat /sys/class/iscsi_session/session3/targetname
iqn.1986-03.com.sun:02:c6719b9f-7993-444d-c6d2-80d4e15ee52c


And the same counts for a netapp target.



Stefan




More information about the libvir-list mailing list