[libvirt] [PATCH 1/2] util: Accept test data path for scsi device's sg_path

Osier Yang jyang at redhat.com
Thu Jan 30 11:48:22 UTC 2014


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 at redhat.com>
Reported-by: Hrdina Pavel <phrdina at redhat.com>

---
 src/util/virscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 731a01c..acc3815 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -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)) {
-- 
1.8.1.4




More information about the libvir-list mailing list