Skip USB devices during discovery
authorHannes Reinecke <hare@suse.de>
Wed, 3 Sep 2014 12:31:14 +0000 (14:31 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 29 Mar 2015 16:18:41 +0000 (18:18 +0200)
Some USB devices even present VPD pages, but they still remain
USB devices, and we shouldn't run multipath on those.
So detect USB devices properly and skip them during discovery.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/discovery.c

index a9962d1..c4aee1c 100644 (file)
@@ -275,6 +275,19 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
                }
        }
 
+       /* Check for USB */
+       tgtdev = udev_device_get_parent(parent);
+       while (tgtdev) {
+               value = udev_device_get_subsystem(tgtdev);
+               if (value && !strcmp(value, "usb")) {
+                       pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;
+                       tgtname = udev_device_get_sysname(tgtdev);
+                       strncpy(node, tgtname, strlen(tgtname));
+                       condlog(3, "%s: skip USB device %s", pp->dev, node);
+                       return 1;
+               }
+               tgtdev = udev_device_get_parent(tgtdev);
+       }
        parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_target");
        if (!parent)
                return 1;