mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
parent
2215050edd
commit
cd782cc391
@ -41,6 +41,10 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
||||||
|
|
||||||
|
#ifndef TYPE_RAID
|
||||||
|
# define TYPE_RAID 12
|
||||||
|
#endif
|
||||||
|
|
||||||
struct _udevPrivate {
|
struct _udevPrivate {
|
||||||
struct udev_monitor *udev_monitor;
|
struct udev_monitor *udev_monitor;
|
||||||
int watch;
|
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 ret = 0;
|
||||||
int foundtype = 1;
|
int foundtype = 1;
|
||||||
@ -728,6 +733,9 @@ static int udevGetSCSIType(unsigned int type, char **typestring)
|
|||||||
case TYPE_ENCLOSURE:
|
case TYPE_ENCLOSURE:
|
||||||
*typestring = strdup("enclosure");
|
*typestring = strdup("enclosure");
|
||||||
break;
|
break;
|
||||||
|
case TYPE_RAID:
|
||||||
|
*typestring = strdup("raid");
|
||||||
|
break;
|
||||||
case TYPE_NO_LUN:
|
case TYPE_NO_LUN:
|
||||||
default:
|
default:
|
||||||
foundtype = 0;
|
foundtype = 0;
|
||||||
@ -739,7 +747,8 @@ static int udevGetSCSIType(unsigned int type, char **typestring)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
} else {
|
} 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)) {
|
switch (udevGetUintSysfsAttr(device, "type", &tmp, 0)) {
|
||||||
case PROPERTY_FOUND:
|
case PROPERTY_FOUND:
|
||||||
if (udevGetSCSIType(tmp, &data->scsi.type) == -1) {
|
if (udevGetSCSIType(def, tmp, &data->scsi.type) == -1) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user