1 | The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def: | 1 | The following changes since commit 8cb41fda78c7ebde0dd248c6afe1d336efb0de50: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700) | 3 | Merge remote-tracking branch 'remotes/philmd/tags/machine-20211101' into staging (2021-11-02 05:53:45 -0400) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request | 7 | https://github.com/XanClic/qemu.git tags/pull-block-2021-11-02 |
8 | 8 | ||
9 | for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514: | 9 | for you to fetch changes up to 7da9623cc078229caf07c290e16401ccdb9408d2: |
10 | 10 | ||
11 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100) | 11 | block/vpc: Add a sanity check that fixed-size images have the right type (2021-11-02 12:47:51 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Emanuele Giuseppe Esposito (1): |
15 | pylint: fix errors and warnings generated by tests/qemu-iotests/297 | ||
15 | 16 | ||
16 | ---------------------------------------------------------------- | 17 | Eric Blake (1): |
18 | qemu-img: Consistent docs for convert -F | ||
17 | 19 | ||
18 | Stefano Garzarella (2): | 20 | Thomas Huth (1): |
19 | iothread: rename PollParamInfo to IOThreadParamInfo | 21 | block/vpc: Add a sanity check that fixed-size images have the right |
20 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() | 22 | type |
21 | 23 | ||
22 | iothread.c | 28 +++++++++++++++------------- | 24 | Thomas Weißschuh (1): |
23 | 1 file changed, 15 insertions(+), 13 deletions(-) | 25 | vmdk: allow specification of tools version |
26 | |||
27 | docs/tools/qemu-img.rst | 2 +- | ||
28 | qapi/block-core.json | 3 +++ | ||
29 | block/vmdk.c | 24 ++++++++++++++++++++---- | ||
30 | block/vpc.c | 3 ++- | ||
31 | qemu-img-cmds.hx | 2 +- | ||
32 | tests/qemu-iotests/129 | 18 +++++++++--------- | ||
33 | tests/qemu-iotests/310 | 16 ++++++++-------- | ||
34 | tests/qemu-iotests/check | 11 ++++++----- | ||
35 | tests/qemu-iotests/iotests.py | 7 ++++--- | ||
36 | tests/qemu-iotests/tests/image-fleecing | 4 ++-- | ||
37 | 10 files changed, 56 insertions(+), 34 deletions(-) | ||
24 | 38 | ||
25 | -- | 39 | -- |
26 | 2.31.1 | 40 | 2.31.1 |
27 | 41 | ||
28 | 42 | ||
29 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Eric Blake <eblake@redhat.com> | ||
1 | 2 | ||
3 | Use consistent capitalization, and fix a missed line (we duplicate the | ||
4 | qemu-img synopses in too many places). | ||
5 | |||
6 | Fixes: 1899bf4737 (qemu-img: Add -F shorthand to convert) | ||
7 | Signed-off-by: Eric Blake <eblake@redhat.com> | ||
8 | Message-Id: <20210921142812.2631605-1-eblake@redhat.com> | ||
9 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
10 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> | ||
11 | --- | ||
12 | docs/tools/qemu-img.rst | 2 +- | ||
13 | qemu-img-cmds.hx | 2 +- | ||
14 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/docs/tools/qemu-img.rst | ||
19 | +++ b/docs/tools/qemu-img.rst | ||
20 | @@ -XXX,XX +XXX,XX @@ Command description: | ||
21 | 4 | ||
22 | Error on reading data | ||
23 | |||
24 | -.. option:: convert [--object OBJECTDEF] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps [--skip-broken-bitmaps]] [-U] [-C] [-c] [-p] [-q] [-n] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-O OUTPUT_FMT] [-B BACKING_FILE [-F backing_fmt]] [-o OPTIONS] [-l SNAPSHOT_PARAM] [-S SPARSE_SIZE] [-r RATE_LIMIT] [-m NUM_COROUTINES] [-W] FILENAME [FILENAME2 [...]] OUTPUT_FILENAME | ||
25 | +.. option:: convert [--object OBJECTDEF] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps [--skip-broken-bitmaps]] [-U] [-C] [-c] [-p] [-q] [-n] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-O OUTPUT_FMT] [-B BACKING_FILE [-F BACKING_FMT]] [-o OPTIONS] [-l SNAPSHOT_PARAM] [-S SPARSE_SIZE] [-r RATE_LIMIT] [-m NUM_COROUTINES] [-W] FILENAME [FILENAME2 [...]] OUTPUT_FILENAME | ||
26 | |||
27 | Convert the disk image *FILENAME* or a snapshot *SNAPSHOT_PARAM* | ||
28 | to disk image *OUTPUT_FILENAME* using format *OUTPUT_FMT*. It can | ||
29 | diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/qemu-img-cmds.hx | ||
32 | +++ b/qemu-img-cmds.hx | ||
33 | @@ -XXX,XX +XXX,XX @@ ERST | ||
34 | DEF("convert", img_convert, | ||
35 | "convert [--object objectdef] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps] [-U] [-C] [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-B backing_file [-F backing_fmt]] [-o options] [-l snapshot_param] [-S sparse_size] [-r rate_limit] [-m num_coroutines] [-W] [--salvage] filename [filename2 [...]] output_filename") | ||
36 | SRST | ||
37 | -.. option:: convert [--object OBJECTDEF] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps] [-U] [-C] [-c] [-p] [-q] [-n] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-O OUTPUT_FMT] [-B BACKING_FILE] [-o OPTIONS] [-l SNAPSHOT_PARAM] [-S SPARSE_SIZE] [-r RATE_LIMIT] [-m NUM_COROUTINES] [-W] [--salvage] FILENAME [FILENAME2 [...]] OUTPUT_FILENAME | ||
38 | +.. option:: convert [--object OBJECTDEF] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps] [-U] [-C] [-c] [-p] [-q] [-n] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-O OUTPUT_FMT] [-B BACKING_FILE [-F BACKING_FMT]] [-o OPTIONS] [-l SNAPSHOT_PARAM] [-S SPARSE_SIZE] [-r RATE_LIMIT] [-m NUM_COROUTINES] [-W] [--salvage] FILENAME [FILENAME2 [...]] OUTPUT_FILENAME | ||
39 | ERST | ||
40 | |||
41 | DEF("create", img_create, | ||
42 | -- | ||
43 | 2.31.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
1 | From: Stefano Garzarella <sgarzare@redhat.com> | 1 | From: Emanuele Giuseppe Esposito <eesposit@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Commit 0445409d74 ("iothread: generalize | 3 | Test 297 in tests/qemu-iotests currently fails: pylint has |
4 | iothread_set_param/iothread_get_param") moved common code to set and | 4 | learned new things to check, or we simply missed them. |
5 | get IOThread parameters in two new functions. | ||
6 | 5 | ||
7 | These functions are called inside callbacks, so we don't need to use an | 6 | All fixes in this patch are related to additional spaces used |
8 | opaque pointer. Let's replace `void *opaque` parameter with | 7 | or wrong indentation. No functional change intended. |
9 | `IOThreadParamInfo *info`. | ||
10 | 8 | ||
11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | 9 | Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> |
12 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | 10 | Message-Id: <20211008062821.1010967-2-eesposit@redhat.com> |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 11 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> |
14 | Message-id: 20210727145936.147032-3-sgarzare@redhat.com | ||
15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
16 | --- | 12 | --- |
17 | iothread.c | 18 ++++++++++-------- | 13 | tests/qemu-iotests/129 | 18 +++++++++--------- |
18 | 1 file changed, 10 insertions(+), 8 deletions(-) | 14 | tests/qemu-iotests/310 | 16 ++++++++-------- |
15 | tests/qemu-iotests/check | 11 ++++++----- | ||
16 | tests/qemu-iotests/iotests.py | 7 ++++--- | ||
17 | tests/qemu-iotests/tests/image-fleecing | 4 ++-- | ||
18 | 5 files changed, 29 insertions(+), 27 deletions(-) | ||
19 | 19 | ||
20 | diff --git a/iothread.c b/iothread.c | 20 | diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 |
21 | index XXXXXXX..XXXXXXX 100755 | ||
22 | --- a/tests/qemu-iotests/129 | ||
23 | +++ b/tests/qemu-iotests/129 | ||
24 | @@ -XXX,XX +XXX,XX @@ class TestStopWithBlockJob(iotests.QMPTestCase): | ||
25 | self.do_test_stop("drive-backup", device="drive0", | ||
26 | target=self.target_img, format=iotests.imgfmt, | ||
27 | sync="full", | ||
28 | - x_perf={ 'max-chunk': 65536, | ||
29 | - 'max-workers': 8 }) | ||
30 | + x_perf={'max-chunk': 65536, | ||
31 | + 'max-workers': 8}) | ||
32 | |||
33 | def test_block_commit(self): | ||
34 | # Add overlay above the source node so that we actually use a | ||
35 | @@ -XXX,XX +XXX,XX @@ class TestStopWithBlockJob(iotests.QMPTestCase): | ||
36 | '1G') | ||
37 | |||
38 | result = self.vm.qmp('blockdev-add', **{ | ||
39 | - 'node-name': 'overlay', | ||
40 | - 'driver': iotests.imgfmt, | ||
41 | - 'file': { | ||
42 | - 'driver': 'file', | ||
43 | - 'filename': self.overlay_img | ||
44 | - } | ||
45 | - }) | ||
46 | + 'node-name': 'overlay', | ||
47 | + 'driver': iotests.imgfmt, | ||
48 | + 'file': { | ||
49 | + 'driver': 'file', | ||
50 | + 'filename': self.overlay_img | ||
51 | + } | ||
52 | + }) | ||
53 | self.assert_qmp(result, 'return', {}) | ||
54 | |||
55 | result = self.vm.qmp('blockdev-snapshot', | ||
56 | diff --git a/tests/qemu-iotests/310 b/tests/qemu-iotests/310 | ||
57 | index XXXXXXX..XXXXXXX 100755 | ||
58 | --- a/tests/qemu-iotests/310 | ||
59 | +++ b/tests/qemu-iotests/310 | ||
60 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('base.img') as base_img_path, \ | ||
61 | assert qemu_io_silent(base_img_path, '-c', 'write -P 1 3M 1M') == 0 | ||
62 | assert qemu_img('create', '-f', iotests.imgfmt, '-b', base_img_path, | ||
63 | '-F', iotests.imgfmt, mid_img_path) == 0 | ||
64 | - assert qemu_io_silent(mid_img_path, '-c', 'write -P 3 2M 1M') == 0 | ||
65 | - assert qemu_io_silent(mid_img_path, '-c', 'write -P 3 4M 1M') == 0 | ||
66 | + assert qemu_io_silent(mid_img_path, '-c', 'write -P 3 2M 1M') == 0 | ||
67 | + assert qemu_io_silent(mid_img_path, '-c', 'write -P 3 4M 1M') == 0 | ||
68 | assert qemu_img('create', '-f', iotests.imgfmt, '-b', mid_img_path, | ||
69 | '-F', iotests.imgfmt, top_img_path) == 0 | ||
70 | - assert qemu_io_silent(top_img_path, '-c', 'write -P 2 1M 1M') == 0 | ||
71 | + assert qemu_io_silent(top_img_path, '-c', 'write -P 2 1M 1M') == 0 | ||
72 | |||
73 | # 0 1 2 3 4 | ||
74 | # top 2 | ||
75 | @@ -XXX,XX +XXX,XX @@ with iotests.FilePath('base.img') as base_img_path, \ | ||
76 | assert qemu_img('rebase', '-u', '-b', '', '-f', iotests.imgfmt, | ||
77 | top_img_path) == 0 | ||
78 | |||
79 | - assert qemu_io_silent(top_img_path, '-c', 'read -P 0 0 1M') == 0 | ||
80 | - assert qemu_io_silent(top_img_path, '-c', 'read -P 2 1M 1M') == 0 | ||
81 | - assert qemu_io_silent(top_img_path, '-c', 'read -P 3 2M 1M') == 0 | ||
82 | - assert qemu_io_silent(top_img_path, '-c', 'read -P 0 3M 1M') == 0 | ||
83 | - assert qemu_io_silent(top_img_path, '-c', 'read -P 3 4M 1M') == 0 | ||
84 | + assert qemu_io_silent(top_img_path, '-c', 'read -P 0 0 1M') == 0 | ||
85 | + assert qemu_io_silent(top_img_path, '-c', 'read -P 2 1M 1M') == 0 | ||
86 | + assert qemu_io_silent(top_img_path, '-c', 'read -P 3 2M 1M') == 0 | ||
87 | + assert qemu_io_silent(top_img_path, '-c', 'read -P 0 3M 1M') == 0 | ||
88 | + assert qemu_io_silent(top_img_path, '-c', 'read -P 3 4M 1M') == 0 | ||
89 | |||
90 | log('Done') | ||
91 | diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check | ||
92 | index XXXXXXX..XXXXXXX 100755 | ||
93 | --- a/tests/qemu-iotests/check | ||
94 | +++ b/tests/qemu-iotests/check | ||
95 | @@ -XXX,XX +XXX,XX @@ def make_argparser() -> argparse.ArgumentParser: | ||
96 | |||
97 | p.add_argument('-d', dest='debug', action='store_true', help='debug') | ||
98 | p.add_argument('-p', dest='print', action='store_true', | ||
99 | - help='redirects qemu\'s stdout and stderr to the test output') | ||
100 | + help='redirects qemu\'s stdout and stderr to ' | ||
101 | + 'the test output') | ||
102 | p.add_argument('-gdb', action='store_true', | ||
103 | - help="start gdbserver with $GDB_OPTIONS options \ | ||
104 | - ('localhost:12345' if $GDB_OPTIONS is empty)") | ||
105 | + help="start gdbserver with $GDB_OPTIONS options " | ||
106 | + "('localhost:12345' if $GDB_OPTIONS is empty)") | ||
107 | p.add_argument('-valgrind', action='store_true', | ||
108 | - help='use valgrind, sets VALGRIND_QEMU environment ' | ||
109 | - 'variable') | ||
110 | + help='use valgrind, sets VALGRIND_QEMU environment ' | ||
111 | + 'variable') | ||
112 | |||
113 | p.add_argument('-misalign', action='store_true', | ||
114 | help='misalign memory allocations') | ||
115 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
21 | index XXXXXXX..XXXXXXX 100644 | 116 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/iothread.c | 117 | --- a/tests/qemu-iotests/iotests.py |
23 | +++ b/iothread.c | 118 | +++ b/tests/qemu-iotests/iotests.py |
24 | @@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = { | 119 | @@ -XXX,XX +XXX,XX @@ def _post_shutdown(self) -> None: |
25 | }; | 120 | super()._post_shutdown() |
26 | 121 | if not qemu_valgrind or not self._popen: | |
27 | static void iothread_get_param(Object *obj, Visitor *v, | 122 | return |
28 | - const char *name, void *opaque, Error **errp) | 123 | - valgrind_filename = f"{test_dir}/{self._popen.pid}.valgrind" |
29 | + const char *name, IOThreadParamInfo *info, Error **errp) | 124 | + valgrind_filename = f"{test_dir}/{self._popen.pid}.valgrind" |
30 | { | 125 | if self.exitcode() == 99: |
31 | IOThread *iothread = IOTHREAD(obj); | 126 | with open(valgrind_filename, encoding='utf-8') as f: |
32 | - IOThreadParamInfo *info = opaque; | 127 | print(f.read()) |
33 | int64_t *field = (void *)iothread + info->offset; | 128 | @@ -XXX,XX +XXX,XX @@ def write(self, arg=None): |
34 | 129 | ||
35 | visit_type_int64(v, name, field, errp); | 130 | class ReproducibleTestRunner(unittest.TextTestRunner): |
36 | } | 131 | def __init__(self, stream: Optional[TextIO] = None, |
37 | 132 | - resultclass: Type[unittest.TestResult] = ReproducibleTestResult, | |
38 | static bool iothread_set_param(Object *obj, Visitor *v, | 133 | - **kwargs: Any) -> None: |
39 | - const char *name, void *opaque, Error **errp) | 134 | + resultclass: Type[unittest.TestResult] = |
40 | + const char *name, IOThreadParamInfo *info, Error **errp) | 135 | + ReproducibleTestResult, |
41 | { | 136 | + **kwargs: Any) -> None: |
42 | IOThread *iothread = IOTHREAD(obj); | 137 | rstream = ReproducibleStreamWrapper(stream or sys.stdout) |
43 | - IOThreadParamInfo *info = opaque; | 138 | super().__init__(stream=rstream, # type: ignore |
44 | int64_t *field = (void *)iothread + info->offset; | 139 | descriptions=True, |
45 | int64_t value; | 140 | diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/tests/image-fleecing |
46 | 141 | index XXXXXXX..XXXXXXX 100755 | |
47 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, | 142 | --- a/tests/qemu-iotests/tests/image-fleecing |
48 | static void iothread_get_poll_param(Object *obj, Visitor *v, | 143 | +++ b/tests/qemu-iotests/tests/image-fleecing |
49 | const char *name, void *opaque, Error **errp) | 144 | @@ -XXX,XX +XXX,XX @@ def do_test(use_cbw, base_img_path, fleece_img_path, nbd_sock_path, vm): |
50 | { | 145 | |
51 | + IOThreadParamInfo *info = opaque; | 146 | nbd_uri = 'nbd+unix:///%s?socket=%s' % (tmp_node, nbd_sock_path) |
52 | 147 | log(vm.qmp('nbd-server-start', | |
53 | - iothread_get_param(obj, v, name, opaque, errp); | 148 | - {'addr': { 'type': 'unix', |
54 | + iothread_get_param(obj, v, name, info, errp); | 149 | - 'data': { 'path': nbd_sock_path } } })) |
55 | } | 150 | + {'addr': {'type': 'unix', |
56 | 151 | + 'data': {'path': nbd_sock_path}}})) | |
57 | static void iothread_set_poll_param(Object *obj, Visitor *v, | 152 | |
58 | const char *name, void *opaque, Error **errp) | 153 | log(vm.qmp('nbd-server-add', device=tmp_node)) |
59 | { | ||
60 | IOThread *iothread = IOTHREAD(obj); | ||
61 | + IOThreadParamInfo *info = opaque; | ||
62 | |||
63 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { | ||
64 | + if (!iothread_set_param(obj, v, name, info, errp)) { | ||
65 | return; | ||
66 | } | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v, | ||
69 | static void iothread_get_aio_param(Object *obj, Visitor *v, | ||
70 | const char *name, void *opaque, Error **errp) | ||
71 | { | ||
72 | + IOThreadParamInfo *info = opaque; | ||
73 | |||
74 | - iothread_get_param(obj, v, name, opaque, errp); | ||
75 | + iothread_get_param(obj, v, name, info, errp); | ||
76 | } | ||
77 | |||
78 | static void iothread_set_aio_param(Object *obj, Visitor *v, | ||
79 | const char *name, void *opaque, Error **errp) | ||
80 | { | ||
81 | IOThread *iothread = IOTHREAD(obj); | ||
82 | + IOThreadParamInfo *info = opaque; | ||
83 | |||
84 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { | ||
85 | + if (!iothread_set_param(obj, v, name, info, errp)) { | ||
86 | return; | ||
87 | } | ||
88 | 154 | ||
89 | -- | 155 | -- |
90 | 2.31.1 | 156 | 2.31.1 |
91 | 157 | ||
92 | 158 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Thomas Weißschuh <thomas.weissschuh.ext@zeiss.com> | ||
1 | 2 | ||
3 | VMDK files support an attribute that represents the version of the guest | ||
4 | tools that are installed on the disk. | ||
5 | This attribute is used by vSphere before a machine has been started to | ||
6 | determine if the VM has the guest tools installed. | ||
7 | This is important when configuring "Operating system customizations" in | ||
8 | vSphere, as it checks for the presence of the guest tools before | ||
9 | allowing those customizations. | ||
10 | Thus when the VM has not yet booted normally it would be impossible to | ||
11 | customize it, therefore preventing a customized first-boot. | ||
12 | |||
13 | The attribute should not hurt on disks that do not have the guest tools | ||
14 | installed and indeed the VMware tools also unconditionally add this | ||
15 | attribute. | ||
16 | (Defaulting to the value "2147483647", as is done in this patch) | ||
17 | |||
18 | Signed-off-by: Thomas Weißschuh <thomas.weissschuh.ext@zeiss.com> | ||
19 | Message-Id: <20210913130419.13241-1-thomas.weissschuh.ext@zeiss.com> | ||
20 | [hreitz: Added missing '#' in block-core.json] | ||
21 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> | ||
22 | --- | ||
23 | qapi/block-core.json | 3 +++ | ||
24 | block/vmdk.c | 24 ++++++++++++++++++++---- | ||
25 | 2 files changed, 23 insertions(+), 4 deletions(-) | ||
26 | |||
27 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/qapi/block-core.json | ||
30 | +++ b/qapi/block-core.json | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | # @adapter-type: The adapter type used to fill in the descriptor. Default: ide. | ||
33 | # @hwversion: Hardware version. The meaningful options are "4" or "6". | ||
34 | # Default: "4". | ||
35 | +# @toolsversion: VMware guest tools version. | ||
36 | +# Default: "2147483647" (Since 6.2) | ||
37 | # @zeroed-grain: Whether to enable zeroed-grain feature for sparse subformats. | ||
38 | # Default: false. | ||
39 | # | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | '*backing-file': 'str', | ||
42 | '*adapter-type': 'BlockdevVmdkAdapterType', | ||
43 | '*hwversion': 'str', | ||
44 | + '*toolsversion': 'str', | ||
45 | '*zeroed-grain': 'bool' } } | ||
46 | |||
47 | |||
48 | diff --git a/block/vmdk.c b/block/vmdk.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/block/vmdk.c | ||
51 | +++ b/block/vmdk.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | #define VMDK_ZEROED (-3) | ||
54 | |||
55 | #define BLOCK_OPT_ZEROED_GRAIN "zeroed_grain" | ||
56 | +#define BLOCK_OPT_TOOLSVERSION "toolsversion" | ||
57 | |||
58 | typedef struct { | ||
59 | uint32_t version; | ||
60 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_do_create(int64_t size, | ||
61 | BlockdevVmdkAdapterType adapter_type, | ||
62 | const char *backing_file, | ||
63 | const char *hw_version, | ||
64 | + const char *toolsversion, | ||
65 | bool compat6, | ||
66 | bool zeroed_grain, | ||
67 | vmdk_create_extent_fn extent_fn, | ||
68 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_do_create(int64_t size, | ||
69 | "ddb.geometry.cylinders = \"%" PRId64 "\"\n" | ||
70 | "ddb.geometry.heads = \"%" PRIu32 "\"\n" | ||
71 | "ddb.geometry.sectors = \"63\"\n" | ||
72 | - "ddb.adapterType = \"%s\"\n"; | ||
73 | + "ddb.adapterType = \"%s\"\n" | ||
74 | + "ddb.toolsVersion = \"%s\"\n"; | ||
75 | |||
76 | ext_desc_lines = g_string_new(NULL); | ||
77 | |||
78 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_do_create(int64_t size, | ||
79 | if (!hw_version) { | ||
80 | hw_version = "4"; | ||
81 | } | ||
82 | + if (!toolsversion) { | ||
83 | + toolsversion = "2147483647"; | ||
84 | + } | ||
85 | |||
86 | if (adapter_type != BLOCKDEV_VMDK_ADAPTER_TYPE_IDE) { | ||
87 | /* that's the number of heads with which vmware operates when | ||
88 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_do_create(int64_t size, | ||
89 | size / | ||
90 | (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), | ||
91 | number_heads, | ||
92 | - BlockdevVmdkAdapterType_str(adapter_type)); | ||
93 | + BlockdevVmdkAdapterType_str(adapter_type), | ||
94 | + toolsversion); | ||
95 | desc_len = strlen(desc); | ||
96 | /* the descriptor offset = 0x200 */ | ||
97 | if (!split && !flat) { | ||
98 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv, | ||
99 | BlockdevVmdkAdapterType adapter_type_enum; | ||
100 | char *backing_file = NULL; | ||
101 | char *hw_version = NULL; | ||
102 | + char *toolsversion = NULL; | ||
103 | char *fmt = NULL; | ||
104 | BlockdevVmdkSubformat subformat; | ||
105 | int ret = 0; | ||
106 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv, | ||
107 | adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE); | ||
108 | backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); | ||
109 | hw_version = qemu_opt_get_del(opts, BLOCK_OPT_HWVERSION); | ||
110 | + toolsversion = qemu_opt_get_del(opts, BLOCK_OPT_TOOLSVERSION); | ||
111 | compat6 = qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false); | ||
112 | if (strcmp(hw_version, "undefined") == 0) { | ||
113 | g_free(hw_version); | ||
114 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv, | ||
115 | .opts = opts, | ||
116 | }; | ||
117 | ret = vmdk_co_do_create(total_size, subformat, adapter_type_enum, | ||
118 | - backing_file, hw_version, compat6, zeroed_grain, | ||
119 | - vmdk_co_create_opts_cb, &data, errp); | ||
120 | + backing_file, hw_version, toolsversion, compat6, | ||
121 | + zeroed_grain, vmdk_co_create_opts_cb, &data, errp); | ||
122 | |||
123 | exit: | ||
124 | g_free(backing_fmt); | ||
125 | g_free(adapter_type); | ||
126 | g_free(backing_file); | ||
127 | g_free(hw_version); | ||
128 | + g_free(toolsversion); | ||
129 | g_free(fmt); | ||
130 | g_free(desc); | ||
131 | g_free(path); | ||
132 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options, | ||
133 | opts->adapter_type, | ||
134 | opts->backing_file, | ||
135 | opts->hwversion, | ||
136 | + opts->toolsversion, | ||
137 | false, | ||
138 | opts->zeroed_grain, | ||
139 | vmdk_co_create_cb, | ||
140 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList vmdk_create_opts = { | ||
141 | .help = "VMDK hardware version", | ||
142 | .def_value_str = "undefined" | ||
143 | }, | ||
144 | + { | ||
145 | + .name = BLOCK_OPT_TOOLSVERSION, | ||
146 | + .type = QEMU_OPT_STRING, | ||
147 | + .help = "VMware guest tools version", | ||
148 | + }, | ||
149 | { | ||
150 | .name = BLOCK_OPT_SUBFMT, | ||
151 | .type = QEMU_OPT_STRING, | ||
152 | -- | ||
153 | 2.31.1 | ||
154 | |||
155 | diff view generated by jsdifflib |
1 | From: Stefano Garzarella <sgarzare@redhat.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added | 3 | The code in vpc.c uses BDRVVPCState->footer.type in various places |
4 | a new parameter (aio-max-batch) to IOThread and used PollParamInfo | 4 | to decide whether the image is a fixed-size (VHD_FIXED) or a dynamic |
5 | structure to handle it. | 5 | (VHD_DYNAMIC) image. However, we never check that this field really |
6 | 6 | contains VHD_FIXED if we detected a fixed size image in vpc_open(), | |
7 | Since it is not a parameter of the polling mechanism, we rename the | 7 | so a wrong value here could cause quite some trouble during runtime. |
8 | structure to a more generic IOThreadParamInfo. | ||
9 | 8 | ||
10 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | 9 | Suggested-by: Kevin Wolf <kwolf@redhat.com> |
11 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | 10 | Signed-off-by: Thomas Huth <thuth@redhat.com> |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 11 | Message-Id: <20211012082702.792259-1-thuth@redhat.com> |
13 | Message-id: 20210727145936.147032-2-sgarzare@redhat.com | 12 | Signed-off-by: Hanna Reitz <hreitz@redhat.com> |
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
15 | --- | 13 | --- |
16 | iothread.c | 14 +++++++------- | 14 | block/vpc.c | 3 ++- |
17 | 1 file changed, 7 insertions(+), 7 deletions(-) | 15 | 1 file changed, 2 insertions(+), 1 deletion(-) |
18 | 16 | ||
19 | diff --git a/iothread.c b/iothread.c | 17 | diff --git a/block/vpc.c b/block/vpc.c |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/iothread.c | 19 | --- a/block/vpc.c |
22 | +++ b/iothread.c | 20 | +++ b/block/vpc.c |
23 | @@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp) | 21 | @@ -XXX,XX +XXX,XX @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, |
24 | typedef struct { | 22 | if (ret < 0) { |
25 | const char *name; | 23 | goto fail; |
26 | ptrdiff_t offset; /* field's byte offset in IOThread struct */ | 24 | } |
27 | -} PollParamInfo; | 25 | - if (strncmp(footer->creator, "conectix", 8)) { |
28 | +} IOThreadParamInfo; | 26 | + if (strncmp(footer->creator, "conectix", 8) || |
29 | 27 | + be32_to_cpu(footer->type) != VHD_FIXED) { | |
30 | -static PollParamInfo poll_max_ns_info = { | 28 | error_setg(errp, "invalid VPC image"); |
31 | +static IOThreadParamInfo poll_max_ns_info = { | 29 | ret = -EINVAL; |
32 | "poll-max-ns", offsetof(IOThread, poll_max_ns), | 30 | goto fail; |
33 | }; | ||
34 | -static PollParamInfo poll_grow_info = { | ||
35 | +static IOThreadParamInfo poll_grow_info = { | ||
36 | "poll-grow", offsetof(IOThread, poll_grow), | ||
37 | }; | ||
38 | -static PollParamInfo poll_shrink_info = { | ||
39 | +static IOThreadParamInfo poll_shrink_info = { | ||
40 | "poll-shrink", offsetof(IOThread, poll_shrink), | ||
41 | }; | ||
42 | -static PollParamInfo aio_max_batch_info = { | ||
43 | +static IOThreadParamInfo aio_max_batch_info = { | ||
44 | "aio-max-batch", offsetof(IOThread, aio_max_batch), | ||
45 | }; | ||
46 | |||
47 | @@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v, | ||
48 | const char *name, void *opaque, Error **errp) | ||
49 | { | ||
50 | IOThread *iothread = IOTHREAD(obj); | ||
51 | - PollParamInfo *info = opaque; | ||
52 | + IOThreadParamInfo *info = opaque; | ||
53 | int64_t *field = (void *)iothread + info->offset; | ||
54 | |||
55 | visit_type_int64(v, name, field, errp); | ||
56 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, | ||
57 | const char *name, void *opaque, Error **errp) | ||
58 | { | ||
59 | IOThread *iothread = IOTHREAD(obj); | ||
60 | - PollParamInfo *info = opaque; | ||
61 | + IOThreadParamInfo *info = opaque; | ||
62 | int64_t *field = (void *)iothread + info->offset; | ||
63 | int64_t value; | ||
64 | |||
65 | -- | 31 | -- |
66 | 2.31.1 | 32 | 2.31.1 |
67 | 33 | ||
68 | 34 | diff view generated by jsdifflib |