cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-scsi-disk-Improve-error-messager-if-can-t-get-versio.patch

958e1b
From cd4c45ef3c5323053d76057a0435759ce84ede90 Mon Sep 17 00:00:00 2001
958e1b
From: Fam Zheng <famz@redhat.com>
958e1b
Date: Fri, 6 Jun 2014 04:11:38 +0200
958e1b
Subject: [PATCH 09/13] scsi-disk: Improve error messager if can't get version number
958e1b
958e1b
RH-Author: Fam Zheng <famz@redhat.com>
958e1b
Message-id: <1402027899-1917-2-git-send-email-famz@redhat.com>
958e1b
Patchwork-id: 59163
958e1b
O-Subject: [RHEL-7 qemu-kvm PATCH 1/2] scsi-disk: Improve error messager if can't get version number
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
More often it is that bdrv_ioctl fails due to not supported by driver or
958e1b
whatever reason, in this case we should be specific, because "interface
958e1b
too old" is very confusing.
958e1b
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
(cherry picked from commit 4bbeb8b173e8116851d5ececb93189ae34c68309)
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
---
958e1b
 hw/scsi/scsi-disk.c | 9 +++++++--
958e1b
 1 file changed, 7 insertions(+), 2 deletions(-)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/scsi/scsi-disk.c |    9 +++++++--
958e1b
 1 files changed, 7 insertions(+), 2 deletions(-)
958e1b
958e1b
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
958e1b
index 6491091..5a6384e 100644
958e1b
--- a/hw/scsi/scsi-disk.c
958e1b
+++ b/hw/scsi/scsi-disk.c
958e1b
@@ -2439,8 +2439,13 @@ static int scsi_block_initfn(SCSIDevice *dev)
958e1b
     }
958e1b
 
958e1b
     /* check we are using a driver managing SG_IO (version 3 and after) */
958e1b
-    if (bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0 ||
958e1b
-        sg_version < 30000) {
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
+                     strerror(-rc));
958e1b
+        return -1;
958e1b
+    }
958e1b
+    if (sg_version < 30000) {
958e1b
         error_report("scsi-block: scsi generic interface too old");
958e1b
         return -1;
958e1b
     }
958e1b
-- 
958e1b
1.7.1
958e1b