From: Janne Karhunen <Janne.Karhunen@gmail.com>
To: qemu-devel@nongnu.org
Cc: Janne Karhunen <janne.karhunen@gmail.com>,
Janne Karhunen <Janne.Karhunen@gmail.com>
Subject: [Qemu-devel] [PATCH] Allow users to specify the vmdk virtual hardware version.
Date: Wed, 20 Apr 2016 15:27:52 -0700 [thread overview]
Message-ID: <1461191272-17802-1-git-send-email-Janne.Karhunen@gmail.com> (raw)
From: Janne Karhunen <janne.karhunen@gmail.com>
Replace hardcoded vmdk description file hardware version flag with
a user definable version.
Signed-off-by: Janne Karhunen <Janne.Karhunen@gmail.com>
---
block/vmdk.c | 20 ++++++++++----------
include/block/block_int.h | 3 +--
qemu-doc.texi | 4 ++--
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 45f9d3c..1436785 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1829,8 +1829,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
int64_t total_size = 0, filesize;
char *adapter_type = NULL;
char *backing_file = NULL;
+ char *hw_version = NULL;
char *fmt = NULL;
- int flags = 0;
int ret = 0;
bool flat, split, compress;
GString *ext_desc_lines;
@@ -1861,7 +1861,7 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
"# The Disk Data Base\n"
"#DDB\n"
"\n"
- "ddb.virtualHWVersion = \"%d\"\n"
+ "ddb.virtualHWVersion = \"%s\"\n"
"ddb.geometry.cylinders = \"%" PRId64 "\"\n"
"ddb.geometry.heads = \"%" PRIu32 "\"\n"
"ddb.geometry.sectors = \"63\"\n"
@@ -1878,9 +1878,8 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
BDRV_SECTOR_SIZE);
adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE);
backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE);
- if (qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false)) {
- flags |= BLOCK_FLAG_COMPAT6;
- }
+ hw_version = qemu_opt_get_del(opts, BLOCK_OPT_HWVERSION);
+
fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT);
if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false)) {
zeroed_grain = true;
@@ -2001,7 +2000,7 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
fmt,
parent_desc_line,
ext_desc_lines->str,
- (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
+ hw_version,
total_size /
(int64_t)(63 * number_heads * BDRV_SECTOR_SIZE),
number_heads,
@@ -2047,6 +2046,7 @@ exit:
}
g_free(adapter_type);
g_free(backing_file);
+ g_free(hw_version);
g_free(fmt);
g_free(desc);
g_free(path);
@@ -2292,10 +2292,10 @@ static QemuOptsList vmdk_create_opts = {
.help = "File name of a base image"
},
{
- .name = BLOCK_OPT_COMPAT6,
- .type = QEMU_OPT_BOOL,
- .help = "VMDK version 6 image",
- .def_value_str = "off"
+ .name = BLOCK_OPT_HWVERSION,
+ .type = QEMU_OPT_STRING,
+ .help = "VMDK hardware version",
+ .def_value_str = "4"
},
{
.name = BLOCK_OPT_SUBFMT,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 10d8759..0852316 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -38,12 +38,11 @@
#include "qemu/throttle.h"
#define BLOCK_FLAG_ENCRYPT 1
-#define BLOCK_FLAG_COMPAT6 4
#define BLOCK_FLAG_LAZY_REFCOUNTS 8
#define BLOCK_OPT_SIZE "size"
#define BLOCK_OPT_ENCRYPT "encryption"
-#define BLOCK_OPT_COMPAT6 "compat6"
+#define BLOCK_OPT_HWVERSION "hwversion"
#define BLOCK_OPT_BACKING_FILE "backing_file"
#define BLOCK_OPT_BACKING_FMT "backing_fmt"
#define BLOCK_OPT_CLUSTER_SIZE "cluster_size"
diff --git a/qemu-doc.texi b/qemu-doc.texi
index 79141d3..79f4168 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -691,8 +691,8 @@ Supported options:
@table @code
@item backing_file
File name of a base image (see @option{create} subcommand).
-@item compat6
-Create a VMDK version 6 image (instead of version 4)
+@item hwversion
+Specify vmdk hardware version (default 4)
@item subformat
Specifies which VMDK subformat to use. Valid options are
@code{monolithicSparse} (default),
--
1.9.1
next reply other threads:[~2016-04-20 22:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 22:27 Janne Karhunen [this message]
2016-04-21 2:22 ` [Qemu-devel] [PATCH] Allow users to specify the vmdk virtual hardware version Fam Zheng
2016-04-21 3:02 ` Janne Karhunen
2016-04-21 3:26 ` Fam Zheng
2016-04-21 3:30 ` Janne Karhunen
2016-04-21 3:22 ` Janne Karhunen
2016-04-21 4:44 ` Fam Zheng
2016-04-22 15:23 ` Janne Karhunen
2016-04-25 0:45 ` Fam Zheng
-- strict thread matches above, loose matches on Subject: below --
2016-04-21 19:29 Janne Karhunen
2016-04-29 7:41 ` Fam Zheng
2016-05-02 11:30 ` Janne Karhunen
2016-05-03 0:49 ` Fam Zheng
2016-05-03 9:45 ` Janne Karhunen
2016-05-03 9:43 Janne Karhunen
2016-05-06 5:15 ` Janne Karhunen
2016-05-06 9:07 ` Fam Zheng
2016-05-06 9:04 ` Fam Zheng
2016-05-06 11:05 ` Kevin Wolf
2016-05-06 17:53 ` Janne Karhunen
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=1461191272-17802-1-git-send-email-Janne.Karhunen@gmail.com \
--to=janne.karhunen@gmail.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).