1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

Support SCSI RAID type & lower log level for unknown types

The Linux kernel headers don't have a value for SCSI type 12,
but HAL source code shows this to be a 'raid'. Add workaround
for this type. Lower log level for unknown types since
this is not a fatal error condition. Include the device sysfs
path in the log output to allow identification of which device
has problems.

* src/node_device/node_device_udev.c: Add SCSI RAID type
This commit is contained in:
Daniel P. Berrange 2011-02-07 17:25:06 +00:00
parent 2215050edd
commit cd782cc391

View File

@ -41,6 +41,10 @@
#define VIR_FROM_THIS VIR_FROM_NODEDEV
#ifndef TYPE_RAID
# define TYPE_RAID 12
#endif
struct _udevPrivate {
struct udev_monitor *udev_monitor;
int watch;
@ -693,7 +697,8 @@ out:
}
static int udevGetSCSIType(unsigned int type, char **typestring)
static int udevGetSCSIType(virNodeDeviceDefPtr def,
unsigned int type, char **typestring)
{
int ret = 0;
int foundtype = 1;
@ -728,6 +733,9 @@ static int udevGetSCSIType(unsigned int type, char **typestring)
case TYPE_ENCLOSURE:
*typestring = strdup("enclosure");
break;
case TYPE_RAID:
*typestring = strdup("raid");
break;
case TYPE_NO_LUN:
default:
foundtype = 0;
@ -739,7 +747,8 @@ static int udevGetSCSIType(unsigned int type, char **typestring)
ret = -1;
virReportOOMError();
} else {
VIR_ERROR(_("Failed to find SCSI device type %d"), type);
VIR_DEBUG("Failed to find SCSI device type %d for %s",
type, def->sysfs_path);
}
}
@ -784,7 +793,7 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
switch (udevGetUintSysfsAttr(device, "type", &tmp, 0)) {
case PROPERTY_FOUND:
if (udevGetSCSIType(tmp, &data->scsi.type) == -1) {
if (udevGetSCSIType(def, tmp, &data->scsi.type) == -1) {
goto out;
}
break;