]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Accept test data path for scsi device's sg_path
authorOsier Yang <jyang@redhat.com>
Thu, 30 Jan 2014 11:48:22 +0000 (19:48 +0800)
committerPavel Hrdina <phrdina@redhat.com>
Thu, 30 Jan 2014 15:34:43 +0000 (16:34 +0100)
Commit 10c9ceff6d intended to introduce new argument for the
testing purpose, but it missed the similar changing of the
device's sg_path. The problem was hidden since my laptop has
the /dev/sg0 and /dev/sg1.  A later patch will modify the tests
accordingly.

Signed-off-by: Osier Yang <jyang@redhat.com>
Reported-by: Pavel Hrdina <phrdina@redhat.com>
src/util/virscsi.c

index 731a01cf4faa65505966d287ce2a24c0d72a3bc7..acc38159894be2471225fceb5f3229ba3a02a2aa 100644 (file)
@@ -222,7 +222,8 @@ virSCSIDeviceNew(const char *sysfs_prefix,
 
     if (virAsprintf(&dev->name, "%d:%d:%d:%d", dev->adapter,
                     dev->bus, dev->target, dev->unit) < 0 ||
-        virAsprintf(&dev->sg_path, "/dev/%s", sg) < 0)
+        virAsprintf(&dev->sg_path, "%s/%s",
+                    sysfs_prefix ? sysfs_prefix : "/dev", sg) < 0)
         goto cleanup;
 
     if (!virFileExists(dev->sg_path)) {