From patchwork Tue Aug 3 12:17:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 60730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8707F1007D1 for ; Tue, 3 Aug 2010 22:23:21 +1000 (EST) Received: from localhost ([127.0.0.1]:51151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OgGWa-0001Of-Um for incoming@patchwork.ozlabs.org; Tue, 03 Aug 2010 08:23:17 -0400 Received: from [140.186.70.92] (port=39566 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OgGUu-0001MP-UB for qemu-devel@nongnu.org; Tue, 03 Aug 2010 08:21:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OgGRH-0004V6-Eg for qemu-devel@nongnu.org; Tue, 03 Aug 2010 08:17:50 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45248 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OgGRH-0004U9-3A for qemu-devel@nongnu.org; Tue, 03 Aug 2010 08:17:47 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id A92268655F; Tue, 3 Aug 2010 14:17:42 +0200 (CEST) From: Alexander Graf To: qemu-devel List Date: Tue, 3 Aug 2010 14:17:41 +0200 Message-Id: <1280837861-31971-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: Kevin Wolf Subject: [Qemu-devel] [PATCH] Block: Support creation of SCSI VMDK images in qemu-img. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org While looking through patches we have not upstreamed yet, I stumbled over this trivial patch that Kevin created back in the day. It allows to specify the creation of scsi type vmdk images. Signed-off-by: Alexander Graf --- block/vmdk.c | 12 ++++++++++-- block_int.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 2d4ba42..64f1c88 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -686,7 +686,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"16\"\n" "ddb.geometry.sectors = \"63\"\n" - "ddb.adapterType = \"ide\"\n"; + "ddb.adapterType = \"%s\"\n"; char desc[1024]; const char *real_filename, *temp_str; int64_t total_size = 0; @@ -702,6 +702,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) backing_file = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) { flags |= options->value.n ? BLOCK_FLAG_COMPAT6: 0; + } else if (!strcmp(options->name, BLOCK_OPT_SCSI)) { + flags |= options->value.n ? BLOCK_FLAG_SCSI: 0; } options++; } @@ -799,7 +801,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL), total_size, real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), - total_size / (int64_t)(63 * 16)); + total_size / (int64_t)(63 * 16), + flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide"); /* write the descriptor */ lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET); @@ -845,6 +848,11 @@ static QEMUOptionParameter vmdk_create_options[] = { .type = OPT_FLAG, .help = "VMDK version 6 image" }, + { + .name = BLOCK_OPT_SCSI, + .type = OPT_FLAG, + .help = "SCSI image" + }, { NULL } }; diff --git a/block_int.h b/block_int.h index b863451..01ba00e 100644 --- a/block_int.h +++ b/block_int.h @@ -31,10 +31,12 @@ #define BLOCK_FLAG_ENCRYPT 1 #define BLOCK_FLAG_COMPRESS 2 #define BLOCK_FLAG_COMPAT6 4 +#define BLOCK_FLAG_SCSI 8 #define BLOCK_OPT_SIZE "size" #define BLOCK_OPT_ENCRYPT "encryption" #define BLOCK_OPT_COMPAT6 "compat6" +#define BLOCK_OPT_SCSI "scsi" #define BLOCK_OPT_BACKING_FILE "backing_file" #define BLOCK_OPT_BACKING_FMT "backing_fmt" #define BLOCK_OPT_CLUSTER_SIZE "cluster_size"