1 | The following changes since commit 38441756b70eec5807b5f60dad11a93a91199866: | 1 | The following changes since commit 138d2931979cb7ee4a54a434a54088231f6980ff: |
---|---|---|---|
2 | 2 | ||
3 | Update version for v3.0.0 release (2018-08-14 16:38:43 +0100) | 3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210308' into staging (2021-03-08 11:57:36 +0000) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream | 7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream |
8 | 8 | ||
9 | for you to fetch changes up to b5fc2d306664c0c1c6c5cf8e164ffa7b8892283e: | 9 | for you to fetch changes up to ef2e38a1a1d2915b148c4a49f61626e62c46fbb6: |
10 | 10 | ||
11 | qapi: block: Remove mentions of error types which were removed (2018-08-15 12:50:39 +0200) | 11 | blockdev: Clarify error messages pertaining to 'node-name' (2021-03-08 14:56:55 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block layer patches: | 14 | Block layer patches: |
15 | 15 | ||
16 | - Remove deprecated -drive options for geometry/serial/addr | 16 | - qemu-storage-daemon: add --pidfile option |
17 | - luks: Allow shared writers if the parents allow them (share-rw=on) | 17 | - qemu-storage-daemon: CLI error messages include the option name now |
18 | - qemu-img: Fix error when trying to convert to encrypted target image | 18 | - vhost-user-blk export: Misc fixes |
19 | - mirror: Fail gracefully for source == target | 19 | - docs: Improvements for qemu-storage-daemon documentation |
20 | - I/O throttling: Fix behaviour during drain (always ignore the limits) | 20 | - parallels: load bitmap extension |
21 | - bdrv_reopen() related fixes for bs->options/explicit_options content | 21 | - backup-top: Don't crash on post-finalize accesses |
22 | - Documentation improvements | 22 | - Improve error messages related to node-name options |
23 | - iotests improvements | ||
23 | 24 | ||
24 | ---------------------------------------------------------------- | 25 | ---------------------------------------------------------------- |
25 | Alberto Garcia (9): | 26 | Alberto Garcia (1): |
26 | qemu-iotests: Test removing a throttle group member with a pending timer | 27 | iotests: Drop deprecated 'props' from object-add |
27 | throttle-groups: Skip the round-robin if a member is being drained | ||
28 | qemu-iotests: Update 093 to improve the draining test | ||
29 | throttle-groups: Don't allow timers without throttled requests | ||
30 | qdict: Make qdict_extract_subqdict() accept dst = NULL | ||
31 | block: Remove children options from bs->{options,explicit_options} | ||
32 | block: Simplify bdrv_reopen_abort() | ||
33 | block: Update bs->options if bdrv_reopen() succeeds | ||
34 | block: Simplify append_open_options() | ||
35 | 28 | ||
36 | Daniel P. Berrangé (1): | 29 | Connor Kuehl (2): |
37 | qemu-img: fix regression copying secrets during convert | 30 | block: Clarify error messages pertaining to 'node-name' |
31 | blockdev: Clarify error messages pertaining to 'node-name' | ||
38 | 32 | ||
39 | Fam Zheng (1): | 33 | Eric Blake (1): |
40 | luks: Allow share-rw=on | 34 | iotests: Fix up python style in 300 |
41 | 35 | ||
42 | Kevin Wolf (7): | 36 | Kevin Wolf (1): |
43 | block/qapi: Fix memory leak in qmp_query_blockstats() | 37 | docs: qsd: Explain --export nbd,name=... default |
44 | block: Remove deprecated -drive geometry options | ||
45 | block: Remove deprecated -drive option addr | ||
46 | block: Remove deprecated -drive option serial | ||
47 | block: Remove dead deprecation warning code | ||
48 | qapi/block: Document restrictions for node names | ||
49 | mirror: Fail gracefully for source == target | ||
50 | 38 | ||
51 | Peter Krempa (1): | 39 | Max Reitz (3): |
52 | qapi: block: Remove mentions of error types which were removed | 40 | backup: Remove nodes from job in .clean() |
41 | backup-top: Refuse I/O in inactive state | ||
42 | iotests/283: Check that finalize drops backup-top | ||
53 | 43 | ||
54 | Vladimir Sementsov-Ogievskiy (2): | 44 | Paolo Bonzini (2): |
55 | block: make .bdrv_close optional | 45 | storage-daemon: report unexpected arguments on the fly |
56 | block: drop empty .bdrv_close handlers | 46 | storage-daemon: include current command line option in the errors |
57 | 47 | ||
58 | qapi/block-core.json | 8 ++-- | 48 | Stefan Hajnoczi (12): |
59 | include/hw/block/block.h | 1 - | 49 | qemu-storage-daemon: add --pidfile option |
60 | include/sysemu/blockdev.h | 3 -- | 50 | docs: show how to spawn qemu-storage-daemon with fd passing |
61 | block.c | 46 ++++++++++++++----- | 51 | docs: replace insecure /tmp examples in qsd docs |
62 | block/blkreplay.c | 5 --- | 52 | vhost-user-blk: fix blkcfg->num_queues endianness |
63 | block/block-backend.c | 1 - | 53 | libqtest: add qtest_socket_server() |
64 | block/commit.c | 5 --- | 54 | libqtest: add qtest_kill_qemu() |
65 | block/copy-on-read.c | 6 --- | 55 | libqtest: add qtest_remove_abrt_handler() |
66 | block/crypto.c | 4 +- | 56 | block/export: fix blk_size double byteswap |
67 | block/mirror.c | 10 ++--- | 57 | block/export: use VIRTIO_BLK_SECTOR_BITS |
68 | block/null.c | 6 --- | 58 | block/export: fix vhost-user-blk export sector number calculation |
69 | block/qapi.c | 3 +- | 59 | block/export: port virtio-blk discard/write zeroes input validation |
70 | block/raw-format.c | 5 --- | 60 | block/export: port virtio-blk read/write range check |
71 | block/snapshot.c | 4 +- | ||
72 | block/throttle-groups.c | 41 ++++++++++++----- | ||
73 | blockdev.c | 110 --------------------------------------------- | ||
74 | device-hotplug.c | 4 -- | ||
75 | hw/block/block.c | 27 ----------- | ||
76 | hw/block/nvme.c | 1 - | ||
77 | hw/block/virtio-blk.c | 1 - | ||
78 | hw/ide/qdev.c | 1 - | ||
79 | hw/scsi/scsi-disk.c | 1 - | ||
80 | hw/usb/dev-storage.c | 1 - | ||
81 | qemu-img.c | 32 +++++++------ | ||
82 | qobject/block-qdict.c | 11 +++-- | ||
83 | tests/ahci-test.c | 6 +-- | ||
84 | tests/hd-geo-test.c | 37 +++------------ | ||
85 | tests/ide-test.c | 8 ++-- | ||
86 | hmp-commands.hx | 1 - | ||
87 | qemu-deprecated.texi | 15 ------- | ||
88 | qemu-options.hx | 14 +----- | ||
89 | tests/qemu-iotests/041 | 6 +++ | ||
90 | tests/qemu-iotests/041.out | 4 +- | ||
91 | tests/qemu-iotests/093 | 55 +++++++++++++++++++++++ | ||
92 | tests/qemu-iotests/093.out | 4 +- | ||
93 | 35 files changed, 185 insertions(+), 302 deletions(-) | ||
94 | 61 | ||
62 | Stefano Garzarella (1): | ||
63 | blockjob: report a better error message | ||
64 | |||
65 | Vladimir Sementsov-Ogievskiy (7): | ||
66 | qcow2-bitmap: make bytes_covered_by_bitmap_cluster() public | ||
67 | parallels.txt: fix bitmap L1 table description | ||
68 | block/parallels: BDRVParallelsState: add cluster_size field | ||
69 | parallels: support bitmap extension for read-only mode | ||
70 | iotests.py: add unarchive_sample_image() helper | ||
71 | iotests: add parallels-read-bitmap test | ||
72 | MAINTAINERS: update parallels block driver | ||
73 | |||
74 | docs/interop/parallels.txt | 28 +- | ||
75 | docs/tools/qemu-storage-daemon.rst | 68 ++++- | ||
76 | block/parallels.h | 7 +- | ||
77 | include/block/dirty-bitmap.h | 2 + | ||
78 | tests/qtest/libqos/libqtest.h | 37 +++ | ||
79 | block.c | 8 +- | ||
80 | block/backup-top.c | 10 + | ||
81 | block/backup.c | 1 + | ||
82 | block/dirty-bitmap.c | 13 + | ||
83 | block/export/vhost-user-blk-server.c | 150 +++++++++-- | ||
84 | block/parallels-ext.c | 300 +++++++++++++++++++++ | ||
85 | block/parallels.c | 26 +- | ||
86 | block/qcow2-bitmap.c | 16 +- | ||
87 | blockdev.c | 13 +- | ||
88 | blockjob.c | 10 +- | ||
89 | hw/block/vhost-user-blk.c | 7 +- | ||
90 | storage-daemon/qemu-storage-daemon.c | 56 +++- | ||
91 | tests/qtest/libqtest.c | 82 ++++-- | ||
92 | tests/qemu-iotests/iotests.py | 10 + | ||
93 | MAINTAINERS | 3 + | ||
94 | block/meson.build | 3 +- | ||
95 | tests/qemu-iotests/030 | 4 +- | ||
96 | tests/qemu-iotests/040 | 4 +- | ||
97 | tests/qemu-iotests/051.pc.out | 6 +- | ||
98 | tests/qemu-iotests/081.out | 2 +- | ||
99 | tests/qemu-iotests/085.out | 6 +- | ||
100 | tests/qemu-iotests/087 | 8 +- | ||
101 | tests/qemu-iotests/087.out | 2 +- | ||
102 | tests/qemu-iotests/184 | 18 +- | ||
103 | tests/qemu-iotests/206.out | 2 +- | ||
104 | tests/qemu-iotests/210.out | 2 +- | ||
105 | tests/qemu-iotests/211.out | 2 +- | ||
106 | tests/qemu-iotests/212.out | 2 +- | ||
107 | tests/qemu-iotests/213.out | 2 +- | ||
108 | tests/qemu-iotests/218 | 2 +- | ||
109 | tests/qemu-iotests/223.out | 4 +- | ||
110 | tests/qemu-iotests/235 | 2 +- | ||
111 | tests/qemu-iotests/237.out | 2 +- | ||
112 | tests/qemu-iotests/245 | 14 +- | ||
113 | tests/qemu-iotests/249.out | 2 +- | ||
114 | tests/qemu-iotests/258 | 6 +- | ||
115 | tests/qemu-iotests/258.out | 4 +- | ||
116 | tests/qemu-iotests/283 | 53 ++++ | ||
117 | tests/qemu-iotests/283.out | 15 ++ | ||
118 | tests/qemu-iotests/295 | 2 +- | ||
119 | tests/qemu-iotests/296 | 2 +- | ||
120 | tests/qemu-iotests/300 | 14 +- | ||
121 | .../sample_images/parallels-with-bitmap.bz2 | Bin 0 -> 203 bytes | ||
122 | .../sample_images/parallels-with-bitmap.sh | 51 ++++ | ||
123 | tests/qemu-iotests/tests/parallels-read-bitmap | 55 ++++ | ||
124 | tests/qemu-iotests/tests/parallels-read-bitmap.out | 6 + | ||
125 | 51 files changed, 969 insertions(+), 175 deletions(-) | ||
126 | create mode 100644 block/parallels-ext.c | ||
127 | create mode 100644 tests/qemu-iotests/sample_images/parallels-with-bitmap.bz2 | ||
128 | create mode 100755 tests/qemu-iotests/sample_images/parallels-with-bitmap.sh | ||
129 | create mode 100755 tests/qemu-iotests/tests/parallels-read-bitmap | ||
130 | create mode 100644 tests/qemu-iotests/tests/parallels-read-bitmap.out | ||
131 | |||
132 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For BlockBackends that are skipped in query-blockstats, we would leak | ||
2 | info since commit 567dcb31. Allocate info only later to avoid the memory | ||
3 | leak. | ||
4 | 1 | ||
5 | Fixes: CID 1394727 | ||
6 | Cc: qemu-stable@nongnu.org | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
9 | --- | ||
10 | block/qapi.c | 3 ++- | ||
11 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/block/qapi.c b/block/qapi.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block/qapi.c | ||
16 | +++ b/block/qapi.c | ||
17 | @@ -XXX,XX +XXX,XX @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes, | ||
18 | } | ||
19 | } else { | ||
20 | for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) { | ||
21 | - BlockStatsList *info = g_malloc0(sizeof(*info)); | ||
22 | + BlockStatsList *info; | ||
23 | AioContext *ctx = blk_get_aio_context(blk); | ||
24 | BlockStats *s; | ||
25 | char *qdev; | ||
26 | @@ -XXX,XX +XXX,XX @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes, | ||
27 | bdrv_query_blk_stats(s->stats, blk); | ||
28 | aio_context_release(ctx); | ||
29 | |||
30 | + info = g_malloc0(sizeof(*info)); | ||
31 | info->value = s; | ||
32 | *p_next = info; | ||
33 | p_next = &info->next; | ||
34 | -- | ||
35 | 2.13.6 | ||
36 | |||
37 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | A throttle group can have several members, and each one of them can | ||
4 | have several pending requests in the queue. | ||
5 | |||
6 | The requests are processed in a round-robin fashion, so the algorithm | ||
7 | decides the drive that is going to run the next request and sets a | ||
8 | timer in it. Once the timer fires and the throttled request is run | ||
9 | then the next drive from the group is selected and a new timer is set. | ||
10 | |||
11 | If the user tried to remove a drive from a group and that drive had a | ||
12 | timer set then the code was not taking care of setting up a new timer | ||
13 | in one of the remaining members of the group, freezing their I/O. | ||
14 | |||
15 | This problem was fixed in 6fccbb475bc6effc313ee9481726a1748b6dae57, | ||
16 | and this patch adds a new test case that reproduces this exact | ||
17 | scenario. | ||
18 | |||
19 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
20 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
21 | --- | ||
22 | tests/qemu-iotests/093 | 52 ++++++++++++++++++++++++++++++++++++++++++++++ | ||
23 | tests/qemu-iotests/093.out | 4 ++-- | ||
24 | 2 files changed, 54 insertions(+), 2 deletions(-) | ||
25 | |||
26 | diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 | ||
27 | index XXXXXXX..XXXXXXX 100755 | ||
28 | --- a/tests/qemu-iotests/093 | ||
29 | +++ b/tests/qemu-iotests/093 | ||
30 | @@ -XXX,XX +XXX,XX @@ class ThrottleTestCase(iotests.QMPTestCase): | ||
31 | limits[tk] = rate | ||
32 | self.do_test_throttle(ndrives, 5, limits) | ||
33 | |||
34 | + # Test that removing a drive from a throttle group should not | ||
35 | + # affect the remaining members of the group. | ||
36 | + # https://bugzilla.redhat.com/show_bug.cgi?id=1535914 | ||
37 | + def test_remove_group_member(self): | ||
38 | + # Create a throttle group with two drives | ||
39 | + # and set a 4 KB/s read limit. | ||
40 | + params = {"bps": 0, | ||
41 | + "bps_rd": 4096, | ||
42 | + "bps_wr": 0, | ||
43 | + "iops": 0, | ||
44 | + "iops_rd": 0, | ||
45 | + "iops_wr": 0 } | ||
46 | + self.configure_throttle(2, params) | ||
47 | + | ||
48 | + # Read 4KB from drive0. This is performed immediately. | ||
49 | + self.vm.hmp_qemu_io("drive0", "aio_read 0 4096") | ||
50 | + | ||
51 | + # Read 4KB again. The I/O limit has been exceeded so this | ||
52 | + # request is throttled and a timer is set to wake it up. | ||
53 | + self.vm.hmp_qemu_io("drive0", "aio_read 0 4096") | ||
54 | + | ||
55 | + # Read from drive1. We're still over the I/O limit so this | ||
56 | + # request is also throttled. There's no timer set in drive1 | ||
57 | + # because there's already one in drive0. Once the timer in | ||
58 | + # drive0 fires and its throttled request is processed then the | ||
59 | + # next request in the queue will be scheduled: this one. | ||
60 | + self.vm.hmp_qemu_io("drive1", "aio_read 0 4096") | ||
61 | + | ||
62 | + # At this point only the first 4KB have been read from drive0. | ||
63 | + # The other requests are throttled. | ||
64 | + self.assertEqual(self.blockstats('drive0')[0], 4096) | ||
65 | + self.assertEqual(self.blockstats('drive1')[0], 0) | ||
66 | + | ||
67 | + # Remove drive0 from the throttle group and disable its I/O limits. | ||
68 | + # drive1 remains in the group with a throttled request. | ||
69 | + params['bps_rd'] = 0 | ||
70 | + params['device'] = 'drive0' | ||
71 | + result = self.vm.qmp("block_set_io_throttle", conv_keys=False, **params) | ||
72 | + self.assert_qmp(result, 'return', {}) | ||
73 | + | ||
74 | + # Removing the I/O limits from drive0 drains its pending request. | ||
75 | + # The read request in drive1 is still throttled. | ||
76 | + self.assertEqual(self.blockstats('drive0')[0], 8192) | ||
77 | + self.assertEqual(self.blockstats('drive1')[0], 0) | ||
78 | + | ||
79 | + # Advance the clock 5 seconds. This completes the request in drive1 | ||
80 | + self.vm.qtest("clock_step %d" % (5 * nsec_per_sec)) | ||
81 | + | ||
82 | + # Now all requests have been processed. | ||
83 | + self.assertEqual(self.blockstats('drive0')[0], 8192) | ||
84 | + self.assertEqual(self.blockstats('drive1')[0], 4096) | ||
85 | + | ||
86 | class ThrottleTestCoroutine(ThrottleTestCase): | ||
87 | test_img = "null-co://" | ||
88 | |||
89 | diff --git a/tests/qemu-iotests/093.out b/tests/qemu-iotests/093.out | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/tests/qemu-iotests/093.out | ||
92 | +++ b/tests/qemu-iotests/093.out | ||
93 | @@ -XXX,XX +XXX,XX @@ | ||
94 | -........ | ||
95 | +.......... | ||
96 | ---------------------------------------------------------------------- | ||
97 | -Ran 8 tests | ||
98 | +Ran 10 tests | ||
99 | |||
100 | OK | ||
101 | -- | ||
102 | 2.13.6 | ||
103 | |||
104 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | In the throttling code after an I/O request has been completed the | ||
4 | next one is selected from a different member using a round-robin | ||
5 | algorithm. This ensures that all members get a chance to finish their | ||
6 | pending I/O requests. | ||
7 | |||
8 | However, if a group member has its I/O limits disabled (because it's | ||
9 | being drained) then we should always give it priority in order to have | ||
10 | all its pending requests finished as soon as possible. | ||
11 | |||
12 | If we don't do this we could have a member in the process of being | ||
13 | drained waiting for the throttled requests of other members, for which | ||
14 | the I/O limits still apply. | ||
15 | |||
16 | This can have additional consequences: if we're running in qtest mode | ||
17 | (with QEMU_CLOCK_VIRTUAL) then timers can only fire if we advance the | ||
18 | clock manually, so attempting to drain a block device can hang QEMU in | ||
19 | the BDRV_POLL_WHILE() loop at the end of bdrv_do_drained_begin(). | ||
20 | |||
21 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
22 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
23 | --- | ||
24 | block/throttle-groups.c | 9 +++++++++ | ||
25 | 1 file changed, 9 insertions(+) | ||
26 | |||
27 | diff --git a/block/throttle-groups.c b/block/throttle-groups.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/block/throttle-groups.c | ||
30 | +++ b/block/throttle-groups.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static ThrottleGroupMember *next_throttle_token(ThrottleGroupMember *tgm, | ||
32 | ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts); | ||
33 | ThrottleGroupMember *token, *start; | ||
34 | |||
35 | + /* If this member has its I/O limits disabled then it means that | ||
36 | + * it's being drained. Skip the round-robin search and return tgm | ||
37 | + * immediately if it has pending requests. Otherwise we could be | ||
38 | + * forcing it to wait for other member's throttled requests. */ | ||
39 | + if (tgm_has_pending_reqs(tgm, is_write) && | ||
40 | + atomic_read(&tgm->io_limits_disabled)) { | ||
41 | + return tgm; | ||
42 | + } | ||
43 | + | ||
44 | start = token = tg->tokens[is_write]; | ||
45 | |||
46 | /* get next bs round in round robin style */ | ||
47 | -- | ||
48 | 2.13.6 | ||
49 | |||
50 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | The previous patch fixes a problem in which draining a block device | ||
4 | with more than one throttled request can make it wait first for the | ||
5 | completion of requests in other members of the same group. | ||
6 | |||
7 | This patch updates test_remove_group_member() in iotest 093 to | ||
8 | reproduce that scenario. This updated test would hang QEMU without the | ||
9 | fix from the previous patch. | ||
10 | |||
11 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
13 | --- | ||
14 | tests/qemu-iotests/093 | 19 +++++++++++-------- | ||
15 | 1 file changed, 11 insertions(+), 8 deletions(-) | ||
16 | |||
17 | diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 | ||
18 | index XXXXXXX..XXXXXXX 100755 | ||
19 | --- a/tests/qemu-iotests/093 | ||
20 | +++ b/tests/qemu-iotests/093 | ||
21 | @@ -XXX,XX +XXX,XX @@ class ThrottleTestCase(iotests.QMPTestCase): | ||
22 | # Read 4KB from drive0. This is performed immediately. | ||
23 | self.vm.hmp_qemu_io("drive0", "aio_read 0 4096") | ||
24 | |||
25 | - # Read 4KB again. The I/O limit has been exceeded so this | ||
26 | + # Read 2KB. The I/O limit has been exceeded so this | ||
27 | # request is throttled and a timer is set to wake it up. | ||
28 | - self.vm.hmp_qemu_io("drive0", "aio_read 0 4096") | ||
29 | + self.vm.hmp_qemu_io("drive0", "aio_read 0 2048") | ||
30 | + | ||
31 | + # Read 2KB again. We're still over the I/O limit so this is | ||
32 | + # request is also throttled, but no new timer is set since | ||
33 | + # there's already one. | ||
34 | + self.vm.hmp_qemu_io("drive0", "aio_read 0 2048") | ||
35 | |||
36 | - # Read from drive1. We're still over the I/O limit so this | ||
37 | - # request is also throttled. There's no timer set in drive1 | ||
38 | - # because there's already one in drive0. Once the timer in | ||
39 | - # drive0 fires and its throttled request is processed then the | ||
40 | - # next request in the queue will be scheduled: this one. | ||
41 | + # Read from drive1. This request is also throttled, and no | ||
42 | + # timer is set in drive1 because there's already one in | ||
43 | + # drive0. | ||
44 | self.vm.hmp_qemu_io("drive1", "aio_read 0 4096") | ||
45 | |||
46 | # At this point only the first 4KB have been read from drive0. | ||
47 | @@ -XXX,XX +XXX,XX @@ class ThrottleTestCase(iotests.QMPTestCase): | ||
48 | result = self.vm.qmp("block_set_io_throttle", conv_keys=False, **params) | ||
49 | self.assert_qmp(result, 'return', {}) | ||
50 | |||
51 | - # Removing the I/O limits from drive0 drains its pending request. | ||
52 | + # Removing the I/O limits from drive0 drains its two pending requests. | ||
53 | # The read request in drive1 is still throttled. | ||
54 | self.assertEqual(self.blockstats('drive0')[0], 8192) | ||
55 | self.assertEqual(self.blockstats('drive1')[0], 0) | ||
56 | -- | ||
57 | 2.13.6 | ||
58 | |||
59 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | Commit 6fccbb475bc6effc313ee9481726a1748b6dae57 fixed a bug caused by | ||
4 | QEMU attempting to remove a throttle group member with no pending | ||
5 | requests but an active timer set. This was the result of a previous | ||
6 | bdrv_drained_begin() call processing the throttled requests but | ||
7 | leaving the timer untouched. | ||
8 | |||
9 | Although the commit does solve the problem, the situation shouldn't | ||
10 | happen in the first place. If we try to drain a throttle group member | ||
11 | which has a timer set, we should cancel the timer instead of ignoring | ||
12 | it. | ||
13 | |||
14 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
15 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
16 | --- | ||
17 | block/throttle-groups.c | 32 ++++++++++++++++++++++---------- | ||
18 | 1 file changed, 22 insertions(+), 10 deletions(-) | ||
19 | |||
20 | diff --git a/block/throttle-groups.c b/block/throttle-groups.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/block/throttle-groups.c | ||
23 | +++ b/block/throttle-groups.c | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | |||
26 | static void throttle_group_obj_init(Object *obj); | ||
27 | static void throttle_group_obj_complete(UserCreatable *obj, Error **errp); | ||
28 | +static void timer_cb(ThrottleGroupMember *tgm, bool is_write); | ||
29 | |||
30 | /* The ThrottleGroup structure (with its ThrottleState) is shared | ||
31 | * among different ThrottleGroupMembers and it's independent from | ||
32 | @@ -XXX,XX +XXX,XX @@ static void throttle_group_restart_queue(ThrottleGroupMember *tgm, bool is_write | ||
33 | rd->tgm = tgm; | ||
34 | rd->is_write = is_write; | ||
35 | |||
36 | + /* This function is called when a timer is fired or when | ||
37 | + * throttle_group_restart_tgm() is called. Either way, there can | ||
38 | + * be no timer pending on this tgm at this point */ | ||
39 | + assert(!timer_pending(tgm->throttle_timers.timers[is_write])); | ||
40 | + | ||
41 | co = qemu_coroutine_create(throttle_group_restart_queue_entry, rd); | ||
42 | aio_co_enter(tgm->aio_context, co); | ||
43 | } | ||
44 | |||
45 | void throttle_group_restart_tgm(ThrottleGroupMember *tgm) | ||
46 | { | ||
47 | + int i; | ||
48 | + | ||
49 | if (tgm->throttle_state) { | ||
50 | - throttle_group_restart_queue(tgm, 0); | ||
51 | - throttle_group_restart_queue(tgm, 1); | ||
52 | + for (i = 0; i < 2; i++) { | ||
53 | + QEMUTimer *t = tgm->throttle_timers.timers[i]; | ||
54 | + if (timer_pending(t)) { | ||
55 | + /* If there's a pending timer on this tgm, fire it now */ | ||
56 | + timer_del(t); | ||
57 | + timer_cb(tgm, i); | ||
58 | + } else { | ||
59 | + /* Else run the next request from the queue manually */ | ||
60 | + throttle_group_restart_queue(tgm, i); | ||
61 | + } | ||
62 | + } | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @@ -XXX,XX +XXX,XX @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm) | ||
67 | return; | ||
68 | } | ||
69 | |||
70 | - assert(tgm->pending_reqs[0] == 0 && tgm->pending_reqs[1] == 0); | ||
71 | - assert(qemu_co_queue_empty(&tgm->throttled_reqs[0])); | ||
72 | - assert(qemu_co_queue_empty(&tgm->throttled_reqs[1])); | ||
73 | - | ||
74 | qemu_mutex_lock(&tg->lock); | ||
75 | for (i = 0; i < 2; i++) { | ||
76 | - if (timer_pending(tgm->throttle_timers.timers[i])) { | ||
77 | - tg->any_timer_armed[i] = false; | ||
78 | - schedule_next_request(tgm, i); | ||
79 | - } | ||
80 | + assert(tgm->pending_reqs[i] == 0); | ||
81 | + assert(qemu_co_queue_empty(&tgm->throttled_reqs[i])); | ||
82 | + assert(!timer_pending(tgm->throttle_timers.timers[i])); | ||
83 | if (tg->tokens[i] == tgm) { | ||
84 | token = throttle_group_next_tgm(tgm); | ||
85 | /* Take care of the case where this is the last tgm in the group */ | ||
86 | -- | ||
87 | 2.13.6 | ||
88 | |||
89 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Fam Zheng <famz@redhat.com> | ||
2 | 1 | ||
3 | Format drivers such as qcow2 don't allow sharing the same image between | ||
4 | two QEMU instances in order to prevent image corruptions, because of | ||
5 | metadata cache. LUKS driver don't modify metadata except for when | ||
6 | creating image, so it is safe to relax the permission. This makes | ||
7 | share-rw=on property work on virtual devices. | ||
8 | |||
9 | Suggested-by: Daniel P. Berrangé <berrange@redhat.com> | ||
10 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
11 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
13 | --- | ||
14 | block/crypto.c | 4 +++- | ||
15 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/block/crypto.c b/block/crypto.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/block/crypto.c | ||
20 | +++ b/block/crypto.c | ||
21 | @@ -XXX,XX +XXX,XX @@ BlockDriver bdrv_crypto_luks = { | ||
22 | .bdrv_probe = block_crypto_probe_luks, | ||
23 | .bdrv_open = block_crypto_open_luks, | ||
24 | .bdrv_close = block_crypto_close, | ||
25 | - .bdrv_child_perm = bdrv_format_default_perms, | ||
26 | + /* This driver doesn't modify LUKS metadata except when creating image. | ||
27 | + * Allow share-rw=on as a special case. */ | ||
28 | + .bdrv_child_perm = bdrv_filter_default_perms, | ||
29 | .bdrv_co_create = block_crypto_co_create_luks, | ||
30 | .bdrv_co_create_opts = block_crypto_co_create_opts_luks, | ||
31 | .bdrv_co_truncate = block_crypto_co_truncate, | ||
32 | -- | ||
33 | 2.13.6 | ||
34 | |||
35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | This reinstates commit a7aff6dd10b16b67e8b142d0c94c5d92c3fe88f6, | ||
2 | which was temporarily reverted for the 3.0 release so that libvirt gets | ||
3 | some extra time to update their command lines. | ||
4 | 1 | ||
5 | The -drive options cyls, heads, secs and trans were deprecated in | ||
6 | QEMU 2.10. It's time to remove them. | ||
7 | |||
8 | hd-geo-test tested both the old version with geometry options in -drive | ||
9 | and the new one with -device. Therefore the code using -drive doesn't | ||
10 | have to be replaced there, we just need to remove the -drive test cases. | ||
11 | This in turn allows some simplification of the code. | ||
12 | |||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
15 | --- | ||
16 | include/sysemu/blockdev.h | 1 - | ||
17 | blockdev.c | 75 +---------------------------------------------- | ||
18 | hw/block/block.c | 14 --------- | ||
19 | tests/hd-geo-test.c | 37 +++++------------------ | ||
20 | hmp-commands.hx | 1 - | ||
21 | qemu-deprecated.texi | 5 ---- | ||
22 | qemu-options.hx | 7 +---- | ||
23 | 7 files changed, 9 insertions(+), 131 deletions(-) | ||
24 | |||
25 | diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/include/sysemu/blockdev.h | ||
28 | +++ b/include/sysemu/blockdev.h | ||
29 | @@ -XXX,XX +XXX,XX @@ struct DriveInfo { | ||
30 | int auto_del; /* see blockdev_mark_auto_del() */ | ||
31 | bool is_default; /* Added by default_drive() ? */ | ||
32 | int media_cd; | ||
33 | - int cyls, heads, secs, trans; | ||
34 | QemuOpts *opts; | ||
35 | char *serial; | ||
36 | QTAILQ_ENTRY(DriveInfo) next; | ||
37 | diff --git a/blockdev.c b/blockdev.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/blockdev.c | ||
40 | +++ b/blockdev.c | ||
41 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_legacy_drive_opts = { | ||
42 | .type = QEMU_OPT_STRING, | ||
43 | .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", | ||
44 | },{ | ||
45 | - .name = "cyls", | ||
46 | - .type = QEMU_OPT_NUMBER, | ||
47 | - .help = "number of cylinders (ide disk geometry)", | ||
48 | - },{ | ||
49 | - .name = "heads", | ||
50 | - .type = QEMU_OPT_NUMBER, | ||
51 | - .help = "number of heads (ide disk geometry)", | ||
52 | - },{ | ||
53 | - .name = "secs", | ||
54 | - .type = QEMU_OPT_NUMBER, | ||
55 | - .help = "number of sectors (ide disk geometry)", | ||
56 | - },{ | ||
57 | - .name = "trans", | ||
58 | - .type = QEMU_OPT_STRING, | ||
59 | - .help = "chs translation (auto, lba, none)", | ||
60 | - },{ | ||
61 | .name = "addr", | ||
62 | .type = QEMU_OPT_STRING, | ||
63 | .help = "pci address (virtio only)", | ||
64 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
65 | QemuOpts *legacy_opts; | ||
66 | DriveMediaType media = MEDIA_DISK; | ||
67 | BlockInterfaceType type; | ||
68 | - int cyls, heads, secs, translation; | ||
69 | int max_devs, bus_id, unit_id, index; | ||
70 | const char *devaddr; | ||
71 | const char *werror, *rerror; | ||
72 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
73 | Error *local_err = NULL; | ||
74 | int i; | ||
75 | const char *deprecated[] = { | ||
76 | - "serial", "trans", "secs", "heads", "cyls", "addr" | ||
77 | + "serial", "addr" | ||
78 | }; | ||
79 | |||
80 | /* Change legacy command line options into QMP ones */ | ||
81 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
82 | type = block_default_type; | ||
83 | } | ||
84 | |||
85 | - /* Geometry */ | ||
86 | - cyls = qemu_opt_get_number(legacy_opts, "cyls", 0); | ||
87 | - heads = qemu_opt_get_number(legacy_opts, "heads", 0); | ||
88 | - secs = qemu_opt_get_number(legacy_opts, "secs", 0); | ||
89 | - | ||
90 | - if (cyls || heads || secs) { | ||
91 | - if (cyls < 1) { | ||
92 | - error_report("invalid physical cyls number"); | ||
93 | - goto fail; | ||
94 | - } | ||
95 | - if (heads < 1) { | ||
96 | - error_report("invalid physical heads number"); | ||
97 | - goto fail; | ||
98 | - } | ||
99 | - if (secs < 1) { | ||
100 | - error_report("invalid physical secs number"); | ||
101 | - goto fail; | ||
102 | - } | ||
103 | - } | ||
104 | - | ||
105 | - translation = BIOS_ATA_TRANSLATION_AUTO; | ||
106 | - value = qemu_opt_get(legacy_opts, "trans"); | ||
107 | - if (value != NULL) { | ||
108 | - if (!cyls) { | ||
109 | - error_report("'%s' trans must be used with cyls, heads and secs", | ||
110 | - value); | ||
111 | - goto fail; | ||
112 | - } | ||
113 | - if (!strcmp(value, "none")) { | ||
114 | - translation = BIOS_ATA_TRANSLATION_NONE; | ||
115 | - } else if (!strcmp(value, "lba")) { | ||
116 | - translation = BIOS_ATA_TRANSLATION_LBA; | ||
117 | - } else if (!strcmp(value, "large")) { | ||
118 | - translation = BIOS_ATA_TRANSLATION_LARGE; | ||
119 | - } else if (!strcmp(value, "rechs")) { | ||
120 | - translation = BIOS_ATA_TRANSLATION_RECHS; | ||
121 | - } else if (!strcmp(value, "auto")) { | ||
122 | - translation = BIOS_ATA_TRANSLATION_AUTO; | ||
123 | - } else { | ||
124 | - error_report("'%s' invalid translation type", value); | ||
125 | - goto fail; | ||
126 | - } | ||
127 | - } | ||
128 | - | ||
129 | - if (media == MEDIA_CDROM) { | ||
130 | - if (cyls || secs || heads) { | ||
131 | - error_report("CHS can't be set with media=cdrom"); | ||
132 | - goto fail; | ||
133 | - } | ||
134 | - } | ||
135 | - | ||
136 | /* Device address specified by bus/unit or index. | ||
137 | * If none was specified, try to find the first free one. */ | ||
138 | bus_id = qemu_opt_get_number(legacy_opts, "bus", 0); | ||
139 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
140 | dinfo = g_malloc0(sizeof(*dinfo)); | ||
141 | dinfo->opts = all_opts; | ||
142 | |||
143 | - dinfo->cyls = cyls; | ||
144 | - dinfo->heads = heads; | ||
145 | - dinfo->secs = secs; | ||
146 | - dinfo->trans = translation; | ||
147 | - | ||
148 | dinfo->type = type; | ||
149 | dinfo->bus = bus_id; | ||
150 | dinfo->unit = unit_id; | ||
151 | diff --git a/hw/block/block.c b/hw/block/block.c | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/hw/block/block.c | ||
154 | +++ b/hw/block/block.c | ||
155 | @@ -XXX,XX +XXX,XX @@ bool blkconf_geometry(BlockConf *conf, int *ptrans, | ||
156 | unsigned cyls_max, unsigned heads_max, unsigned secs_max, | ||
157 | Error **errp) | ||
158 | { | ||
159 | - DriveInfo *dinfo; | ||
160 | - | ||
161 | - if (!conf->cyls && !conf->heads && !conf->secs) { | ||
162 | - /* try to fall back to value set with legacy -drive cyls=... */ | ||
163 | - dinfo = blk_legacy_dinfo(conf->blk); | ||
164 | - if (dinfo) { | ||
165 | - conf->cyls = dinfo->cyls; | ||
166 | - conf->heads = dinfo->heads; | ||
167 | - conf->secs = dinfo->secs; | ||
168 | - if (ptrans) { | ||
169 | - *ptrans = dinfo->trans; | ||
170 | - } | ||
171 | - } | ||
172 | - } | ||
173 | if (!conf->cyls && !conf->heads && !conf->secs) { | ||
174 | hd_geometry_guess(conf->blk, | ||
175 | &conf->cyls, &conf->heads, &conf->secs, | ||
176 | diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c | ||
177 | index XXXXXXX..XXXXXXX 100644 | ||
178 | --- a/tests/hd-geo-test.c | ||
179 | +++ b/tests/hd-geo-test.c | ||
180 | @@ -XXX,XX +XXX,XX @@ static void setup_mbr(int img_idx, MBRcontents mbr) | ||
181 | |||
182 | static int setup_ide(int argc, char *argv[], int argv_sz, | ||
183 | int ide_idx, const char *dev, int img_idx, | ||
184 | - MBRcontents mbr, const char *opts) | ||
185 | + MBRcontents mbr) | ||
186 | { | ||
187 | char *s1, *s2, *s3; | ||
188 | |||
189 | @@ -XXX,XX +XXX,XX @@ static int setup_ide(int argc, char *argv[], int argv_sz, | ||
190 | s3 = g_strdup(",media=cdrom"); | ||
191 | } | ||
192 | argc = append_arg(argc, argv, argv_sz, | ||
193 | - g_strdup_printf("%s%s%s%s", s1, s2, s3, opts)); | ||
194 | + g_strdup_printf("%s%s%s", s1, s2, s3)); | ||
195 | g_free(s1); | ||
196 | g_free(s2); | ||
197 | g_free(s3); | ||
198 | @@ -XXX,XX +XXX,XX @@ static void test_ide_mbr(bool use_device, MBRcontents mbr) | ||
199 | for (i = 0; i < backend_last; i++) { | ||
200 | cur_ide[i] = &hd_chst[i][mbr]; | ||
201 | dev = use_device ? (is_hd(cur_ide[i]) ? "ide-hd" : "ide-cd") : NULL; | ||
202 | - argc = setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr, ""); | ||
203 | + argc = setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr); | ||
204 | } | ||
205 | args = g_strjoinv(" ", argv); | ||
206 | qtest_start(args); | ||
207 | @@ -XXX,XX +XXX,XX @@ static void test_ide_drive_user(const char *dev, bool trans) | ||
208 | const CHST expected_chst = { secs / (4 * 32) , 4, 32, trans }; | ||
209 | |||
210 | argc = setup_common(argv, ARGV_SIZE); | ||
211 | - opts = g_strdup_printf("%s,%s%scyls=%d,heads=%d,secs=%d", | ||
212 | - dev ?: "", | ||
213 | - trans && dev ? "bios-chs-" : "", | ||
214 | - trans ? "trans=lba," : "", | ||
215 | + opts = g_strdup_printf("%s,%scyls=%d,heads=%d,secs=%d", | ||
216 | + dev, trans ? "bios-chs-trans=lba," : "", | ||
217 | expected_chst.cyls, expected_chst.heads, | ||
218 | expected_chst.secs); | ||
219 | cur_ide[0] = &expected_chst; | ||
220 | - argc = setup_ide(argc, argv, ARGV_SIZE, | ||
221 | - 0, dev ? opts : NULL, backend_small, mbr_chs, | ||
222 | - dev ? "" : opts); | ||
223 | + argc = setup_ide(argc, argv, ARGV_SIZE, 0, opts, backend_small, mbr_chs); | ||
224 | g_free(opts); | ||
225 | args = g_strjoinv(" ", argv); | ||
226 | qtest_start(args); | ||
227 | @@ -XXX,XX +XXX,XX @@ static void test_ide_drive_user(const char *dev, bool trans) | ||
228 | } | ||
229 | |||
230 | /* | ||
231 | - * Test case: IDE device (if=ide) with explicit CHS | ||
232 | - */ | ||
233 | -static void test_ide_drive_user_chs(void) | ||
234 | -{ | ||
235 | - test_ide_drive_user(NULL, false); | ||
236 | -} | ||
237 | - | ||
238 | -/* | ||
239 | - * Test case: IDE device (if=ide) with explicit CHS and translation | ||
240 | - */ | ||
241 | -static void test_ide_drive_user_chst(void) | ||
242 | -{ | ||
243 | - test_ide_drive_user(NULL, true); | ||
244 | -} | ||
245 | - | ||
246 | -/* | ||
247 | * Test case: IDE device (if=none) with explicit CHS | ||
248 | */ | ||
249 | static void test_ide_device_user_chs(void) | ||
250 | @@ -XXX,XX +XXX,XX @@ static void test_ide_drive_cd_0(void) | ||
251 | for (i = 0; i <= backend_empty; i++) { | ||
252 | ide_idx = backend_empty - i; | ||
253 | cur_ide[ide_idx] = &hd_chst[i][mbr_blank]; | ||
254 | - argc = setup_ide(argc, argv, ARGV_SIZE, | ||
255 | - ide_idx, NULL, i, mbr_blank, ""); | ||
256 | + argc = setup_ide(argc, argv, ARGV_SIZE, ide_idx, NULL, i, mbr_blank); | ||
257 | } | ||
258 | args = g_strjoinv(" ", argv); | ||
259 | qtest_start(args); | ||
260 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
261 | qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank); | ||
262 | qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba); | ||
263 | qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs); | ||
264 | - qtest_add_func("hd-geo/ide/drive/user/chs", test_ide_drive_user_chs); | ||
265 | - qtest_add_func("hd-geo/ide/drive/user/chst", test_ide_drive_user_chst); | ||
266 | qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0); | ||
267 | qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blank); | ||
268 | qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba); | ||
269 | diff --git a/hmp-commands.hx b/hmp-commands.hx | ||
270 | index XXXXXXX..XXXXXXX 100644 | ||
271 | --- a/hmp-commands.hx | ||
272 | +++ b/hmp-commands.hx | ||
273 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
274 | .params = "[-n] [[<domain>:]<bus>:]<slot>\n" | ||
275 | "[file=file][,if=type][,bus=n]\n" | ||
276 | "[,unit=m][,media=d][,index=i]\n" | ||
277 | - "[,cyls=c,heads=h,secs=s[,trans=t]]\n" | ||
278 | "[,snapshot=on|off][,cache=on|off]\n" | ||
279 | "[,readonly=on|off][,copy-on-read=on|off]", | ||
280 | .help = "add drive to PCI storage controller", | ||
281 | diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi | ||
282 | index XXXXXXX..XXXXXXX 100644 | ||
283 | --- a/qemu-deprecated.texi | ||
284 | +++ b/qemu-deprecated.texi | ||
285 | @@ -XXX,XX +XXX,XX @@ with ``-device ...,netdev=x''), or ``-nic user,smb=/some/dir'' | ||
286 | (for embedded NICs). The new syntax allows different settings to be | ||
287 | provided per NIC. | ||
288 | |||
289 | -@subsection -drive cyls=...,heads=...,secs=...,trans=... (since 2.10.0) | ||
290 | - | ||
291 | -The drive geometry arguments are replaced by the the geometry arguments | ||
292 | -that can be specified with the ``-device'' parameter. | ||
293 | - | ||
294 | @subsection -drive serial=... (since 2.10.0) | ||
295 | |||
296 | The drive serial argument is replaced by the the serial argument | ||
297 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
298 | index XXXXXXX..XXXXXXX 100644 | ||
299 | --- a/qemu-options.hx | ||
300 | +++ b/qemu-options.hx | ||
301 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
302 | |||
303 | DEF("drive", HAS_ARG, QEMU_OPTION_drive, | ||
304 | "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" | ||
305 | - " [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]\n" | ||
306 | " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" | ||
307 | - " [,serial=s][,addr=A][,rerror=ignore|stop|report]\n" | ||
308 | + " [,snapshot=on|off][,serial=s][,addr=A][,rerror=ignore|stop|report]\n" | ||
309 | " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" | ||
310 | " [,readonly=on|off][,copy-on-read=on|off]\n" | ||
311 | " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" | ||
312 | @@ -XXX,XX +XXX,XX @@ This option defines where is connected the drive by using an index in the list | ||
313 | of available connectors of a given interface type. | ||
314 | @item media=@var{media} | ||
315 | This option defines the type of the media: disk or cdrom. | ||
316 | -@item cyls=@var{c},heads=@var{h},secs=@var{s}[,trans=@var{t}] | ||
317 | -Force disk physical geometry and the optional BIOS translation (trans=none or | ||
318 | -lba). These parameters are deprecated, use the corresponding parameters | ||
319 | -of @code{-device} instead. | ||
320 | @item snapshot=@var{snapshot} | ||
321 | @var{snapshot} is "on" or "off" and controls snapshot mode for the given drive | ||
322 | (see @option{-snapshot}). | ||
323 | -- | ||
324 | 2.13.6 | ||
325 | |||
326 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | This reinstates commit eae3bd1eb7c6b105d30ec06008b3bc3dfc5f45bb, | ||
2 | which was temporarily reverted for the 3.0 release so that libvirt gets | ||
3 | some extra time to update their command lines. | ||
4 | 1 | ||
5 | The -drive option addr was deprecated in QEMU 2.10. It's time to remove | ||
6 | it. | ||
7 | |||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
10 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
11 | --- | ||
12 | include/sysemu/blockdev.h | 1 - | ||
13 | blockdev.c | 17 +---------------- | ||
14 | device-hotplug.c | 4 ---- | ||
15 | qemu-deprecated.texi | 5 ----- | ||
16 | qemu-options.hx | 5 +---- | ||
17 | 5 files changed, 2 insertions(+), 30 deletions(-) | ||
18 | |||
19 | diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/sysemu/blockdev.h | ||
22 | +++ b/include/sysemu/blockdev.h | ||
23 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
24 | } BlockInterfaceType; | ||
25 | |||
26 | struct DriveInfo { | ||
27 | - const char *devaddr; | ||
28 | BlockInterfaceType type; | ||
29 | int bus; | ||
30 | int unit; | ||
31 | diff --git a/blockdev.c b/blockdev.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/blockdev.c | ||
34 | +++ b/blockdev.c | ||
35 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_legacy_drive_opts = { | ||
36 | .type = QEMU_OPT_STRING, | ||
37 | .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", | ||
38 | },{ | ||
39 | - .name = "addr", | ||
40 | - .type = QEMU_OPT_STRING, | ||
41 | - .help = "pci address (virtio only)", | ||
42 | - },{ | ||
43 | .name = "serial", | ||
44 | .type = QEMU_OPT_STRING, | ||
45 | .help = "disk serial number", | ||
46 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
47 | DriveMediaType media = MEDIA_DISK; | ||
48 | BlockInterfaceType type; | ||
49 | int max_devs, bus_id, unit_id, index; | ||
50 | - const char *devaddr; | ||
51 | const char *werror, *rerror; | ||
52 | bool read_only = false; | ||
53 | bool copy_on_read; | ||
54 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
55 | Error *local_err = NULL; | ||
56 | int i; | ||
57 | const char *deprecated[] = { | ||
58 | - "serial", "addr" | ||
59 | + "serial" | ||
60 | }; | ||
61 | |||
62 | /* Change legacy command line options into QMP ones */ | ||
63 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
64 | } | ||
65 | |||
66 | /* Add virtio block device */ | ||
67 | - devaddr = qemu_opt_get(legacy_opts, "addr"); | ||
68 | - if (devaddr && type != IF_VIRTIO) { | ||
69 | - error_report("addr is not supported by this bus type"); | ||
70 | - goto fail; | ||
71 | - } | ||
72 | - | ||
73 | if (type == IF_VIRTIO) { | ||
74 | QemuOpts *devopts; | ||
75 | devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, | ||
76 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
77 | } | ||
78 | qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"), | ||
79 | &error_abort); | ||
80 | - if (devaddr) { | ||
81 | - qemu_opt_set(devopts, "addr", devaddr, &error_abort); | ||
82 | - } | ||
83 | } | ||
84 | |||
85 | filename = qemu_opt_get(legacy_opts, "file"); | ||
86 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
87 | dinfo->type = type; | ||
88 | dinfo->bus = bus_id; | ||
89 | dinfo->unit = unit_id; | ||
90 | - dinfo->devaddr = devaddr; | ||
91 | dinfo->serial = g_strdup(serial); | ||
92 | |||
93 | blk_set_legacy_dinfo(blk, dinfo); | ||
94 | diff --git a/device-hotplug.c b/device-hotplug.c | ||
95 | index XXXXXXX..XXXXXXX 100644 | ||
96 | --- a/device-hotplug.c | ||
97 | +++ b/device-hotplug.c | ||
98 | @@ -XXX,XX +XXX,XX @@ void hmp_drive_add(Monitor *mon, const QDict *qdict) | ||
99 | if (!dinfo) { | ||
100 | goto err; | ||
101 | } | ||
102 | - if (dinfo->devaddr) { | ||
103 | - monitor_printf(mon, "Parameter addr not supported\n"); | ||
104 | - goto err; | ||
105 | - } | ||
106 | |||
107 | switch (dinfo->type) { | ||
108 | case IF_NONE: | ||
109 | diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/qemu-deprecated.texi | ||
112 | +++ b/qemu-deprecated.texi | ||
113 | @@ -XXX,XX +XXX,XX @@ provided per NIC. | ||
114 | The drive serial argument is replaced by the the serial argument | ||
115 | that can be specified with the ``-device'' parameter. | ||
116 | |||
117 | -@subsection -drive addr=... (since 2.10.0) | ||
118 | - | ||
119 | -The drive addr argument is replaced by the the addr argument | ||
120 | -that can be specified with the ``-device'' parameter. | ||
121 | - | ||
122 | @subsection -usbdevice (since 2.10.0) | ||
123 | |||
124 | The ``-usbdevice DEV'' argument is now a synonym for setting | ||
125 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/qemu-options.hx | ||
128 | +++ b/qemu-options.hx | ||
129 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
130 | DEF("drive", HAS_ARG, QEMU_OPTION_drive, | ||
131 | "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" | ||
132 | " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" | ||
133 | - " [,snapshot=on|off][,serial=s][,addr=A][,rerror=ignore|stop|report]\n" | ||
134 | + " [,snapshot=on|off][,serial=s][,rerror=ignore|stop|report]\n" | ||
135 | " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" | ||
136 | " [,readonly=on|off][,copy-on-read=on|off]\n" | ||
137 | " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" | ||
138 | @@ -XXX,XX +XXX,XX @@ an untrusted format header. | ||
139 | This option specifies the serial number to assign to the device. This | ||
140 | parameter is deprecated, use the corresponding parameter of @code{-device} | ||
141 | instead. | ||
142 | -@item addr=@var{addr} | ||
143 | -Specify the controller's PCI address (if=virtio only). This parameter is | ||
144 | -deprecated, use the corresponding parameter of @code{-device} instead. | ||
145 | @item werror=@var{action},rerror=@var{action} | ||
146 | Specify which @var{action} to take on write and read errors. Valid actions are: | ||
147 | "ignore" (ignore the error and try to continue), "stop" (pause QEMU), | ||
148 | -- | ||
149 | 2.13.6 | ||
150 | |||
151 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | This reinstates commit b0083267444a5e0f28391f6c2831a539f878d424, | ||
2 | which was temporarily reverted for the 3.0 release so that libvirt gets | ||
3 | some extra time to update their command lines. | ||
4 | 1 | ||
5 | The -drive option serial was deprecated in QEMU 2.10. It's time to | ||
6 | remove it. | ||
7 | |||
8 | Tests need to be updated to set the serial number with -global instead | ||
9 | of using the -drive option. | ||
10 | |||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
13 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
14 | --- | ||
15 | include/hw/block/block.h | 1 - | ||
16 | include/sysemu/blockdev.h | 1 - | ||
17 | block/block-backend.c | 1 - | ||
18 | blockdev.c | 10 ---------- | ||
19 | hw/block/block.c | 13 ------------- | ||
20 | hw/block/nvme.c | 1 - | ||
21 | hw/block/virtio-blk.c | 1 - | ||
22 | hw/ide/qdev.c | 1 - | ||
23 | hw/scsi/scsi-disk.c | 1 - | ||
24 | hw/usb/dev-storage.c | 1 - | ||
25 | tests/ahci-test.c | 6 +++--- | ||
26 | tests/ide-test.c | 8 ++++---- | ||
27 | qemu-deprecated.texi | 5 ----- | ||
28 | qemu-options.hx | 6 +----- | ||
29 | 14 files changed, 8 insertions(+), 48 deletions(-) | ||
30 | |||
31 | diff --git a/include/hw/block/block.h b/include/hw/block/block.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/include/hw/block/block.h | ||
34 | +++ b/include/hw/block/block.h | ||
35 | @@ -XXX,XX +XXX,XX @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) | ||
36 | |||
37 | /* Configuration helpers */ | ||
38 | |||
39 | -void blkconf_serial(BlockConf *conf, char **serial); | ||
40 | bool blkconf_geometry(BlockConf *conf, int *trans, | ||
41 | unsigned cyls_max, unsigned heads_max, unsigned secs_max, | ||
42 | Error **errp); | ||
43 | diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/include/sysemu/blockdev.h | ||
46 | +++ b/include/sysemu/blockdev.h | ||
47 | @@ -XXX,XX +XXX,XX @@ struct DriveInfo { | ||
48 | bool is_default; /* Added by default_drive() ? */ | ||
49 | int media_cd; | ||
50 | QemuOpts *opts; | ||
51 | - char *serial; | ||
52 | QTAILQ_ENTRY(DriveInfo) next; | ||
53 | }; | ||
54 | |||
55 | diff --git a/block/block-backend.c b/block/block-backend.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/block/block-backend.c | ||
58 | +++ b/block/block-backend.c | ||
59 | @@ -XXX,XX +XXX,XX @@ static void drive_info_del(DriveInfo *dinfo) | ||
60 | return; | ||
61 | } | ||
62 | qemu_opts_del(dinfo->opts); | ||
63 | - g_free(dinfo->serial); | ||
64 | g_free(dinfo); | ||
65 | } | ||
66 | |||
67 | diff --git a/blockdev.c b/blockdev.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/blockdev.c | ||
70 | +++ b/blockdev.c | ||
71 | @@ -XXX,XX +XXX,XX @@ QemuOptsList qemu_legacy_drive_opts = { | ||
72 | .type = QEMU_OPT_STRING, | ||
73 | .help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)", | ||
74 | },{ | ||
75 | - .name = "serial", | ||
76 | - .type = QEMU_OPT_STRING, | ||
77 | - .help = "disk serial number", | ||
78 | - },{ | ||
79 | .name = "file", | ||
80 | .type = QEMU_OPT_STRING, | ||
81 | .help = "file name", | ||
82 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
83 | const char *werror, *rerror; | ||
84 | bool read_only = false; | ||
85 | bool copy_on_read; | ||
86 | - const char *serial; | ||
87 | const char *filename; | ||
88 | Error *local_err = NULL; | ||
89 | int i; | ||
90 | const char *deprecated[] = { | ||
91 | - "serial" | ||
92 | }; | ||
93 | |||
94 | /* Change legacy command line options into QMP ones */ | ||
95 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
96 | goto fail; | ||
97 | } | ||
98 | |||
99 | - /* Serial number */ | ||
100 | - serial = qemu_opt_get(legacy_opts, "serial"); | ||
101 | - | ||
102 | /* no id supplied -> create one */ | ||
103 | if (qemu_opts_id(all_opts) == NULL) { | ||
104 | char *new_id; | ||
105 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
106 | dinfo->type = type; | ||
107 | dinfo->bus = bus_id; | ||
108 | dinfo->unit = unit_id; | ||
109 | - dinfo->serial = g_strdup(serial); | ||
110 | |||
111 | blk_set_legacy_dinfo(blk, dinfo); | ||
112 | |||
113 | diff --git a/hw/block/block.c b/hw/block/block.c | ||
114 | index XXXXXXX..XXXXXXX 100644 | ||
115 | --- a/hw/block/block.c | ||
116 | +++ b/hw/block/block.c | ||
117 | @@ -XXX,XX +XXX,XX @@ | ||
118 | #include "qapi/qapi-types-block.h" | ||
119 | #include "qemu/error-report.h" | ||
120 | |||
121 | -void blkconf_serial(BlockConf *conf, char **serial) | ||
122 | -{ | ||
123 | - DriveInfo *dinfo; | ||
124 | - | ||
125 | - if (!*serial) { | ||
126 | - /* try to fall back to value set with legacy -drive serial=... */ | ||
127 | - dinfo = blk_legacy_dinfo(conf->blk); | ||
128 | - if (dinfo) { | ||
129 | - *serial = g_strdup(dinfo->serial); | ||
130 | - } | ||
131 | - } | ||
132 | -} | ||
133 | - | ||
134 | void blkconf_blocksizes(BlockConf *conf) | ||
135 | { | ||
136 | BlockBackend *blk = conf->blk; | ||
137 | diff --git a/hw/block/nvme.c b/hw/block/nvme.c | ||
138 | index XXXXXXX..XXXXXXX 100644 | ||
139 | --- a/hw/block/nvme.c | ||
140 | +++ b/hw/block/nvme.c | ||
141 | @@ -XXX,XX +XXX,XX @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) | ||
142 | return; | ||
143 | } | ||
144 | |||
145 | - blkconf_serial(&n->conf, &n->serial); | ||
146 | if (!n->serial) { | ||
147 | error_setg(errp, "serial property not set"); | ||
148 | return; | ||
149 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | ||
150 | index XXXXXXX..XXXXXXX 100644 | ||
151 | --- a/hw/block/virtio-blk.c | ||
152 | +++ b/hw/block/virtio-blk.c | ||
153 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | - blkconf_serial(&conf->conf, &conf->serial); | ||
158 | if (!blkconf_apply_backend_options(&conf->conf, | ||
159 | blk_is_read_only(conf->conf.blk), true, | ||
160 | errp)) { | ||
161 | diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c | ||
162 | index XXXXXXX..XXXXXXX 100644 | ||
163 | --- a/hw/ide/qdev.c | ||
164 | +++ b/hw/ide/qdev.c | ||
165 | @@ -XXX,XX +XXX,XX @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) | ||
166 | return; | ||
167 | } | ||
168 | |||
169 | - blkconf_serial(&dev->conf, &dev->serial); | ||
170 | if (kind != IDE_CD) { | ||
171 | if (!blkconf_geometry(&dev->conf, &dev->chs_trans, 65535, 16, 255, | ||
172 | errp)) { | ||
173 | diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c | ||
174 | index XXXXXXX..XXXXXXX 100644 | ||
175 | --- a/hw/scsi/scsi-disk.c | ||
176 | +++ b/hw/scsi/scsi-disk.c | ||
177 | @@ -XXX,XX +XXX,XX @@ static void scsi_realize(SCSIDevice *dev, Error **errp) | ||
178 | return; | ||
179 | } | ||
180 | |||
181 | - blkconf_serial(&s->qdev.conf, &s->serial); | ||
182 | blkconf_blocksizes(&s->qdev.conf); | ||
183 | |||
184 | if (s->qdev.conf.logical_block_size > | ||
185 | diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c | ||
186 | index XXXXXXX..XXXXXXX 100644 | ||
187 | --- a/hw/usb/dev-storage.c | ||
188 | +++ b/hw/usb/dev-storage.c | ||
189 | @@ -XXX,XX +XXX,XX @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp) | ||
190 | return; | ||
191 | } | ||
192 | |||
193 | - blkconf_serial(&s->conf, &dev->serial); | ||
194 | blkconf_blocksizes(&s->conf); | ||
195 | if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), true, | ||
196 | errp)) { | ||
197 | diff --git a/tests/ahci-test.c b/tests/ahci-test.c | ||
198 | index XXXXXXX..XXXXXXX 100644 | ||
199 | --- a/tests/ahci-test.c | ||
200 | +++ b/tests/ahci-test.c | ||
201 | @@ -XXX,XX +XXX,XX @@ static AHCIQState *ahci_boot(const char *cli, ...) | ||
202 | s = ahci_vboot(cli, ap); | ||
203 | va_end(ap); | ||
204 | } else { | ||
205 | - cli = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s" | ||
206 | - ",format=%s" | ||
207 | + cli = "-drive if=none,id=drive0,file=%s,cache=writeback,format=%s" | ||
208 | " -M q35 " | ||
209 | "-device ide-hd,drive=drive0 " | ||
210 | + "-global ide-hd.serial=%s " | ||
211 | "-global ide-hd.ver=%s"; | ||
212 | - s = ahci_boot(cli, tmp_path, "testdisk", imgfmt, "version"); | ||
213 | + s = ahci_boot(cli, tmp_path, imgfmt, "testdisk", "version"); | ||
214 | } | ||
215 | |||
216 | return s; | ||
217 | diff --git a/tests/ide-test.c b/tests/ide-test.c | ||
218 | index XXXXXXX..XXXXXXX 100644 | ||
219 | --- a/tests/ide-test.c | ||
220 | +++ b/tests/ide-test.c | ||
221 | @@ -XXX,XX +XXX,XX @@ static void test_bmdma_no_busmaster(void) | ||
222 | static void test_bmdma_setup(void) | ||
223 | { | ||
224 | ide_test_start( | ||
225 | - "-drive file=%s,if=ide,serial=%s,cache=writeback,format=raw " | ||
226 | - "-global ide-hd.ver=%s", | ||
227 | + "-drive file=%s,if=ide,cache=writeback,format=raw " | ||
228 | + "-global ide-hd.serial=%s -global ide-hd.ver=%s", | ||
229 | tmp_path, "testdisk", "version"); | ||
230 | qtest_irq_intercept_in(global_qtest, "ioapic"); | ||
231 | } | ||
232 | @@ -XXX,XX +XXX,XX @@ static void test_identify(void) | ||
233 | int ret; | ||
234 | |||
235 | ide_test_start( | ||
236 | - "-drive file=%s,if=ide,serial=%s,cache=writeback,format=raw " | ||
237 | - "-global ide-hd.ver=%s", | ||
238 | + "-drive file=%s,if=ide,cache=writeback,format=raw " | ||
239 | + "-global ide-hd.serial=%s -global ide-hd.ver=%s", | ||
240 | tmp_path, "testdisk", "version"); | ||
241 | |||
242 | dev = get_pci_device(&bmdma_bar, &ide_bar); | ||
243 | diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi | ||
244 | index XXXXXXX..XXXXXXX 100644 | ||
245 | --- a/qemu-deprecated.texi | ||
246 | +++ b/qemu-deprecated.texi | ||
247 | @@ -XXX,XX +XXX,XX @@ with ``-device ...,netdev=x''), or ``-nic user,smb=/some/dir'' | ||
248 | (for embedded NICs). The new syntax allows different settings to be | ||
249 | provided per NIC. | ||
250 | |||
251 | -@subsection -drive serial=... (since 2.10.0) | ||
252 | - | ||
253 | -The drive serial argument is replaced by the the serial argument | ||
254 | -that can be specified with the ``-device'' parameter. | ||
255 | - | ||
256 | @subsection -usbdevice (since 2.10.0) | ||
257 | |||
258 | The ``-usbdevice DEV'' argument is now a synonym for setting | ||
259 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
260 | index XXXXXXX..XXXXXXX 100644 | ||
261 | --- a/qemu-options.hx | ||
262 | +++ b/qemu-options.hx | ||
263 | @@ -XXX,XX +XXX,XX @@ ETEXI | ||
264 | DEF("drive", HAS_ARG, QEMU_OPTION_drive, | ||
265 | "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" | ||
266 | " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" | ||
267 | - " [,snapshot=on|off][,serial=s][,rerror=ignore|stop|report]\n" | ||
268 | + " [,snapshot=on|off][,rerror=ignore|stop|report]\n" | ||
269 | " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" | ||
270 | " [,readonly=on|off][,copy-on-read=on|off]\n" | ||
271 | " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" | ||
272 | @@ -XXX,XX +XXX,XX @@ The default mode is @option{cache=writeback}. | ||
273 | Specify which disk @var{format} will be used rather than detecting | ||
274 | the format. Can be used to specify format=raw to avoid interpreting | ||
275 | an untrusted format header. | ||
276 | -@item serial=@var{serial} | ||
277 | -This option specifies the serial number to assign to the device. This | ||
278 | -parameter is deprecated, use the corresponding parameter of @code{-device} | ||
279 | -instead. | ||
280 | @item werror=@var{action},rerror=@var{action} | ||
281 | Specify which @var{action} to take on write and read errors. Valid actions are: | ||
282 | "ignore" (ignore the error and try to continue), "stop" (pause QEMU), | ||
283 | -- | ||
284 | 2.13.6 | ||
285 | |||
286 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | This reinstates commit 6266e900b8083945cb766b45c124fb3c42932cb3, | ||
2 | which was temporarily reverted for the 3.0 release so that libvirt gets | ||
3 | some extra time to update their command lines. | ||
4 | 1 | ||
5 | We removed all options from the 'deprecated' array, so the code is dead | ||
6 | and can be removed as well. | ||
7 | |||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
10 | --- | ||
11 | blockdev.c | 12 ------------ | ||
12 | 1 file changed, 12 deletions(-) | ||
13 | |||
14 | diff --git a/blockdev.c b/blockdev.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/blockdev.c | ||
17 | +++ b/blockdev.c | ||
18 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
19 | const char *filename; | ||
20 | Error *local_err = NULL; | ||
21 | int i; | ||
22 | - const char *deprecated[] = { | ||
23 | - }; | ||
24 | |||
25 | /* Change legacy command line options into QMP ones */ | ||
26 | static const struct { | ||
27 | @@ -XXX,XX +XXX,XX @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) | ||
28 | goto fail; | ||
29 | } | ||
30 | |||
31 | - /* Other deprecated options */ | ||
32 | - if (!qtest_enabled()) { | ||
33 | - for (i = 0; i < ARRAY_SIZE(deprecated); i++) { | ||
34 | - if (qemu_opt_get(legacy_opts, deprecated[i]) != NULL) { | ||
35 | - error_report("'%s' is deprecated, please use the corresponding " | ||
36 | - "option of '-device' instead", deprecated[i]); | ||
37 | - } | ||
38 | - } | ||
39 | - } | ||
40 | - | ||
41 | /* Media type */ | ||
42 | value = qemu_opt_get(legacy_opts, "media"); | ||
43 | if (value) { | ||
44 | -- | ||
45 | 2.13.6 | ||
46 | |||
47 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | blockdev-add fails if an invalid node name is given, so we should | ||
2 | document what a valid node name even is. | ||
3 | 1 | ||
4 | Reported-by: Cong Li <coli@redhat.com> | ||
5 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
7 | Reviewed-by: Cong Li <coli@redhat.com> | ||
8 | Reviewed-by: Alberto Garcia <berto@igalia.com> | ||
9 | --- | ||
10 | qapi/block-core.json | 3 +++ | ||
11 | 1 file changed, 3 insertions(+) | ||
12 | |||
13 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/qapi/block-core.json | ||
16 | +++ b/qapi/block-core.json | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | # @driver: block driver name | ||
19 | # @node-name: the node name of the new node (Since 2.0). | ||
20 | # This option is required on the top level of blockdev-add. | ||
21 | +# Valid node names start with an alphabetic character and may | ||
22 | +# contain only alphanumeric characters, '-', '.' and '_'. Their | ||
23 | +# maximum length is 31 characters. | ||
24 | # @discard: discard-related options (default: ignore) | ||
25 | # @cache: cache-related options | ||
26 | # @read-only: whether the block device should be read-only (default: false). | ||
27 | -- | ||
28 | 2.13.6 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | blockdev-mirror with the same node for source and target segfaults | ||
2 | today: A node is in its own backing chain, so mirror_start_job() decides | ||
3 | that this is an active commit. When adding the intermediate nodes with | ||
4 | block_job_add_bdrv(), it starts the iteration through the subchain with | ||
5 | the backing file of source, though, so it never reaches target and | ||
6 | instead runs into NULL at the base. | ||
7 | 1 | ||
8 | While we could fix that by starting with source itself, there is no | ||
9 | point in allowing mirroring a node into itself and I wouldn't be | ||
10 | surprised if this caused more problems later. | ||
11 | |||
12 | So just check for this scenario and error out. | ||
13 | |||
14 | Cc: qemu-stable@nongnu.org | ||
15 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
16 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
17 | --- | ||
18 | block/mirror.c | 5 +++++ | ||
19 | tests/qemu-iotests/041 | 6 ++++++ | ||
20 | tests/qemu-iotests/041.out | 4 ++-- | ||
21 | 3 files changed, 13 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/block/mirror.c b/block/mirror.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/block/mirror.c | ||
26 | +++ b/block/mirror.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, | ||
28 | buf_size = DEFAULT_MIRROR_BUF_SIZE; | ||
29 | } | ||
30 | |||
31 | + if (bs == target) { | ||
32 | + error_setg(errp, "Can't mirror node into itself"); | ||
33 | + return; | ||
34 | + } | ||
35 | + | ||
36 | /* In the case of active commit, add dummy driver to provide consistent | ||
37 | * reads on the top, while disabling it in the intermediate nodes, and make | ||
38 | * the backing chain writable. */ | ||
39 | diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 | ||
40 | index XXXXXXX..XXXXXXX 100755 | ||
41 | --- a/tests/qemu-iotests/041 | ||
42 | +++ b/tests/qemu-iotests/041 | ||
43 | @@ -XXX,XX +XXX,XX @@ class TestSingleBlockdev(TestSingleDrive): | ||
44 | result = self.vm.qmp("blockdev-add", **args) | ||
45 | self.assert_qmp(result, 'return', {}) | ||
46 | |||
47 | + def test_mirror_to_self(self): | ||
48 | + result = self.vm.qmp(self.qmp_cmd, job_id='job0', | ||
49 | + device=self.qmp_target, sync='full', | ||
50 | + target=self.qmp_target) | ||
51 | + self.assert_qmp(result, 'error/class', 'GenericError') | ||
52 | + | ||
53 | test_large_cluster = None | ||
54 | test_image_not_found = None | ||
55 | test_small_buffer2 = None | ||
56 | diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/tests/qemu-iotests/041.out | ||
59 | +++ b/tests/qemu-iotests/041.out | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | -..................................................................................... | ||
62 | +........................................................................................ | ||
63 | ---------------------------------------------------------------------- | ||
64 | -Ran 85 tests | ||
65 | +Ran 88 tests | ||
66 | |||
67 | OK | ||
68 | -- | ||
69 | 2.13.6 | ||
70 | |||
71 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Daniel P. Berrangé <berrange@redhat.com> | ||
2 | 1 | ||
3 | When the convert command is creating an output file that needs | ||
4 | secrets, we need to ensure those secrets are passed to both the | ||
5 | blk_new_open and bdrv_create API calls. | ||
6 | |||
7 | This is done by qemu-img extracting all opts matching the name | ||
8 | suffix "key-secret". Unfortunately the code doing this was run after the | ||
9 | call to bdrv_create(), which meant the QemuOpts it was extracting | ||
10 | secrets from was now empty. | ||
11 | |||
12 | Previously this worked by luks as a bug meant the "key-secret" | ||
13 | parameters were not purged from the QemuOpts. This bug was fixed in | ||
14 | |||
15 | commit b76b4f604521e59f857d6177bc55f6f2e41fd392 | ||
16 | Author: Kevin Wolf <kwolf@redhat.com> | ||
17 | Date: Thu Jan 11 16:18:08 2018 +0100 | ||
18 | |||
19 | qcow2: Use visitor for options in qcow2_create() | ||
20 | |||
21 | Exposing the latent bug in qemu-img. This fix simply moves the copying | ||
22 | of secrets to before the bdrv_create() call. | ||
23 | |||
24 | Cc: qemu-stable@nongnu.org | ||
25 | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> | ||
26 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
27 | --- | ||
28 | qemu-img.c | 32 +++++++++++++++----------------- | ||
29 | 1 file changed, 15 insertions(+), 17 deletions(-) | ||
30 | |||
31 | diff --git a/qemu-img.c b/qemu-img.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/qemu-img.c | ||
34 | +++ b/qemu-img.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static int img_add_key_secrets(void *opaque, | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | -static BlockBackend *img_open_new_file(const char *filename, | ||
40 | - QemuOpts *create_opts, | ||
41 | - const char *fmt, int flags, | ||
42 | - bool writethrough, bool quiet, | ||
43 | - bool force_share) | ||
44 | -{ | ||
45 | - QDict *options = NULL; | ||
46 | - | ||
47 | - options = qdict_new(); | ||
48 | - qemu_opt_foreach(create_opts, img_add_key_secrets, options, &error_abort); | ||
49 | - | ||
50 | - return img_open_file(filename, options, fmt, flags, writethrough, quiet, | ||
51 | - force_share); | ||
52 | -} | ||
53 | - | ||
54 | |||
55 | static BlockBackend *img_open(bool image_opts, | ||
56 | const char *filename, | ||
57 | @@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv) | ||
58 | BlockDriverState *out_bs; | ||
59 | QemuOpts *opts = NULL, *sn_opts = NULL; | ||
60 | QemuOptsList *create_opts = NULL; | ||
61 | + QDict *open_opts = NULL; | ||
62 | char *options = NULL; | ||
63 | Error *local_err = NULL; | ||
64 | bool writethrough, src_writethrough, quiet = false, image_opts = false, | ||
65 | @@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv) | ||
66 | } | ||
67 | } | ||
68 | |||
69 | + /* | ||
70 | + * The later open call will need any decryption secrets, and | ||
71 | + * bdrv_create() will purge "opts", so extract them now before | ||
72 | + * they are lost. | ||
73 | + */ | ||
74 | + if (!skip_create) { | ||
75 | + open_opts = qdict_new(); | ||
76 | + qemu_opt_foreach(opts, img_add_key_secrets, open_opts, &error_abort); | ||
77 | + } | ||
78 | + | ||
79 | if (!skip_create) { | ||
80 | /* Create the new image */ | ||
81 | ret = bdrv_create(drv, out_filename, opts, &local_err); | ||
82 | @@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv) | ||
83 | * That has to wait for bdrv_create to be improved | ||
84 | * to allow filenames in option syntax | ||
85 | */ | ||
86 | - s.target = img_open_new_file(out_filename, opts, out_fmt, | ||
87 | - flags, writethrough, quiet, false); | ||
88 | + s.target = img_open_file(out_filename, open_opts, out_fmt, | ||
89 | + flags, writethrough, quiet, false); | ||
90 | + open_opts = NULL; /* blk_new_open will have freed it */ | ||
91 | } | ||
92 | if (!s.target) { | ||
93 | ret = -1; | ||
94 | @@ -XXX,XX +XXX,XX @@ out: | ||
95 | qemu_opts_del(opts); | ||
96 | qemu_opts_free(create_opts); | ||
97 | qemu_opts_del(sn_opts); | ||
98 | + qobject_unref(open_opts); | ||
99 | blk_unref(s.target); | ||
100 | if (s.src) { | ||
101 | for (bs_i = 0; bs_i < s.src_num; bs_i++) { | ||
102 | -- | ||
103 | 2.13.6 | ||
104 | |||
105 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
4 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
5 | --- | ||
6 | block.c | 4 +++- | ||
7 | block/snapshot.c | 4 +++- | ||
8 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
9 | |||
10 | diff --git a/block.c b/block.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/block.c | ||
13 | +++ b/block.c | ||
14 | @@ -XXX,XX +XXX,XX @@ static void bdrv_close(BlockDriverState *bs) | ||
15 | bdrv_drain(bs); /* in case flush left pending I/O */ | ||
16 | |||
17 | if (bs->drv) { | ||
18 | - bs->drv->bdrv_close(bs); | ||
19 | + if (bs->drv->bdrv_close) { | ||
20 | + bs->drv->bdrv_close(bs); | ||
21 | + } | ||
22 | bs->drv = NULL; | ||
23 | } | ||
24 | |||
25 | diff --git a/block/snapshot.c b/block/snapshot.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/block/snapshot.c | ||
28 | +++ b/block/snapshot.c | ||
29 | @@ -XXX,XX +XXX,XX @@ int bdrv_snapshot_goto(BlockDriverState *bs, | ||
30 | qobject_unref(file_options); | ||
31 | qdict_put_str(options, "file", bdrv_get_node_name(file)); | ||
32 | |||
33 | - drv->bdrv_close(bs); | ||
34 | + if (drv->bdrv_close) { | ||
35 | + drv->bdrv_close(bs); | ||
36 | + } | ||
37 | bdrv_unref_child(bs, bs->file); | ||
38 | bs->file = NULL; | ||
39 | |||
40 | -- | ||
41 | 2.13.6 | ||
42 | |||
43 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | .bdrv_close handler is optional after previous commit, no needs to keep | ||
4 | empty functions more. | ||
5 | |||
6 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | --- | ||
9 | block/blkreplay.c | 5 ----- | ||
10 | block/commit.c | 5 ----- | ||
11 | block/copy-on-read.c | 6 ------ | ||
12 | block/mirror.c | 5 ----- | ||
13 | block/null.c | 6 ------ | ||
14 | block/raw-format.c | 5 ----- | ||
15 | 6 files changed, 32 deletions(-) | ||
16 | |||
17 | diff --git a/block/blkreplay.c b/block/blkreplay.c | ||
18 | index XXXXXXX..XXXXXXX 100755 | ||
19 | --- a/block/blkreplay.c | ||
20 | +++ b/block/blkreplay.c | ||
21 | @@ -XXX,XX +XXX,XX @@ fail: | ||
22 | return ret; | ||
23 | } | ||
24 | |||
25 | -static void blkreplay_close(BlockDriverState *bs) | ||
26 | -{ | ||
27 | -} | ||
28 | - | ||
29 | static int64_t blkreplay_getlength(BlockDriverState *bs) | ||
30 | { | ||
31 | return bdrv_getlength(bs->file->bs); | ||
32 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_blkreplay = { | ||
33 | .instance_size = 0, | ||
34 | |||
35 | .bdrv_open = blkreplay_open, | ||
36 | - .bdrv_close = blkreplay_close, | ||
37 | .bdrv_child_perm = bdrv_filter_default_perms, | ||
38 | .bdrv_getlength = blkreplay_getlength, | ||
39 | |||
40 | diff --git a/block/commit.c b/block/commit.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/block/commit.c | ||
43 | +++ b/block/commit.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void bdrv_commit_top_refresh_filename(BlockDriverState *bs, QDict *opts) | ||
45 | bs->backing->bs->filename); | ||
46 | } | ||
47 | |||
48 | -static void bdrv_commit_top_close(BlockDriverState *bs) | ||
49 | -{ | ||
50 | -} | ||
51 | - | ||
52 | static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c, | ||
53 | const BdrvChildRole *role, | ||
54 | BlockReopenQueue *reopen_queue, | ||
55 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_commit_top = { | ||
56 | .bdrv_co_preadv = bdrv_commit_top_preadv, | ||
57 | .bdrv_co_block_status = bdrv_co_block_status_from_backing, | ||
58 | .bdrv_refresh_filename = bdrv_commit_top_refresh_filename, | ||
59 | - .bdrv_close = bdrv_commit_top_close, | ||
60 | .bdrv_child_perm = bdrv_commit_top_child_perm, | ||
61 | }; | ||
62 | |||
63 | diff --git a/block/copy-on-read.c b/block/copy-on-read.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/block/copy-on-read.c | ||
66 | +++ b/block/copy-on-read.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static int cor_open(BlockDriverState *bs, QDict *options, int flags, | ||
68 | } | ||
69 | |||
70 | |||
71 | -static void cor_close(BlockDriverState *bs) | ||
72 | -{ | ||
73 | -} | ||
74 | - | ||
75 | - | ||
76 | #define PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \ | ||
77 | | BLK_PERM_WRITE \ | ||
78 | | BLK_PERM_RESIZE) | ||
79 | @@ -XXX,XX +XXX,XX @@ BlockDriver bdrv_copy_on_read = { | ||
80 | .format_name = "copy-on-read", | ||
81 | |||
82 | .bdrv_open = cor_open, | ||
83 | - .bdrv_close = cor_close, | ||
84 | .bdrv_child_perm = cor_child_perm, | ||
85 | |||
86 | .bdrv_getlength = cor_getlength, | ||
87 | diff --git a/block/mirror.c b/block/mirror.c | ||
88 | index XXXXXXX..XXXXXXX 100644 | ||
89 | --- a/block/mirror.c | ||
90 | +++ b/block/mirror.c | ||
91 | @@ -XXX,XX +XXX,XX @@ static void bdrv_mirror_top_refresh_filename(BlockDriverState *bs, QDict *opts) | ||
92 | bs->backing->bs->filename); | ||
93 | } | ||
94 | |||
95 | -static void bdrv_mirror_top_close(BlockDriverState *bs) | ||
96 | -{ | ||
97 | -} | ||
98 | - | ||
99 | static void bdrv_mirror_top_child_perm(BlockDriverState *bs, BdrvChild *c, | ||
100 | const BdrvChildRole *role, | ||
101 | BlockReopenQueue *reopen_queue, | ||
102 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_mirror_top = { | ||
103 | .bdrv_co_flush = bdrv_mirror_top_flush, | ||
104 | .bdrv_co_block_status = bdrv_co_block_status_from_backing, | ||
105 | .bdrv_refresh_filename = bdrv_mirror_top_refresh_filename, | ||
106 | - .bdrv_close = bdrv_mirror_top_close, | ||
107 | .bdrv_child_perm = bdrv_mirror_top_child_perm, | ||
108 | }; | ||
109 | |||
110 | diff --git a/block/null.c b/block/null.c | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/block/null.c | ||
113 | +++ b/block/null.c | ||
114 | @@ -XXX,XX +XXX,XX @@ static int null_file_open(BlockDriverState *bs, QDict *options, int flags, | ||
115 | return ret; | ||
116 | } | ||
117 | |||
118 | -static void null_close(BlockDriverState *bs) | ||
119 | -{ | ||
120 | -} | ||
121 | - | ||
122 | static int64_t null_getlength(BlockDriverState *bs) | ||
123 | { | ||
124 | BDRVNullState *s = bs->opaque; | ||
125 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_null_co = { | ||
126 | |||
127 | .bdrv_file_open = null_file_open, | ||
128 | .bdrv_parse_filename = null_co_parse_filename, | ||
129 | - .bdrv_close = null_close, | ||
130 | .bdrv_getlength = null_getlength, | ||
131 | |||
132 | .bdrv_co_preadv = null_co_preadv, | ||
133 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_null_aio = { | ||
134 | |||
135 | .bdrv_file_open = null_file_open, | ||
136 | .bdrv_parse_filename = null_aio_parse_filename, | ||
137 | - .bdrv_close = null_close, | ||
138 | .bdrv_getlength = null_getlength, | ||
139 | |||
140 | .bdrv_aio_preadv = null_aio_preadv, | ||
141 | diff --git a/block/raw-format.c b/block/raw-format.c | ||
142 | index XXXXXXX..XXXXXXX 100644 | ||
143 | --- a/block/raw-format.c | ||
144 | +++ b/block/raw-format.c | ||
145 | @@ -XXX,XX +XXX,XX @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | -static void raw_close(BlockDriverState *bs) | ||
150 | -{ | ||
151 | -} | ||
152 | - | ||
153 | static int raw_probe(const uint8_t *buf, int buf_size, const char *filename) | ||
154 | { | ||
155 | /* smallest possible positive score so that raw is used if and only if no | ||
156 | @@ -XXX,XX +XXX,XX @@ BlockDriver bdrv_raw = { | ||
157 | .bdrv_reopen_commit = &raw_reopen_commit, | ||
158 | .bdrv_reopen_abort = &raw_reopen_abort, | ||
159 | .bdrv_open = &raw_open, | ||
160 | - .bdrv_close = &raw_close, | ||
161 | .bdrv_child_perm = bdrv_filter_default_perms, | ||
162 | .bdrv_co_create_opts = &raw_co_create_opts, | ||
163 | .bdrv_co_preadv = &raw_co_preadv, | ||
164 | -- | ||
165 | 2.13.6 | ||
166 | |||
167 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | This function extracts all options from a QDict starting with a | ||
4 | certain prefix and puts them in a new QDict. | ||
5 | |||
6 | We'll have a couple of cases where we simply want to discard those | ||
7 | options instead of copying them, and that's what this patch does. | ||
8 | |||
9 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | --- | ||
12 | qobject/block-qdict.c | 11 ++++++++--- | ||
13 | 1 file changed, 8 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/qobject/block-qdict.c | ||
18 | +++ b/qobject/block-qdict.c | ||
19 | @@ -XXX,XX +XXX,XX @@ void qdict_flatten(QDict *qdict) | ||
20 | qdict_flatten_qdict(qdict, qdict, NULL); | ||
21 | } | ||
22 | |||
23 | -/* extract all the src QDict entries starting by start into dst */ | ||
24 | +/* extract all the src QDict entries starting by start into dst. | ||
25 | + * If dst is NULL then the entries are simply removed from src. */ | ||
26 | void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start) | ||
27 | |||
28 | { | ||
29 | const QDictEntry *entry, *next; | ||
30 | const char *p; | ||
31 | |||
32 | - *dst = qdict_new(); | ||
33 | + if (dst) { | ||
34 | + *dst = qdict_new(); | ||
35 | + } | ||
36 | entry = qdict_first(src); | ||
37 | |||
38 | while (entry != NULL) { | ||
39 | next = qdict_next(src, entry); | ||
40 | if (strstart(entry->key, start, &p)) { | ||
41 | - qdict_put_obj(*dst, p, qobject_ref(entry->value)); | ||
42 | + if (dst) { | ||
43 | + qdict_put_obj(*dst, p, qobject_ref(entry->value)); | ||
44 | + } | ||
45 | qdict_del(src, entry->key); | ||
46 | } | ||
47 | entry = next; | ||
48 | -- | ||
49 | 2.13.6 | ||
50 | |||
51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | When bdrv_open_inherit() opens a BlockDriverState the options QDict | ||
4 | can contain options for some of its children, passed in the form of | ||
5 | child-name.option=value | ||
6 | |||
7 | So while each child is opened with that subset of options, those same | ||
8 | options remain stored in the parent BDS, leaving (at least) two copies | ||
9 | of each one of them ("child-name.option=value" in the parent and | ||
10 | "option=value" in the child). | ||
11 | |||
12 | Having the children options stored in the parent is unnecessary and it | ||
13 | can easily lead to an inconsistent state: | ||
14 | |||
15 | $ qemu-img create -f qcow2 hd0.qcow2 10M | ||
16 | $ qemu-img create -f qcow2 -b hd0.qcow2 hd1.qcow2 | ||
17 | $ qemu-img create -f qcow2 -b hd1.qcow2 hd2.qcow2 | ||
18 | |||
19 | $ $QEMU -drive file=hd2.qcow2,node-name=hd2,backing.node-name=hd1 | ||
20 | |||
21 | This opens a chain of images hd0 <- hd1 <- hd2. Now let's remove hd1 | ||
22 | using block_stream: | ||
23 | |||
24 | (qemu) block_stream hd2 0 hd0.qcow2 | ||
25 | |||
26 | After this hd2 contains backing.node-name=hd1, which is no longer | ||
27 | correct because hd1 doesn't exist anymore. | ||
28 | |||
29 | This patch removes all children options from the parent dictionaries | ||
30 | at the end of bdrv_open_inherit() and bdrv_reopen_queue_child(). | ||
31 | |||
32 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
33 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
34 | --- | ||
35 | block.c | 11 +++++++++++ | ||
36 | 1 file changed, 11 insertions(+) | ||
37 | |||
38 | diff --git a/block.c b/block.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/block.c | ||
41 | +++ b/block.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static BlockDriverState *bdrv_open_inherit(const char *filename, | ||
43 | BlockBackend *file = NULL; | ||
44 | BlockDriverState *bs; | ||
45 | BlockDriver *drv = NULL; | ||
46 | + BdrvChild *child; | ||
47 | const char *drvname; | ||
48 | const char *backing; | ||
49 | Error *local_err = NULL; | ||
50 | @@ -XXX,XX +XXX,XX @@ static BlockDriverState *bdrv_open_inherit(const char *filename, | ||
51 | } | ||
52 | } | ||
53 | |||
54 | + /* Remove all children options from bs->options and bs->explicit_options */ | ||
55 | + QLIST_FOREACH(child, &bs->children, next) { | ||
56 | + char *child_key_dot; | ||
57 | + child_key_dot = g_strdup_printf("%s.", child->name); | ||
58 | + qdict_extract_subqdict(bs->explicit_options, NULL, child_key_dot); | ||
59 | + qdict_extract_subqdict(bs->options, NULL, child_key_dot); | ||
60 | + g_free(child_key_dot); | ||
61 | + } | ||
62 | + | ||
63 | bdrv_refresh_filename(bs); | ||
64 | |||
65 | /* Check if any unknown options were used */ | ||
66 | @@ -XXX,XX +XXX,XX @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue, | ||
67 | } | ||
68 | |||
69 | child_key_dot = g_strdup_printf("%s.", child->name); | ||
70 | + qdict_extract_subqdict(explicit_options, NULL, child_key_dot); | ||
71 | qdict_extract_subqdict(options, &new_child_options, child_key_dot); | ||
72 | g_free(child_key_dot); | ||
73 | |||
74 | -- | ||
75 | 2.13.6 | ||
76 | |||
77 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | If a bdrv_reopen_multiple() call fails, then the explicit_options | ||
4 | QDict has to be deleted for every entry in the reopen queue. This must | ||
5 | happen regardless of whether that entry's bdrv_reopen_prepare() call | ||
6 | succeeded or not. | ||
7 | |||
8 | This patch simplifies the cleanup code a bit. | ||
9 | |||
10 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | --- | ||
13 | block.c | 9 ++++----- | ||
14 | 1 file changed, 4 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/block.c b/block.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/block.c | ||
19 | +++ b/block.c | ||
20 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **er | ||
21 | |||
22 | cleanup: | ||
23 | QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { | ||
24 | - if (ret && bs_entry->prepared) { | ||
25 | - bdrv_reopen_abort(&bs_entry->state); | ||
26 | - } else if (ret) { | ||
27 | + if (ret) { | ||
28 | + if (bs_entry->prepared) { | ||
29 | + bdrv_reopen_abort(&bs_entry->state); | ||
30 | + } | ||
31 | qobject_unref(bs_entry->state.explicit_options); | ||
32 | } | ||
33 | qobject_unref(bs_entry->state.options); | ||
34 | @@ -XXX,XX +XXX,XX @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state) | ||
35 | drv->bdrv_reopen_abort(reopen_state); | ||
36 | } | ||
37 | |||
38 | - qobject_unref(reopen_state->explicit_options); | ||
39 | - | ||
40 | bdrv_abort_perm_update(reopen_state->bs); | ||
41 | } | ||
42 | |||
43 | -- | ||
44 | 2.13.6 | ||
45 | |||
46 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | If bdrv_reopen() succeeds then bs->explicit_options is updated with | ||
4 | the new values, but bs->options never changes. | ||
5 | |||
6 | Here's an example: | ||
7 | |||
8 | { "execute": "blockdev-add", | ||
9 | "arguments": { | ||
10 | "driver": "qcow2", | ||
11 | "node-name": "hd0", | ||
12 | "overlap-check": "all", | ||
13 | "file": { | ||
14 | "driver": "file", | ||
15 | "filename": "hd0.qcow2" | ||
16 | } | ||
17 | } | ||
18 | } | ||
19 | |||
20 | After this, both bs->options and bs->explicit_options contain | ||
21 | "overlap-check": "all". | ||
22 | |||
23 | Now let's change that using qemu-io's reopen command: | ||
24 | |||
25 | (qemu) qemu-io hd0 "reopen -o overlap-check=none" | ||
26 | |||
27 | After this, bs->explicit_options contains the new value but | ||
28 | bs->options still keeps the old one. | ||
29 | |||
30 | This patch updates bs->options after a BDS has been successfully | ||
31 | reopened. | ||
32 | |||
33 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
34 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
35 | --- | ||
36 | block.c | 15 ++++++++++++++- | ||
37 | 1 file changed, 14 insertions(+), 1 deletion(-) | ||
38 | |||
39 | diff --git a/block.c b/block.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/block.c | ||
42 | +++ b/block.c | ||
43 | @@ -XXX,XX +XXX,XX @@ cleanup: | ||
44 | bdrv_reopen_abort(&bs_entry->state); | ||
45 | } | ||
46 | qobject_unref(bs_entry->state.explicit_options); | ||
47 | + qobject_unref(bs_entry->state.options); | ||
48 | } | ||
49 | - qobject_unref(bs_entry->state.options); | ||
50 | g_free(bs_entry); | ||
51 | } | ||
52 | g_free(bs_queue); | ||
53 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, | ||
54 | Error *local_err = NULL; | ||
55 | BlockDriver *drv; | ||
56 | QemuOpts *opts; | ||
57 | + QDict *orig_reopen_opts; | ||
58 | const char *value; | ||
59 | bool read_only; | ||
60 | |||
61 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, | ||
62 | assert(reopen_state->bs->drv != NULL); | ||
63 | drv = reopen_state->bs->drv; | ||
64 | |||
65 | + /* This function and each driver's bdrv_reopen_prepare() remove | ||
66 | + * entries from reopen_state->options as they are processed, so | ||
67 | + * we need to make a copy of the original QDict. */ | ||
68 | + orig_reopen_opts = qdict_clone_shallow(reopen_state->options); | ||
69 | + | ||
70 | /* Process generic block layer options */ | ||
71 | opts = qemu_opts_create(&bdrv_runtime_opts, NULL, 0, &error_abort); | ||
72 | qemu_opts_absorb_qdict(opts, reopen_state->options, &local_err); | ||
73 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, | ||
74 | |||
75 | ret = 0; | ||
76 | |||
77 | + /* Restore the original reopen_state->options QDict */ | ||
78 | + qobject_unref(reopen_state->options); | ||
79 | + reopen_state->options = qobject_ref(orig_reopen_opts); | ||
80 | + | ||
81 | error: | ||
82 | qemu_opts_del(opts); | ||
83 | + qobject_unref(orig_reopen_opts); | ||
84 | return ret; | ||
85 | } | ||
86 | |||
87 | @@ -XXX,XX +XXX,XX @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state) | ||
88 | |||
89 | /* set BDS specific flags now */ | ||
90 | qobject_unref(bs->explicit_options); | ||
91 | + qobject_unref(bs->options); | ||
92 | |||
93 | bs->explicit_options = reopen_state->explicit_options; | ||
94 | + bs->options = reopen_state->options; | ||
95 | bs->open_flags = reopen_state->flags; | ||
96 | bs->read_only = !(reopen_state->flags & BDRV_O_RDWR); | ||
97 | |||
98 | -- | ||
99 | 2.13.6 | ||
100 | |||
101 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | This function returns a BDS's driver-specific options, excluding also | ||
4 | those from its children. Since we have just removed all children | ||
5 | options from bs->options there's no need to do this last step. | ||
6 | |||
7 | We allow references to children, though ("backing": "node0"), so those | ||
8 | we still have to remove. | ||
9 | |||
10 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
11 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | --- | ||
13 | block.c | 7 ++----- | ||
14 | 1 file changed, 2 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/block.c b/block.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/block.c | ||
19 | +++ b/block.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static bool append_open_options(QDict *d, BlockDriverState *bs) | ||
21 | QemuOptDesc *desc; | ||
22 | BdrvChild *child; | ||
23 | bool found_any = false; | ||
24 | - const char *p; | ||
25 | |||
26 | for (entry = qdict_first(bs->options); entry; | ||
27 | entry = qdict_next(bs->options, entry)) | ||
28 | { | ||
29 | - /* Exclude options for children */ | ||
30 | + /* Exclude node-name references to children */ | ||
31 | QLIST_FOREACH(child, &bs->children, next) { | ||
32 | - if (strstart(qdict_entry_key(entry), child->name, &p) | ||
33 | - && (!*p || *p == '.')) | ||
34 | - { | ||
35 | + if (!strcmp(entry->key, child->name)) { | ||
36 | break; | ||
37 | } | ||
38 | } | ||
39 | -- | ||
40 | 2.13.6 | ||
41 | |||
42 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Peter Krempa <pkrempa@redhat.com> | ||
2 | 1 | ||
3 | Most of the various error classes were removed prior to the 1.2 release. | ||
4 | Remove mentions of the error classes which did not make it. | ||
5 | |||
6 | Signed-off-by: Peter Krempa <pkrempa@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | --- | ||
9 | qapi/block-core.json | 5 +---- | ||
10 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
11 | |||
12 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/qapi/block-core.json | ||
15 | +++ b/qapi/block-core.json | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | # autogenerated. (Since: 2.9) | ||
18 | # | ||
19 | # Returns: Nothing on success | ||
20 | -# If commit or stream is already active on this device, DeviceInUse | ||
21 | # If @device does not exist, DeviceNotFound | ||
22 | -# If image commit is not supported by this device, NotSupported | ||
23 | -# If @base or @top is invalid, a generic error is returned | ||
24 | -# If @speed is invalid, InvalidParameter | ||
25 | +# Any other error returns a GenericError. | ||
26 | # | ||
27 | # Since: 1.3 | ||
28 | # | ||
29 | -- | ||
30 | 2.13.6 | ||
31 | |||
32 | diff view generated by jsdifflib |