From patchwork Fri Aug 17 02:36:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ronnie sahlberg X-Patchwork-Id: 178135 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 BA95A2C0089 for ; Fri, 17 Aug 2012 12:37:02 +1000 (EST) Received: from localhost ([::1]:56535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2CQm-0003cS-Qn for incoming@patchwork.ozlabs.org; Thu, 16 Aug 2012 22:37:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2CQa-0003PO-Cl for qemu-devel@nongnu.org; Thu, 16 Aug 2012 22:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2CQZ-0005ZV-7w for qemu-devel@nongnu.org; Thu, 16 Aug 2012 22:36:48 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:55211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2CQZ-0005Vz-1p for qemu-devel@nongnu.org; Thu, 16 Aug 2012 22:36:47 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp12so2601939pbb.4 for ; Thu, 16 Aug 2012 19:36:46 -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=FrS2dPoNyz1Q14jLpenxqUzYT+SRglyAOq1HjF8O3IM=; b=EnIWnIU6mjwLuPsnE5aQzn3dm6rtrx1VIIAJ/EHAF5na8KMWzEsS6xGFe6EHViLsn4 zbGoI5IpXic2W10F9kXyQe1hMg/k7gaMaUQec4rrFguEE2f5B2S64rH+9AWClL36+U5V DnDlKZ5+98UU0IeGysGk8Pm3Y0nflA+gPEV/9+8xNePAHLvcJ+4sS0qolVNZ+/n3ABhF U9uxNK1QxEqML3c0y2QPJIU6kmCgJlWDXyeXvBjgtU2rLGkho2lNNJfdaIFAgSQGvglv cxDQdd7B7p15Gk+ThiNYWPqywliLHEvRTOh8cMSSqDDt5/Qg8RFPoYz1c7p/dxvHTnlh byAg== Received: by 10.68.212.161 with SMTP id nl1mr7858418pbc.84.1345171006649; Thu, 16 Aug 2012 19:36:46 -0700 (PDT) Received: from ronniesahlberg@gmail.com (CPE-121-217-101-227.lnse2.cht.bigpond.net.au. [121.217.101.227]) by mx.google.com with ESMTPS id uu10sm2946372pbc.2.2012.08.16.19.36.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Aug 2012 19:36:46 -0700 (PDT) Received: by ronniesahlberg@gmail.com (sSMTP sendmail emulation); Fri, 17 Aug 2012 12:36:41 +1000 From: Ronnie Sahlberg To: kwolf@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com Date: Fri, 17 Aug 2012 12:36:21 +1000 Message-Id: <1345170981-7738-3-git-send-email-ronniesahlberg@gmail.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1345170981-7738-1-git-send-email-ronniesahlberg@gmail.com> References: <1345170981-7738-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 2/2] ISCSI: Force scsi-generic for MMC with blank disks 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 There is no bdrv_* API for the commands for burning a blank MMC disk so when iSCSI LUNs are specified and the LUN is a MMC device with 0 available blocks. This is a blank disk so force scsi generic. This allows the guest to talk directly to the target to burn data on the disk. Signed-off-by: Ronnie Sahlberg --- block/iscsi.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index fb420ea..ca53afa 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1017,10 +1017,19 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags) /* 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. + * MMC device with no blocks contain a blank disk so force them to use sg + * too. */ - if (iscsilun->type == TYPE_MEDIUM_CHANGER || - iscsilun->type == TYPE_TAPE) { + switch (iscsilun->type) { + case TYPE_ROM: + if (iscsilun->num_blocks > 0) { + break; + } + case TYPE_MEDIUM_CHANGER: + case TYPE_TAPE: bs->sg = 1; + default: + break; } ret = 0;