thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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