From patchwork Sat May 26 04:56:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [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. From: ronniesahlberg@gmail.com X-Patchwork-Id: 161449 Message-Id: <1338008201-29078-5-git-send-email-ronniesahlberg@gmail.com> To: pbonzini@redhat.com, qemu-devel@nongnu.org Cc: Ronnie Sahlberg Date: Sat, 26 May 2012 14:56:41 +1000 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: