From: "Andreas Färber" <afaerber@suse.de>
To: Praveen_Paladugu@Dell.com
Cc: Kevin Wolf <kwolf@redhat.com>, Alexander Graf <agraf@suse.de>,
Qemu-devel@nongnu.org, Soren Hansen <soren@ubuntu.com>,
Aaron Mason <aaron.mason@thats-too-much.info>
Subject: Re: [Qemu-devel] [PATCH] To support scsi Virtual Adapter while creating VMDK images
Date: Fri, 27 Jan 2012 17:19:39 +0100 [thread overview]
Message-ID: <4F22CE9B.1000106@suse.de> (raw)
In-Reply-To: <0F7A61B0A6ABAD4A82DDEF8CCA0ADA2B4E0906614F@AUSX7MCPS301.AMER.DELL.COM>
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 create -f vmdk foo -o scsi,size=100M) this patch will set the value of adapterType to "lsilogic".
>
> When the "scsi" is not passed, the default "ide" value is used.
> Signed-off-by: Praveen K Paladugu <Praveen_paladugu@dell.com>
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=qemu-img-vmdk-scsi.patch&package=virt-utils&project=Virtualization&rev=34c58db02d6bfdb1a9dd49fc3c7fa9d4
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 char *fmt,
> char *options, uint64_t img_size, int flags)
> {
> QEMUOptionParameter *param = NULL, *create_options = NULL;
> - QEMUOptionParameter *backing_fmt, *backing_file, *size;
> + QEMUOptionParameter *backing_fmt, *backing_file, *size, *scsi;
> BlockDriverState *bs = NULL;
> BlockDriver *drv, *proto_drv;
> BlockDriver *backing_drv = NULL;
> @@ -3797,6 +3797,12 @@ int bdrv_img_create(const char *filename, const char *fmt,
> goto out;
> }
> }
> + scsi = 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 = -1;
> + goto out;
> + }
>
> printf("Formatting '%s', fmt=%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, 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";
>
> if (filename_decompose(filename, path, prefix, postfix, PATH_MAX)) {
> return -EINVAL;
> @@ -1390,6 +1390,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;
> } else if (!strcmp(options->name, BLOCK_OPT_SUBFMT)) {
> fmt = options->value.s;
> }
> @@ -1482,7 +1484,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *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 = open(
> filename,
> @@ -1585,6 +1588,12 @@ static QEMUOptionParameter vmdk_create_options[] = {
> "VMDK flat extent format, can be one of "
> "{monolithicSparse (default) | monolithicFlat | twoGbMaxExtentSparse | twoGbMaxExtentFlat | streamOptimized} "
> },
> + {
> + .name = BLOCK_OPT_SCSI,
> + .type = OPT_FLAG,
> + .help = "Virtual SCSI Adapter"
> + },
> +
> { NULL }
> };
>
> 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 @@
>
> #define BLOCK_FLAG_ENCRYPT 1
> #define BLOCK_FLAG_COMPAT6 4
> +#define BLOCK_FLAG_SCSI 8
>
> #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"
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2012-01-27 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 23:46 [Qemu-devel] [PATCH] To support scsi Virtual Adapter while creating VMDK images Praveen_Paladugu
2012-01-27 16:19 ` Andreas Färber [this message]
2012-01-27 16:34 ` Kevin Wolf
2012-01-27 18:07 ` Praveen_Paladugu
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=4F22CE9B.1000106@suse.de \
--to=afaerber@suse.de \
--cc=Praveen_Paladugu@Dell.com \
--cc=Qemu-devel@nongnu.org \
--cc=aaron.mason@thats-too-much.info \
--cc=agraf@suse.de \
--cc=kwolf@redhat.com \
--cc=soren@ubuntu.com \
/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).