From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeUBY-0003Nb-Kf for qemu-devel@nongnu.org; Tue, 12 Jun 2012 12:43:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SeUBT-0006Hv-TF for qemu-devel@nongnu.org; Tue, 12 Jun 2012 12:43:16 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:57794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeUBT-0006A5-KO for qemu-devel@nongnu.org; Tue, 12 Jun 2012 12:43:11 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so1095823pbb.4 for ; Tue, 12 Jun 2012 09:43:10 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 12 Jun 2012 18:42:38 +0200 Message-Id: <1339519362-18852-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1339519362-18852-1-git-send-email-pbonzini@redhat.com> References: <1339519362-18852-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 06/10] ISCSI: force use of sg for SMC and SSC devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ronnie Sahlberg From: Ronnie Sahlberg If the device we open is a SMC or SSC device, then force the use of sg. We dont have any medium changer or tape emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway. Forcing sg also makes qemu skip trying to read from the device to guess the image format by reading from the device (find_image_format()). SMC devices do not implement READ6/10/12/16 so it is not possible to read from them (SSC have different CDBs). With this patch I can successfully manage a SMC device wiht iscsi in passthrough mode. Signed-off-by: Ronnie Sahlberg [Added TYPE_TAPE handling - Paolo] Signed-off-by: Paolo Bonzini --- block/iscsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index 029739e..ac65277 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1022,6 +1022,16 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags) if (iscsi_url != NULL) { iscsi_destroy_url(iscsi_url); } + + /* Medium changer or tape. We dont have any emulation for this so this must + * be sg ioctl compatible. We force it to be sg, otherwise qemu will try + * to read from the device to guess the image format. + */ + if (iscsilun->type == TYPE_MEDIUM_CHANGER || + iscsilun->type == TYPE_TAPE) { + bs->sg = 1; + } + return 0; failed: -- 1.7.10.2