render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c401cc
From 898816e610057ccf4161563c93463e7f94e0b643 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <898816e610057ccf4161563c93463e7f94e0b643@dist-git>
c401cc
From: Osier Yang <jyang@redhat.com>
c401cc
Date: Sun, 2 Feb 2014 23:09:43 +0800
c401cc
Subject: [PATCH] util: Accept test data path for scsi device's sg_path
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=957292
c401cc
c401cc
Commit 10c9ceff6d intended to introduce new argument for the
c401cc
testing purpose, but it missed the similar changing of the
c401cc
device's sg_path. The problem was hidden since my laptop has
c401cc
the /dev/sg0 and /dev/sg1.  A later patch will modify the tests
c401cc
accordingly.
c401cc
c401cc
Signed-off-by: Osier Yang <jyang@redhat.com>
c401cc
Reported-by: Pavel Hrdina <phrdina@redhat.com>
c401cc
(cherry picked from commit b1b81efe9a21b7e80e4f0523e67728999931ef89)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/util/virscsi.c | 3 ++-
c401cc
 1 file changed, 2 insertions(+), 1 deletion(-)
c401cc
c401cc
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
c401cc
index f4a28e0..784fff9 100644
c401cc
--- a/src/util/virscsi.c
c401cc
+++ b/src/util/virscsi.c
c401cc
@@ -222,7 +222,8 @@ virSCSIDeviceNew(const char *sysfs_prefix,
c401cc
 
c401cc
     if (virAsprintf(&dev->name, "%d:%d:%d:%d", dev->adapter,
c401cc
                     dev->bus, dev->target, dev->unit) < 0 ||
c401cc
-        virAsprintf(&dev->sg_path, "/dev/%s", sg) < 0)
c401cc
+        virAsprintf(&dev->sg_path, "%s/%s",
c401cc
+                    sysfs_prefix ? sysfs_prefix : "/dev", sg) < 0)
c401cc
         goto cleanup;
c401cc
 
c401cc
     if (access(dev->sg_path, F_OK) != 0) {
c401cc
-- 
c401cc
1.8.5.4
c401cc