[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aperi-dev] Help, please, review Agent->ProbeLinux() error handling...
|
Hi,
I've been working on a fix for bug #208708
Question at the top: should FindPartitions() really return 8 to abort
the probe when it fails to get partition info from a device?
Details:
The first part of the fix changes ProbeLinux.java to search for SCSI
controllers in /sys/class/scsi_host (rather than /proc/scsi/*/host#)
These SCSI devices are present:
linux:/sys/class/scsi_host # lsscsi
[0:0:8:0] enclosu DP BACKPLANE 1.05 -
[0:2:0:0] disk DELL PERC 5/i 1.03 /dev/sda
[1:0:0:0] storage COMPAQ MSA1000 5.10 -
[1:0:0:1] disk COMPAQ MSA1000 VOLUME 5.10 /dev/sdb
[1:0:0:2] disk COMPAQ MSA1000 VOLUME 5.10 /dev/sdc
[1:0:0:3] disk COMPAQ MSA1000 VOLUME 5.10 /dev/sdd
[1:0:0:4] disk COMPAQ MSA1000 VOLUME 5.10 /dev/sde
[2:0:0:0] cd/dvd Dell Virtual CDROM 123 /dev/sr0
[3:0:0:0] disk Dell Virtual Floppy 123 /dev/sdf
But because
[3:0:0:0] disk Dell Virtual Floppy 123 /dev/sdf
looks like a SCSI disk, the agent tries to FindPartitions(), which runs
sfdisk -l -uS /dev/sdf
But it's not really a disk, it's a virtual floppy with no media present,
and sfdisk fails to open the device.
which means that ProbeLinux.java line 350 returns an error x == 8
x = probeSCSIDevice(buf.toString(), sgFlag, sgBuf.toString());
buf.setLength(7);
sgBuf.setLength(7);
if (x > rc)
rc = x;
}
}
if (rc > 4)
throw new GeneralException();
The native probeSCSIDevice() calls FindPartitions(). Should this
return 8, to abort the probe, just because sfdisk failed on a non-disk?
* Returns one of the following:
*
* 0 : Success. This does not necessarily mean that *ptr is non-NULL.
* 4 : Device should not be saved.
* 8 : Probe should be aborted.
*/
static int
FindPartitions(JNIEnv *env, struct device *devStruct, struct chunk **ptr)
Thanks,
Robert