qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
To: kwolf@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: [Qemu-devel] [PATCH 2/2] ISCSI: Force scsi-generic for MMC with blank disks
Date: Fri, 17 Aug 2012 12:36:21 +1000	[thread overview]
Message-ID: <1345170981-7738-3-git-send-email-ronniesahlberg@gmail.com> (raw)
In-Reply-To: <1345170981-7738-1-git-send-email-ronniesahlberg@gmail.com>

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 <ronniesahlberg@gmail.com>
---
 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;
-- 
1.7.3.1

  parent reply	other threads:[~2012-08-17  2:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17  2:36 [Qemu-devel] [PATCH] Two trivial patches for iSCSI and blank DVDs Ronnie Sahlberg
2012-08-17  2:36 ` [Qemu-devel] [PATCH 1/2] ISCSI: Set number of blocks to 0 for blank CDROM devices Ronnie Sahlberg
2012-08-18 21:57   ` Paolo Bonzini
2012-08-18 22:06     ` ronnie sahlberg
2012-08-17  2:36 ` Ronnie Sahlberg [this message]
2012-08-18 14:23   ` [Qemu-devel] [PATCH 2/2] ISCSI: Force scsi-generic for MMC with blank disks Blue Swirl
2012-08-18 21:58   ` Paolo Bonzini
2012-08-18 22:02     ` ronnie sahlberg
2012-08-18 22:04       ` ronnie sahlberg
2012-08-18 22:16       ` Paolo Bonzini
2012-08-18 22:19         ` ronnie sahlberg
2012-08-18 22:41           ` Paolo Bonzini
2012-08-18 22:20       ` Paolo Bonzini
2012-08-18 23:44         ` ronnie sahlberg
2012-08-19 10:16           ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345170981-7738-3-git-send-email-ronniesahlberg@gmail.com \
    --to=ronniesahlberg@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).