]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Report error if vhost-scsi device file cannot be found
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Dec 2017 13:31:03 +0000 (08:31 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 13 Dec 2017 20:37:30 +0000 (15:37 -0500)
https://bugzilla.redhat.com/show_bug.cgi?id=1523564

If the vhost-scsi device file cannot be found, the generic error

    "error: An error occurred, but the cause is unknown"

is returned.  Let's add a real error message to make it clear
why the failure occurred.

src/util/virscsivhost.c

index d6fbf5ed5b213ccb603a1c64ce09cedc4a0c345b..5f176e177f44fb84069fd5cbacb43d9d68bb551e 100644 (file)
@@ -86,8 +86,12 @@ VIR_ONCE_GLOBAL_INIT(virSCSIVHost)
 int
 virSCSIVHostOpenVhostSCSI(int *vhostfd)
 {
-    if (!virFileExists(VHOST_SCSI_DEVICE))
+    if (!virFileExists(VHOST_SCSI_DEVICE)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("vhost-scsi device file '%s' cannot be found"),
+                       VHOST_SCSI_DEVICE);
         return -1;
+    }
 
     *vhostfd = open(VHOST_SCSI_DEVICE, O_RDWR);