thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
958e1b
From 3560dd9e730c41824fcaa9aeb9b4ee503aa98de1 Mon Sep 17 00:00:00 2001
958e1b
From: Fam Zheng <famz@redhat.com>
958e1b
Date: Fri, 6 Jun 2014 04:11:39 +0200
958e1b
Subject: [PATCH 10/13] scsi: Improve error messages more
958e1b
958e1b
RH-Author: Fam Zheng <famz@redhat.com>
958e1b
Message-id: <1402027899-1917-3-git-send-email-famz@redhat.com>
958e1b
Patchwork-id: 59164
958e1b
O-Subject: [RHEL-7 qemu-kvm PATCH 2/2] scsi: Improve error messages more
958e1b
Bugzilla: 1021788
958e1b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
RH-Acked-by: Amos Kong <akong@redhat.com>
958e1b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
958e1b
From: Paolo Bonzini <pbonzini@redhat.com>
958e1b
958e1b
Remove the "scsi-block:" prefix for error messages as suggested
958e1b
by Markus.
958e1b
958e1b
Improve the previous patch by making the message the same for both
958e1b
scsi-block and scsi-generic, including the strerror() output in both
958e1b
and making an explicit reference to SG_IO.  Also s/can not/cannot/.
958e1b
958e1b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
(cherry picked from commit 6ee143a0a4f8b5c437ac327e3d694a6a0e5380ad)
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
---
958e1b
 hw/scsi/scsi-disk.c    | 11 ++++++-----
958e1b
 hw/scsi/scsi-generic.c |  8 ++++++--
958e1b
 2 files changed, 12 insertions(+), 7 deletions(-)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/scsi/scsi-disk.c    |   11 ++++++-----
958e1b
 hw/scsi/scsi-generic.c |    8 ++++++--
958e1b
 2 files changed, 12 insertions(+), 7 deletions(-)
958e1b
958e1b
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
958e1b
index 5a6384e..1d41db2 100644
958e1b
--- a/hw/scsi/scsi-disk.c
958e1b
+++ b/hw/scsi/scsi-disk.c
958e1b
@@ -2434,26 +2434,27 @@ static int scsi_block_initfn(SCSIDevice *dev)
958e1b
     int rc;
958e1b
 
958e1b
     if (!s->qdev.conf.bs) {
958e1b
-        error_report("scsi-block: drive property not set");
958e1b
+        error_report("drive property not set");
958e1b
         return -1;
958e1b
     }
958e1b
 
958e1b
     /* check we are using a driver managing SG_IO (version 3 and after) */
958e1b
-    rc =  bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version);
958e1b
+    rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version);
958e1b
     if (rc < 0) {
958e1b
-        error_report("scsi-block: can not get version number: %s",
958e1b
+        error_report("cannot get SG_IO version number: %s.  "
958e1b
+                     "Is this a SCSI device?",
958e1b
                      strerror(-rc));
958e1b
         return -1;
958e1b
     }
958e1b
     if (sg_version < 30000) {
958e1b
-        error_report("scsi-block: scsi generic interface too old");
958e1b
+        error_report("scsi generic interface too old");
958e1b
         return -1;
958e1b
     }
958e1b
 
958e1b
     /* get device type from INQUIRY data */
958e1b
     rc = get_device_type(s);
958e1b
     if (rc < 0) {
958e1b
-        error_report("scsi-block: INQUIRY failed");
958e1b
+        error_report("INQUIRY failed");
958e1b
         return -1;
958e1b
     }
958e1b
 
958e1b
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
958e1b
index 8d92e0d..3733d2c 100644
958e1b
--- a/hw/scsi/scsi-generic.c
958e1b
+++ b/hw/scsi/scsi-generic.c
958e1b
@@ -394,6 +394,7 @@ static void scsi_destroy(SCSIDevice *s)
958e1b
 
958e1b
 static int scsi_generic_initfn(SCSIDevice *s)
958e1b
 {
958e1b
+    int rc;
958e1b
     int sg_version;
958e1b
     struct sg_scsi_id scsiid;
958e1b
 
958e1b
@@ -412,8 +413,11 @@ static int scsi_generic_initfn(SCSIDevice *s)
958e1b
     }
958e1b
 
958e1b
     /* check we are using a driver managing SG_IO (version 3 and after */
958e1b
-    if (bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0) {
958e1b
-        error_report("scsi generic interface not supported");
958e1b
+    rc = bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version);
958e1b
+    if (rc < 0) {
958e1b
+        error_report("cannot get SG_IO version number: %s.  "
958e1b
+                     "Is this a SCSI device?",
958e1b
+                     strerror(-rc));
958e1b
         return -1;
958e1b
     }
958e1b
     if (sg_version < 30000) {
958e1b
-- 
958e1b
1.7.1
958e1b