render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 898816e610057ccf4161563c93463e7f94e0b643 Mon Sep 17 00:00:00 2001
Message-Id: <898816e610057ccf4161563c93463e7f94e0b643@dist-git>
From: Osier Yang <jyang@redhat.com>
Date: Sun, 2 Feb 2014 23:09:43 +0800
Subject: [PATCH] util: Accept test data path for scsi device's sg_path

https://bugzilla.redhat.com/show_bug.cgi?id=957292

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>
(cherry picked from commit b1b81efe9a21b7e80e4f0523e67728999931ef89)
Signed-off-by: Jiri Denemark <jdenemar@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 f4a28e0..784fff9 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 (access(dev->sg_path, F_OK) != 0) {
-- 
1.8.5.4