From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqoYn-0001DQ-1y for Qemu-devel@nongnu.org; Fri, 27 Jan 2012 11:22:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqoYg-0004GW-VL for Qemu-devel@nongnu.org; Fri, 27 Jan 2012 11:21:57 -0500 Received: from cantor2.suse.de ([195.135.220.15]:43735 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqoYg-0004GO-Lj for Qemu-devel@nongnu.org; Fri, 27 Jan 2012 11:21:50 -0500 Message-ID: <4F22CE9B.1000106@suse.de> Date: Fri, 27 Jan 2012 17:19:39 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <0F7A61B0A6ABAD4A82DDEF8CCA0ADA2B4E0906614F@AUSX7MCPS301.AMER.DELL.COM> In-Reply-To: <0F7A61B0A6ABAD4A82DDEF8CCA0ADA2B4E0906614F@AUSX7MCPS301.AMER.DELL.COM> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] To support scsi Virtual Adapter while creating VMDK images List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Praveen_Paladugu@Dell.com Cc: Kevin Wolf , Alexander Graf , Qemu-devel@nongnu.org, Soren Hansen , Aaron Mason Am 27.01.2012 00:46, schrieb Praveen_Paladugu@Dell.com: > According to VMDK specification, while using virtual scsi adapter, the = value of adapterType has to be set to "lsilogic" or "buslogic". When the = user adds "scsi" to the list of qemu-img options (Example: qemu-img creat= e -f vmdk foo -o scsi,size=3D100M) this patch will set the value of adapt= erType to "lsilogic". >=20 > When the "scsi" is not passed, the default "ide" value is used. > Signed-off-by: Praveen K Paladugu SoB should be above the patch so that it gets committed. Please cc the block maintainer, scripts/get_maintainer.pl can help with that. We're carrying a pretty similar patch from 2009 in OBS: https://build.opensuse.org/package/view_file?file=3Dqemu-img-vmdk-scsi.pa= tch&package=3Dvirt-utils&project=3DVirtualization&rev=3D34c58db02d6bfdb1a= 9dd49fc3c7fa9d4 There were also patches by Soren Hansen and Kevin Wolf back in 2008, by Pantelis Koukousoulas in 2009, by Aaron Mason and Alex Graf in 2010; are these all independent or is someone's SoB missing here? There were some issues raised about BLOCK_FLAG_SCSI that I don't see addressed here. Google found these other versions for reference (there may be more): http://patchwork.ozlabs.org/patch/60730/ http://patchwork.ozlabs.org/patch/60080/ http://copilotco.com/mail-archives/qemu.2008/msg04541.html http://lists.gnu.org/archive/html/qemu-devel/2009-07/msg02509.html http://www.mail-archive.com/qemu-devel@nongnu.org/msg15054.html Regards, Andreas > diff --git a/block.c b/block.c > index 3f072f6..2a2e725 100644 > --- a/block.c > +++ b/block.c > @@ -3690,7 +3690,7 @@ int bdrv_img_create(const char *filename, const c= har *fmt, > char *options, uint64_t img_size, int flags) > { > QEMUOptionParameter *param =3D NULL, *create_options =3D NULL; > - QEMUOptionParameter *backing_fmt, *backing_file, *size; > + QEMUOptionParameter *backing_fmt, *backing_file, *size, *scsi; > BlockDriverState *bs =3D NULL; > BlockDriver *drv, *proto_drv; > BlockDriver *backing_drv =3D NULL; > @@ -3797,6 +3797,12 @@ int bdrv_img_create(const char *filename, const = char *fmt, > goto out; > } > } > + scsi =3D get_option_parameter(param, BLOCK_OPT_SCSI); > + if (scsi && scsi->value.n && strcmp(drv->format_name, "vmdk")) { > + error_report("SCSI devices not supported for this file format"= ); > + ret =3D -1; > + goto out; > + } > =20 > printf("Formatting '%s', fmt=3D%s ", filename, fmt); > print_option_parameters(param); > diff --git a/block/vmdk.c b/block/vmdk.c > index 5623ac1..fc1ac65 100644 > --- a/block/vmdk.c > +++ b/block/vmdk.c > @@ -1377,7 +1377,7 @@ static int vmdk_create(const char *filename, QEMU= OptionParameter *options) > "ddb.geometry.cylinders =3D \"%" PRId64 "\"\n" > "ddb.geometry.heads =3D \"16\"\n" > "ddb.geometry.sectors =3D \"63\"\n" > - "ddb.adapterType =3D \"ide\"\n"; > + "ddb.adapterType =3D \"%s\"\n"; > =20 > if (filename_decompose(filename, path, prefix, postfix, PATH_MAX))= { > return -EINVAL; > @@ -1390,6 +1390,8 @@ static int vmdk_create(const char *filename, QEMU= OptionParameter *options) > backing_file =3D options->value.s; > } else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) { > flags |=3D options->value.n ? BLOCK_FLAG_COMPAT6 : 0; > + } else if (!strcmp(options->name, BLOCK_OPT_SCSI)) { > + flags |=3D options->value.n ? BLOCK_FLAG_SCSI : 0; > } else if (!strcmp(options->name, BLOCK_OPT_SUBFMT)) { > fmt =3D options->value.s; > } > @@ -1482,7 +1484,8 @@ static int vmdk_create(const char *filename, QEMU= OptionParameter *options) > parent_desc_line, > ext_desc_lines, > (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), > - total_size / (int64_t)(63 * 16 * 512)); > + total_size / (int64_t)(63 * 16 * 512), > + (flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide")); > if (split || flat) { > fd =3D open( > filename, > @@ -1585,6 +1588,12 @@ static QEMUOptionParameter vmdk_create_options[]= =3D { > "VMDK flat extent format, can be one of " > "{monolithicSparse (default) | monolithicFlat | twoGbMaxEx= tentSparse | twoGbMaxExtentFlat | streamOptimized} " > }, > + { > + .name =3D BLOCK_OPT_SCSI, > + .type =3D OPT_FLAG, > + .help =3D "Virtual SCSI Adapter" > + }, > + > { NULL } > }; > =20 > diff --git a/block_int.h b/block_int.h > index 311bd2a..5e332fb 100644 > --- a/block_int.h > +++ b/block_int.h > @@ -33,6 +33,7 @@ > =20 > #define BLOCK_FLAG_ENCRYPT 1 > #define BLOCK_FLAG_COMPAT6 4 > +#define BLOCK_FLAG_SCSI 8 > =20 > #define BLOCK_IO_LIMIT_READ 0 > #define BLOCK_IO_LIMIT_WRITE 1 > @@ -44,6 +45,7 @@ > #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" --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg