]> xenbits.xensource.com Git - libvirt.git/commitdiff
Support SCSI RAID type & lower log level for unknown types
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 7 Feb 2011 17:25:06 +0000 (17:25 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 9 Feb 2011 16:20:38 +0000 (16:20 +0000)
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

src/node_device/node_device_udev.c

index 2da552987d0aacf929e9ee679d831667da4d4d3e..93390af398fd9a8ed11f9b715600c9ac29057d95 100644 (file)
 
 #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;