From patchwork Sat May 26 04:56:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ronnie sahlberg X-Patchwork-Id: 161449 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 92292B6F13 for ; Sat, 26 May 2012 15:10:54 +1000 (EST) Received: from localhost ([::1]:54169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SY9HA-0004mc-Bu for incoming@patchwork.ozlabs.org; Sat, 26 May 2012 01:10:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SY9Gi-0003pT-DH for qemu-devel@nongnu.org; Sat, 26 May 2012 01:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SY9Gg-0007rr-LF for qemu-devel@nongnu.org; Sat, 26 May 2012 01:10:23 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:58578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SY9Gg-0007Zv-DR for qemu-devel@nongnu.org; Sat, 26 May 2012 01:10:22 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so2858225pbb.4 for ; Fri, 25 May 2012 22:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=SMhmqHN9Htf/tlyj+tC2lGvekBzkdP9nLCBFhR3mSHE=; b=IX8iE8zTVzvnmv+awJ46pP/XSSjd6o5F3Nte89fG33dX666OcAG2ceQFPCI81dF1HQ crkTLKm4nZ0GDWG8C626B5TfohddnmXX5PSR5TtkinP7KubRrcMZWqTJx1uZhvqCukrE CSNDL8qZ/TsojL5oPu/NRNVsMwzaBW3FbMem8c4fEdN+DBJz6z8jOQDHChdnViEEq95F iMUWhOlgTiStMLqxkW4MdbcOrlomgNSB9oUqnfRf9KntV1ge9hycLpVn++CC9ImkNdKj zOY6h1HVrf0phMLf3rxCkP7MDD/5XfbnlJo6Z9+7xh+LteS3reRuuvoCaDsBW0X7YGMD AbQw== Received: by 10.68.203.40 with SMTP id kn8mr3857111pbc.162.1338009021598; Fri, 25 May 2012 22:10:21 -0700 (PDT) Received: from ronniesahlberg@gmail.com (CPE-138-130-106-226.lns3.cht.bigpond.net.au. [138.130.106.226]) by mx.google.com with ESMTPS id sy3sm11360665pbc.0.2012.05.25.22.10.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 May 2012 22:10:21 -0700 (PDT) Received: by ronniesahlberg@gmail.com (sSMTP sendmail emulation); Sat, 26 May 2012 14:57:22 +1000 From: Ronnie Sahlberg To: pbonzini@redhat.com, qemu-devel@nongnu.org Date: Sat, 26 May 2012 14:56:41 +1000 Message-Id: <1338008201-29078-5-git-send-email-ronniesahlberg@gmail.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1338008201-29078-1-git-send-email-ronniesahlberg@gmail.com> References: <1338008201-29078-1-git-send-email-ronniesahlberg@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: Ronnie Sahlberg Subject: [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 noit possible to read from them. With this patch I can successfully manage a SMC device wiht iscsi in passthrough mode. Signed-off-by: Ronnie Sahlberg --- block/iscsi.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index a015a52..9ce38b5 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1032,6 +1032,15 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags) if (iscsi_url != NULL) { iscsi_destroy_url(iscsi_url); } + + /* Medium changer. 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) { + bs->sg = 1; + } + return 0; failed: