1
The following changes since commit 81b2d5ceb0cfb4cdc2163492e3169ed714b0cda9:
1
The following changes since commit debe78ce14bf8f8940c2bdf3ef387505e9e035a9:
2
2
3
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20170426' into staging (2017-04-26 20:50:49 +0100)
3
Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200515' into staging (2020-05-15 19:51:16 +0100)
4
4
5
are available in the git repository at:
5
are available in the Git repository at:
6
7
6
8
git://repo.or.cz/qemu/kevin.git tags/for-upstream
7
git://repo.or.cz/qemu/kevin.git tags/for-upstream
9
8
10
for you to fetch changes up to 5fc0fe383fff318b38291dcdf2cf38e329ec232a:
9
for you to fetch changes up to 4cdd0a774dc35b2ffe6ddb634e0c431f17dfe07e:
11
10
12
Merge remote-tracking branch 'mreitz/tags/pull-block-2017-04-28' into queue-block (2017-04-28 20:52:17 +0200)
11
hw: Use QEMU_IS_ALIGNED() on parallel flash block size (2020-05-18 19:05:25 +0200)
13
12
14
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block layer patches:
15
15
16
Block layer patches
16
- Introduce real BdrvChildRole
17
- blk/bdrv_make_empty() functions instead of calling callbacks directly
18
- mirror: Make sure that source and target size match
19
- block-copy: Fix uninitialized variable
20
- block/replication: Avoid cancelling the job twice
21
- ahci: Log lost IRQs
22
- iotests: Run pylint and mypy in a testcase
23
- iotests: log messages from notrun()
17
24
18
----------------------------------------------------------------
25
----------------------------------------------------------------
19
Denis V. Lunev (2):
26
John Snow (1):
20
block: fix alignment calculations in bdrv_co_do_zero_pwritev
27
iotests: log messages from notrun()
21
block: assert no image modification under BDRV_O_INACTIVE
22
23
Eric Blake (2):
24
iotests: Fix typo in 026
25
qcow2: Allow discard of final unaligned cluster
26
27
Fam Zheng (2):
28
block: Remove NULL check in bdrv_co_flush
29
iotests: 109: Filter out "len" of failed jobs
30
31
John Snow (2):
32
iotests: clarify help text
33
iotests: fix exclusion option
34
28
35
Kevin Wolf (8):
29
Kevin Wolf (8):
36
file-posix: Remove unnecessary includes
30
iotests/109: Don't mirror with mismatched size
37
file-win32: Remove unnecessary include
31
iotests/229: Use blkdebug to inject an error
38
migration: Call blk_resume_after_migration() for postcopy
32
mirror: Make sure that source and target size match
39
qemu-iotests: Filter HMP readline escape characters
33
iotests: Mirror with different source/target size
40
qemu-iotests: Test postcopy migration
34
iotests: Fix incomplete type declarations
41
qemu-iotests: Remove PERL_PROG and BC_PROG
35
iotests: Run pylint and mypy in a testcase
42
qemu_iotests: Remove _readlink()
36
replication: Avoid blk_make_empty() on read-only child
43
Merge remote-tracking branch 'mreitz/tags/pull-block-2017-04-28' into queue-block
37
iotests/030: Reduce run time by unthrottling job earlier
44
38
45
Klim Kireev (1):
39
Lukas Straub (1):
46
block: fix obvious coding style mistakes in block_int.h
40
block/replication.c: Avoid cancelling the job twice
47
41
48
Krzysztof Kozlowski (1):
42
Max Reitz (38):
49
block: Constify data passed by pointer to blk_name
43
block: Add bdrv_make_empty()
44
block: Add blk_make_empty()
45
block: Use blk_make_empty() after commits
46
block: Use bdrv_make_empty() where possible
47
block: Mark commit, mirror, blkreplay as filters
48
block: Add BlockDriver.is_format
49
block: Rename BdrvChildRole to BdrvChildClass
50
block: Add BdrvChildRole and BdrvChildRoleBits
51
block: Add BdrvChildRole to BdrvChild
52
block: Pass BdrvChildRole to bdrv_child_perm()
53
block: Pass BdrvChildRole to .inherit_options()
54
block: Pass parent_is_format to .inherit_options()
55
block: Rename bdrv_inherited_options()
56
block: Add generic bdrv_inherited_options()
57
block: Use bdrv_inherited_options()
58
block: Unify bdrv_child_cb_attach()
59
block: Unify bdrv_child_cb_detach()
60
block: Add child_of_bds
61
block: Distinguish paths in *_format_default_perms
62
block: Pull out bdrv_default_perms_for_cow()
63
block: Pull out bdrv_default_perms_for_storage()
64
block: Relax *perms_for_storage for data children
65
block: Add bdrv_default_perms()
66
raw-format: Split raw_read_options()
67
block: Switch child_format users to child_of_bds
68
block: Drop child_format
69
block: Make backing files child_of_bds children
70
block: Drop child_backing
71
block: Make format drivers use child_of_bds
72
block: Make filter drivers use child_of_bds
73
block: Use child_of_bds in remaining places
74
tests: Use child_of_bds instead of child_file
75
block: Use bdrv_default_perms()
76
block: Make bdrv_filter_default_perms() static
77
block: Drop bdrv_format_default_perms()
78
block: Drop child_file
79
block: Pass BdrvChildRole in remaining cases
80
block: Drop @child_class from bdrv_child_perm()
50
81
51
Lidong Chen (1):
82
Philippe Mathieu-Daudé (4):
52
qemu-img: use blk_co_pwrite_zeroes for zero sectors when compressed
83
block/block-copy: Fix uninitialized variable in block_copy_task_entry
84
block/block-copy: Simplify block_copy_do_copy()
85
hw/ide/ahci: Log lost IRQs
86
hw: Use QEMU_IS_ALIGNED() on parallel flash block size
53
87
54
Max Reitz (13):
88
include/block/block.h | 65 ++++-
55
Revert "block/io: Comment out permission assertions"
89
include/block/block_int.h | 57 ++--
56
block: An empty filename counts as no filename
90
include/sysemu/block-backend.h | 2 +
57
iotests/051: Add test for empty filename
91
block.c | 601 ++++++++++++++++++++++++---------------
58
iotests: Launch qemu-nbd with -e 42
92
block/backup-top.c | 11 +-
59
block: Do not unref bs->file on error in BD's open
93
block/blkdebug.c | 10 +-
60
qemu-img/convert: Use @opts for one thing only
94
block/blklogwrites.c | 16 +-
61
qemu-img/convert: Move bs_n > 1 && -B check down
95
block/blkreplay.c | 8 +-
62
qemu-img: Document backing options
96
block/blkverify.c | 10 +-
63
block/vhdx: Make vhdx_create() always set errp
97
block/block-backend.c | 30 +-
64
block: Add errp to b{lk,drv}_truncate()
98
block/block-copy.c | 14 +-
65
block: Add errp to BD.bdrv_truncate()
99
block/bochs.c | 7 +-
66
block: Add .bdrv_truncate() error messages
100
block/cloop.c | 7 +-
67
progress: Show current progress on SIGINFO
101
block/commit.c | 20 +-
102
block/copy-on-read.c | 7 +-
103
block/crypto.c | 8 +-
104
block/dmg.c | 7 +-
105
block/filter-compress.c | 7 +-
106
block/io.c | 22 +-
107
block/mirror.c | 25 +-
108
block/parallels.c | 7 +-
109
block/qcow.c | 7 +-
110
block/qcow2.c | 20 +-
111
block/qed.c | 7 +-
112
block/quorum.c | 8 +-
113
block/raw-format.c | 128 +++++----
114
block/replication.c | 23 +-
115
block/throttle.c | 7 +-
116
block/vdi.c | 7 +-
117
block/vhdx.c | 7 +-
118
block/vmdk.c | 23 +-
119
block/vpc.c | 7 +-
120
block/vvfat.c | 17 +-
121
blockjob.c | 7 +-
122
hw/arm/sbsa-ref.c | 2 +-
123
hw/arm/virt.c | 2 +-
124
hw/block/pflash_cfi01.c | 2 +-
125
hw/block/pflash_cfi02.c | 2 +-
126
hw/i386/pc_sysfw.c | 2 +-
127
hw/ide/ahci.c | 1 +
128
hw/riscv/virt.c | 2 +-
129
qemu-img.c | 19 +-
130
tests/test-bdrv-drain.c | 72 +++--
131
tests/test-bdrv-graph-mod.c | 10 +-
132
tests/test-block-iothread.c | 17 +-
133
tests/qemu-iotests/iotests.py | 19 +-
134
tests/qemu-iotests/030 | 6 +-
135
tests/qemu-iotests/041 | 45 +++
136
tests/qemu-iotests/041.out | 4 +-
137
tests/qemu-iotests/098.out | 8 +-
138
tests/qemu-iotests/109 | 10 +-
139
tests/qemu-iotests/109.out | 74 ++---
140
tests/qemu-iotests/229 | 18 +-
141
tests/qemu-iotests/229.out | 6 +-
142
tests/qemu-iotests/297 | 44 +++
143
tests/qemu-iotests/297.out | 3 +
144
tests/qemu-iotests/common.filter | 5 +
145
tests/qemu-iotests/group | 1 +
146
58 files changed, 1003 insertions(+), 580 deletions(-)
147
create mode 100755 tests/qemu-iotests/297
148
create mode 100644 tests/qemu-iotests/297.out
68
149
69
Peter Lieven (1):
70
qemu-img: simplify img_convert
71
150
72
Thomas Huth (1):
73
Issue a deprecation warning if the user specifies the "-hdachs" option.
74
75
Vladimir Sementsov-Ogievskiy (1):
76
qemu-img: improve convert_iteration_sectors()
77
78
block.c | 26 +--
79
block/blkdebug.c | 8 +-
80
block/blkreplay.c | 3 -
81
block/blkverify.c | 3 -
82
block/block-backend.c | 7 +-
83
block/commit.c | 5 +-
84
block/crypto.c | 5 +-
85
block/file-posix.c | 21 ++-
86
block/file-win32.c | 7 +-
87
block/gluster.c | 7 +-
88
block/io.c | 16 +-
89
block/iscsi.c | 6 +-
90
block/mirror.c | 2 +-
91
block/nfs.c | 12 +-
92
block/parallels.c | 13 +-
93
block/qcow.c | 6 +-
94
block/qcow2-refcount.c | 5 +-
95
block/qcow2.c | 31 ++--
96
block/qed.c | 8 +-
97
block/raw-format.c | 6 +-
98
block/rbd.c | 3 +-
99
block/sheepdog.c | 14 +-
100
block/vdi.c | 4 +-
101
block/vhdx-log.c | 2 +-
102
block/vhdx.c | 25 ++-
103
block/vmdk.c | 13 +-
104
block/vpc.c | 13 +-
105
blockdev.c | 21 +--
106
include/block/block.h | 2 +-
107
include/block/block_int.h | 8 +-
108
include/sysemu/block-backend.h | 4 +-
109
migration/savevm.c | 8 +
110
qemu-img-cmds.hx | 8 +-
111
qemu-img.c | 313 ++++++++++++++-----------------------
112
qemu-img.texi | 7 +-
113
qemu-io-cmds.c | 5 +-
114
qemu-options.hx | 4 +-
115
tests/qemu-iotests/026 | 2 +-
116
tests/qemu-iotests/026.out | 2 +-
117
tests/qemu-iotests/026.out.nocache | 2 +-
118
tests/qemu-iotests/028.out | 2 +-
119
tests/qemu-iotests/051 | 4 +-
120
tests/qemu-iotests/051.out | 109 ++++++-------
121
tests/qemu-iotests/051.pc.out | 135 ++++++++--------
122
tests/qemu-iotests/066 | 12 +-
123
tests/qemu-iotests/066.out | 12 +-
124
tests/qemu-iotests/068 | 4 +-
125
tests/qemu-iotests/068.out | 6 +-
126
tests/qemu-iotests/109 | 6 +-
127
tests/qemu-iotests/109.out | 20 +--
128
tests/qemu-iotests/122.out | 4 +-
129
tests/qemu-iotests/130.out | 4 +-
130
tests/qemu-iotests/142 | 2 +-
131
tests/qemu-iotests/142.out | 10 +-
132
tests/qemu-iotests/145 | 3 +-
133
tests/qemu-iotests/145.out | 2 +-
134
tests/qemu-iotests/181 | 119 ++++++++++++++
135
tests/qemu-iotests/181.out | 38 +++++
136
tests/qemu-iotests/common | 11 +-
137
tests/qemu-iotests/common.config | 24 ---
138
tests/qemu-iotests/common.filter | 13 ++
139
tests/qemu-iotests/common.qemu | 4 +-
140
tests/qemu-iotests/common.rc | 4 +-
141
tests/qemu-iotests/group | 1 +
142
util/qemu-progress.c | 3 +
143
vl.c | 2 +
144
66 files changed, 669 insertions(+), 542 deletions(-)
145
create mode 100755 tests/qemu-iotests/181
146
create mode 100644 tests/qemu-iotests/181.out
147
diff view generated by jsdifflib
Deleted patch
1
From: Krzysztof Kozlowski <krzk@kernel.org>
2
1
3
blk_name() is not modifying data passed to it through pointer and it
4
returns also a pointer to const so the argument can be made const for
5
code safeness.
6
7
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
11
block/block-backend.c | 2 +-
12
include/sysemu/block-backend.h | 2 +-
13
2 files changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/block/block-backend.c b/block/block-backend.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/block/block-backend.c
18
+++ b/block/block-backend.c
19
@@ -XXX,XX +XXX,XX @@ void monitor_remove_blk(BlockBackend *blk)
20
* Return @blk's name, a non-null string.
21
* Returns an empty string iff @blk is not referenced by the monitor.
22
*/
23
-const char *blk_name(BlockBackend *blk)
24
+const char *blk_name(const BlockBackend *blk)
25
{
26
return blk->name ?: "";
27
}
28
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
29
index XXXXXXX..XXXXXXX 100644
30
--- a/include/sysemu/block-backend.h
31
+++ b/include/sysemu/block-backend.h
32
@@ -XXX,XX +XXX,XX @@ int blk_get_refcnt(BlockBackend *blk);
33
void blk_ref(BlockBackend *blk);
34
void blk_unref(BlockBackend *blk);
35
void blk_remove_all_bs(void);
36
-const char *blk_name(BlockBackend *blk);
37
+const char *blk_name(const BlockBackend *blk);
38
BlockBackend *blk_by_name(const char *name);
39
BlockBackend *blk_next(BlockBackend *blk);
40
bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp);
41
--
42
1.8.3.1
43
44
diff view generated by jsdifflib
Deleted patch
1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2
---
3
block/file-posix.c | 2 --
4
1 file changed, 2 deletions(-)
5
1
6
diff --git a/block/file-posix.c b/block/file-posix.c
7
index XXXXXXX..XXXXXXX 100644
8
--- a/block/file-posix.c
9
+++ b/block/file-posix.c
10
@@ -XXX,XX +XXX,XX @@
11
#include "qapi/error.h"
12
#include "qemu/cutils.h"
13
#include "qemu/error-report.h"
14
-#include "qemu/timer.h"
15
-#include "qemu/log.h"
16
#include "block/block_int.h"
17
#include "qemu/module.h"
18
#include "trace.h"
19
--
20
1.8.3.1
21
22
diff view generated by jsdifflib
Deleted patch
1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2
---
3
block/file-win32.c | 1 -
4
1 file changed, 1 deletion(-)
5
1
6
diff --git a/block/file-win32.c b/block/file-win32.c
7
index XXXXXXX..XXXXXXX 100644
8
--- a/block/file-win32.c
9
+++ b/block/file-win32.c
10
@@ -XXX,XX +XXX,XX @@
11
#include "qemu/osdep.h"
12
#include "qapi/error.h"
13
#include "qemu/cutils.h"
14
-#include "qemu/timer.h"
15
#include "block/block_int.h"
16
#include "qemu/module.h"
17
#include "block/raw-aio.h"
18
--
19
1.8.3.1
20
21
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
This reverts commit e3e0003a8f6570aba1421ef99a0b383a43371a74.
4
5
This commit was necessary for the 2.9 release because we were unable to
6
fix the underlying issue(s) in time. However, we will be for 2.10.
7
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
Acked-by: Fam Zheng <famz@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
12
block.c | 6 +-----
13
block/io.c | 12 ++----------
14
2 files changed, 3 insertions(+), 15 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_truncate(BdrvChild *child, int64_t offset)
21
BlockDriver *drv = bs->drv;
22
int ret;
23
24
- /* FIXME: Some format block drivers use this function instead of implicitly
25
- * growing their file by writing beyond its end.
26
- * See bdrv_aligned_pwritev() for an explanation why we currently
27
- * cannot assert this permission in that case. */
28
- // assert(child->perm & BLK_PERM_RESIZE);
29
+ assert(child->perm & BLK_PERM_RESIZE);
30
31
if (!drv)
32
return -ENOMEDIUM;
33
diff --git a/block/io.c b/block/io.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/block/io.c
36
+++ b/block/io.c
37
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
38
assert(!waited || !req->serialising);
39
assert(req->overlap_offset <= offset);
40
assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
41
- /* FIXME: Block migration uses the BlockBackend of the guest device at a
42
- * point when it has not yet taken write permissions. This will be
43
- * fixed by a future patch, but for now we have to bypass this
44
- * assertion for block migration to work. */
45
- // assert(child->perm & BLK_PERM_WRITE);
46
- /* FIXME: Because of the above, we also cannot guarantee that all format
47
- * BDS take the BLK_PERM_RESIZE permission on their file BDS, since
48
- * they are not obligated to do so if they do not have any parent
49
- * that has taken the permission to write to them. */
50
- // assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
51
+ assert(child->perm & BLK_PERM_WRITE);
52
+ assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
53
54
ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
55
56
--
57
1.8.3.1
58
59
diff view generated by jsdifflib
Deleted patch
1
From: Peter Lieven <pl@kamp.de>
2
1
3
img_convert has been around before there was an ImgConvertState or
4
a block backend, but it has never been modified to directly use
5
these structs. Change this by parsing parameters directly into
6
the ImgConvertState and directly use BlockBackend where possible.
7
Furthermore variable initialization has been reworked and sorted.
8
9
Signed-off-by: Peter Lieven <pl@kamp.de>
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
---
13
qemu-img.c | 201 +++++++++++++++++++++++++------------------------------------
14
1 file changed, 81 insertions(+), 120 deletions(-)
15
16
diff --git a/qemu-img.c b/qemu-img.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/qemu-img.c
19
+++ b/qemu-img.c
20
@@ -XXX,XX +XXX,XX @@ typedef struct ImgConvertState {
21
int min_sparse;
22
size_t cluster_sectors;
23
size_t buf_sectors;
24
- int num_coroutines;
25
+ long num_coroutines;
26
int running_coroutines;
27
Coroutine *co[MAX_COROUTINES];
28
int64_t wait_sector_num[MAX_COROUTINES];
29
@@ -XXX,XX +XXX,XX @@ static int convert_do_copy(ImgConvertState *s)
30
31
static int img_convert(int argc, char **argv)
32
{
33
- int c, bs_n, bs_i, compress, cluster_sectors, skip_create;
34
- int64_t ret = 0;
35
- int progress = 0, flags, src_flags;
36
- bool writethrough, src_writethrough;
37
- const char *fmt, *out_fmt, *cache, *src_cache, *out_baseimg, *out_filename;
38
+ int c, bs_i, flags, src_flags = 0;
39
+ const char *fmt = NULL, *out_fmt = "raw", *cache = "unsafe",
40
+ *src_cache = BDRV_DEFAULT_CACHE, *out_baseimg = NULL,
41
+ *out_filename, *out_baseimg_param, *snapshot_name = NULL;
42
BlockDriver *drv, *proto_drv;
43
- BlockBackend **blk = NULL, *out_blk = NULL;
44
- BlockDriverState **bs = NULL, *out_bs = NULL;
45
- int64_t total_sectors;
46
- int64_t *bs_sectors = NULL;
47
- size_t bufsectors = IO_BUF_SIZE / BDRV_SECTOR_SIZE;
48
BlockDriverInfo bdi;
49
- QemuOpts *opts = NULL;
50
+ BlockDriverState *out_bs;
51
+ QemuOpts *opts = NULL, *sn_opts = NULL;
52
QemuOptsList *create_opts = NULL;
53
- const char *out_baseimg_param;
54
char *options = NULL;
55
- const char *snapshot_name = NULL;
56
- int min_sparse = 8; /* Need at least 4k of zeros for sparse detection */
57
- bool quiet = false;
58
Error *local_err = NULL;
59
- QemuOpts *sn_opts = NULL;
60
- ImgConvertState state;
61
- bool image_opts = false;
62
- bool wr_in_order = true;
63
- long num_coroutines = 8;
64
+ bool writethrough, src_writethrough, quiet = false, image_opts = false,
65
+ skip_create = false, progress = false;
66
+ int64_t ret = -EINVAL;
67
+
68
+ ImgConvertState s = (ImgConvertState) {
69
+ /* Need at least 4k of zeros for sparse detection */
70
+ .min_sparse = 8,
71
+ .buf_sectors = IO_BUF_SIZE / BDRV_SECTOR_SIZE,
72
+ .wr_in_order = true,
73
+ .num_coroutines = 8,
74
+ };
75
76
- fmt = NULL;
77
- out_fmt = "raw";
78
- cache = "unsafe";
79
- src_cache = BDRV_DEFAULT_CACHE;
80
- out_baseimg = NULL;
81
- compress = 0;
82
- skip_create = 0;
83
for(;;) {
84
static const struct option long_options[] = {
85
{"help", no_argument, 0, 'h'},
86
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
87
out_baseimg = optarg;
88
break;
89
case 'c':
90
- compress = 1;
91
+ s.compressed = true;
92
break;
93
case 'e':
94
error_report("option -e is deprecated, please use \'-o "
95
"encryption\' instead!");
96
- ret = -1;
97
goto fail_getopt;
98
case '6':
99
error_report("option -6 is deprecated, please use \'-o "
100
"compat6\' instead!");
101
- ret = -1;
102
goto fail_getopt;
103
case 'o':
104
if (!is_valid_option_list(optarg)) {
105
error_report("Invalid option list: %s", optarg);
106
- ret = -1;
107
goto fail_getopt;
108
}
109
if (!options) {
110
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
111
if (!sn_opts) {
112
error_report("Failed in parsing snapshot param '%s'",
113
optarg);
114
- ret = -1;
115
goto fail_getopt;
116
}
117
} else {
118
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
119
sval = cvtnum(optarg);
120
if (sval < 0) {
121
error_report("Invalid minimum zero buffer size for sparse output specified");
122
- ret = -1;
123
goto fail_getopt;
124
}
125
126
- min_sparse = sval / BDRV_SECTOR_SIZE;
127
+ s.min_sparse = sval / BDRV_SECTOR_SIZE;
128
break;
129
}
130
case 'p':
131
- progress = 1;
132
+ progress = true;
133
break;
134
case 't':
135
cache = optarg;
136
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
137
quiet = true;
138
break;
139
case 'n':
140
- skip_create = 1;
141
+ skip_create = true;
142
break;
143
case 'm':
144
- if (qemu_strtol(optarg, NULL, 0, &num_coroutines) ||
145
- num_coroutines < 1 || num_coroutines > MAX_COROUTINES) {
146
+ if (qemu_strtol(optarg, NULL, 0, &s.num_coroutines) ||
147
+ s.num_coroutines < 1 || s.num_coroutines > MAX_COROUTINES) {
148
error_report("Invalid number of coroutines. Allowed number of"
149
" coroutines is between 1 and %d", MAX_COROUTINES);
150
- ret = -1;
151
goto fail_getopt;
152
}
153
break;
154
case 'W':
155
- wr_in_order = false;
156
+ s.wr_in_order = false;
157
break;
158
case OPTION_OBJECT:
159
opts = qemu_opts_parse_noisily(&qemu_object_opts,
160
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
161
goto fail_getopt;
162
}
163
164
- if (!wr_in_order && compress) {
165
+ if (!s.wr_in_order && s.compressed) {
166
error_report("Out of order write and compress are mutually exclusive");
167
- ret = -1;
168
goto fail_getopt;
169
}
170
171
- /* Initialize before goto out */
172
- if (quiet) {
173
- progress = 0;
174
- }
175
- qemu_progress_init(progress, 1.0);
176
-
177
- bs_n = argc - optind - 1;
178
- out_filename = bs_n >= 1 ? argv[argc - 1] : NULL;
179
+ s.src_num = argc - optind - 1;
180
+ out_filename = s.src_num >= 1 ? argv[argc - 1] : NULL;
181
182
if (options && has_help_option(options)) {
183
ret = print_block_option_help(out_filename, out_fmt);
184
- goto out;
185
+ goto fail_getopt;
186
}
187
188
- if (bs_n < 1) {
189
- error_exit("Must specify image file name");
190
+ if (s.src_num < 1) {
191
+ error_report("Must specify image file name");
192
+ goto fail_getopt;
193
}
194
195
196
- if (bs_n > 1 && out_baseimg) {
197
+ if (s.src_num > 1 && out_baseimg) {
198
error_report("-B makes no sense when concatenating multiple input "
199
"images");
200
- ret = -1;
201
- goto out;
202
+ goto fail_getopt;
203
}
204
205
- src_flags = 0;
206
+ /* ret is still -EINVAL until here */
207
ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
208
if (ret < 0) {
209
error_report("Invalid source cache option: %s", src_cache);
210
- goto out;
211
+ goto fail_getopt;
212
}
213
214
+ /* Initialize before goto out */
215
+ if (quiet) {
216
+ progress = false;
217
+ }
218
+ qemu_progress_init(progress, 1.0);
219
qemu_progress_print(0, 100);
220
221
- blk = g_new0(BlockBackend *, bs_n);
222
- bs = g_new0(BlockDriverState *, bs_n);
223
- bs_sectors = g_new(int64_t, bs_n);
224
+ s.src = g_new0(BlockBackend *, s.src_num);
225
+ s.src_sectors = g_new(int64_t, s.src_num);
226
227
- total_sectors = 0;
228
- for (bs_i = 0; bs_i < bs_n; bs_i++) {
229
- blk[bs_i] = img_open(image_opts, argv[optind + bs_i],
230
- fmt, src_flags, src_writethrough, quiet);
231
- if (!blk[bs_i]) {
232
+ for (bs_i = 0; bs_i < s.src_num; bs_i++) {
233
+ s.src[bs_i] = img_open(image_opts, argv[optind + bs_i],
234
+ fmt, src_flags, src_writethrough, quiet);
235
+ if (!s.src[bs_i]) {
236
ret = -1;
237
goto out;
238
}
239
- bs[bs_i] = blk_bs(blk[bs_i]);
240
- bs_sectors[bs_i] = blk_nb_sectors(blk[bs_i]);
241
- if (bs_sectors[bs_i] < 0) {
242
+ s.src_sectors[bs_i] = blk_nb_sectors(s.src[bs_i]);
243
+ if (s.src_sectors[bs_i] < 0) {
244
error_report("Could not get size of %s: %s",
245
- argv[optind + bs_i], strerror(-bs_sectors[bs_i]));
246
+ argv[optind + bs_i], strerror(-s.src_sectors[bs_i]));
247
ret = -1;
248
goto out;
249
}
250
- total_sectors += bs_sectors[bs_i];
251
+ s.total_sectors += s.src_sectors[bs_i];
252
}
253
254
if (sn_opts) {
255
- bdrv_snapshot_load_tmp(bs[0],
256
+ bdrv_snapshot_load_tmp(blk_bs(s.src[0]),
257
qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
258
qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
259
&local_err);
260
} else if (snapshot_name != NULL) {
261
- if (bs_n > 1) {
262
+ if (s.src_num > 1) {
263
error_report("No support for concatenating multiple snapshot");
264
ret = -1;
265
goto out;
266
}
267
268
- bdrv_snapshot_load_tmp_by_id_or_name(bs[0], snapshot_name, &local_err);
269
+ bdrv_snapshot_load_tmp_by_id_or_name(blk_bs(s.src[0]), snapshot_name,
270
+ &local_err);
271
}
272
if (local_err) {
273
error_reportf_err(local_err, "Failed to load snapshot: ");
274
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
275
}
276
}
277
278
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_sectors * 512,
279
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s.total_sectors * 512,
280
&error_abort);
281
ret = add_old_style_options(out_fmt, opts, out_baseimg, NULL);
282
if (ret < 0) {
283
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
284
if (out_baseimg_param) {
285
out_baseimg = out_baseimg_param;
286
}
287
+ s.target_has_backing = (bool) out_baseimg;
288
289
/* Check if compression is supported */
290
- if (compress) {
291
+ if (s.compressed) {
292
bool encryption =
293
qemu_opt_get_bool(opts, BLOCK_OPT_ENCRYPT, false);
294
const char *preallocation =
295
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
296
}
297
}
298
299
- flags = min_sparse ? (BDRV_O_RDWR | BDRV_O_UNMAP) : BDRV_O_RDWR;
300
+ flags = s.min_sparse ? (BDRV_O_RDWR | BDRV_O_UNMAP) : BDRV_O_RDWR;
301
ret = bdrv_parse_cache_mode(cache, &flags, &writethrough);
302
if (ret < 0) {
303
error_report("Invalid cache option: %s", cache);
304
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
305
* the bdrv_create() call which takes different params.
306
* Not critical right now, so fix can wait...
307
*/
308
- out_blk = img_open_file(out_filename, out_fmt, flags, writethrough, quiet);
309
- if (!out_blk) {
310
+ s.target = img_open_file(out_filename, out_fmt, flags, writethrough, quiet);
311
+ if (!s.target) {
312
ret = -1;
313
goto out;
314
}
315
- out_bs = blk_bs(out_blk);
316
+ out_bs = blk_bs(s.target);
317
318
/* increase bufsectors from the default 4096 (2M) if opt_transfer
319
* or discard_alignment of the out_bs is greater. Limit to 32768 (16MB)
320
* as maximum. */
321
- bufsectors = MIN(32768,
322
- MAX(bufsectors,
323
- MAX(out_bs->bl.opt_transfer >> BDRV_SECTOR_BITS,
324
- out_bs->bl.pdiscard_alignment >>
325
- BDRV_SECTOR_BITS)));
326
+ s.buf_sectors = MIN(32768,
327
+ MAX(s.buf_sectors,
328
+ MAX(out_bs->bl.opt_transfer >> BDRV_SECTOR_BITS,
329
+ out_bs->bl.pdiscard_alignment >>
330
+ BDRV_SECTOR_BITS)));
331
332
if (skip_create) {
333
- int64_t output_sectors = blk_nb_sectors(out_blk);
334
+ int64_t output_sectors = blk_nb_sectors(s.target);
335
if (output_sectors < 0) {
336
error_report("unable to get output image length: %s",
337
strerror(-output_sectors));
338
ret = -1;
339
goto out;
340
- } else if (output_sectors < total_sectors) {
341
+ } else if (output_sectors < s.total_sectors) {
342
error_report("output file is smaller than input file");
343
ret = -1;
344
goto out;
345
}
346
}
347
348
- cluster_sectors = 0;
349
ret = bdrv_get_info(out_bs, &bdi);
350
if (ret < 0) {
351
- if (compress) {
352
+ if (s.compressed) {
353
error_report("could not get block driver info");
354
goto out;
355
}
356
} else {
357
- compress = compress || bdi.needs_compressed_writes;
358
- cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE;
359
- }
360
-
361
- state = (ImgConvertState) {
362
- .src = blk,
363
- .src_sectors = bs_sectors,
364
- .src_num = bs_n,
365
- .total_sectors = total_sectors,
366
- .target = out_blk,
367
- .compressed = compress,
368
- .target_has_backing = (bool) out_baseimg,
369
- .min_sparse = min_sparse,
370
- .cluster_sectors = cluster_sectors,
371
- .buf_sectors = bufsectors,
372
- .wr_in_order = wr_in_order,
373
- .num_coroutines = num_coroutines,
374
- };
375
- ret = convert_do_copy(&state);
376
+ s.compressed = s.compressed || bdi.needs_compressed_writes;
377
+ s.cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE;
378
+ }
379
380
+ ret = convert_do_copy(&s);
381
out:
382
if (!ret) {
383
qemu_progress_print(100, 0);
384
@@ -XXX,XX +XXX,XX @@ out:
385
qemu_opts_del(opts);
386
qemu_opts_free(create_opts);
387
qemu_opts_del(sn_opts);
388
- blk_unref(out_blk);
389
- g_free(bs);
390
- if (blk) {
391
- for (bs_i = 0; bs_i < bs_n; bs_i++) {
392
- blk_unref(blk[bs_i]);
393
+ blk_unref(s.target);
394
+ if (s.src) {
395
+ for (bs_i = 0; bs_i < s.src_num; bs_i++) {
396
+ blk_unref(s.src[bs_i]);
397
}
398
- g_free(blk);
399
+ g_free(s.src);
400
}
401
- g_free(bs_sectors);
402
+ g_free(s.src_sectors);
403
fail_getopt:
404
g_free(options);
405
406
- if (ret) {
407
- return 1;
408
- }
409
- return 0;
410
+ return !!ret;
411
}
412
413
414
--
415
1.8.3.1
416
417
diff view generated by jsdifflib
Deleted patch
1
Commit d35ff5e6 ('block: Ignore guest dev permissions during incoming
2
migration') added blk_resume_after_migration() to the precopy migration
3
path, but neglected to add it to the duplicated code that is used for
4
postcopy migration. This means that the guest device doesn't request the
5
necessary permissions, which ultimately led to failing assertions.
6
1
7
Add the missing blk_resume_after_migration() to the postcopy path.
8
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
---
12
migration/savevm.c | 8 ++++++++
13
1 file changed, 8 insertions(+)
14
15
diff --git a/migration/savevm.c b/migration/savevm.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/migration/savevm.c
18
+++ b/migration/savevm.c
19
@@ -XXX,XX +XXX,XX @@ static void loadvm_postcopy_handle_run_bh(void *opaque)
20
error_report_err(local_err);
21
}
22
23
+ /* If we get an error here, just don't restart the VM yet. */
24
+ blk_resume_after_migration(&local_err);
25
+ if (local_err) {
26
+ error_free(local_err);
27
+ local_err = NULL;
28
+ autostart = false;
29
+ }
30
+
31
trace_loadvm_postcopy_handle_run_cpu_sync();
32
cpu_synchronize_all_post_init();
33
34
--
35
1.8.3.1
36
37
diff view generated by jsdifflib
Deleted patch
1
The only thing the escape characters achieve is making the reference
2
output unreadable and lines that are potentially so long that git
3
doesn't want to put them into an email any more. Let's filter them out.
4
1
5
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
6
Reviewed-by: Eric Blake <eblake@redhat.com>
7
---
8
tests/qemu-iotests/028.out | 2 +-
9
tests/qemu-iotests/051 | 3 +-
10
tests/qemu-iotests/051.out | 106 +++++++++++++++----------------
11
tests/qemu-iotests/051.pc.out | 132 +++++++++++++++++++--------------------
12
tests/qemu-iotests/068 | 4 +-
13
tests/qemu-iotests/068.out | 6 +-
14
tests/qemu-iotests/130.out | 4 +-
15
tests/qemu-iotests/142 | 2 +-
16
tests/qemu-iotests/142.out | 10 +--
17
tests/qemu-iotests/145 | 3 +-
18
tests/qemu-iotests/145.out | 2 +-
19
tests/qemu-iotests/common.filter | 7 +++
20
tests/qemu-iotests/common.qemu | 4 +-
21
13 files changed, 147 insertions(+), 138 deletions(-)
22
23
diff --git a/tests/qemu-iotests/028.out b/tests/qemu-iotests/028.out
24
index XXXXXXX..XXXXXXX 100644
25
--- a/tests/qemu-iotests/028.out
26
+++ b/tests/qemu-iotests/028.out
27
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
28
block-backup
29
30
Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
31
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block-info block-jinfo block-joinfo block-jobinfo block-jobs
32
+(qemu) info block-jobs
33
No active jobs
34
=== IO: pattern 195
35
read 512/512 bytes at offset 3221194240
36
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
37
index XXXXXXX..XXXXXXX 100755
38
--- a/tests/qemu-iotests/051
39
+++ b/tests/qemu-iotests/051
40
@@ -XXX,XX +XXX,XX @@ function do_run_qemu()
41
42
function run_qemu()
43
{
44
- do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_generated_node_ids
45
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu |
46
+ _filter_generated_node_ids | _filter_hmp
47
}
48
49
size=128M
50
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
51
index XXXXXXX..XXXXXXX 100644
52
--- a/tests/qemu-iotests/051.out
53
+++ b/tests/qemu-iotests/051.out
54
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
55
56
Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig,if=none,id=drive0 -nodefaults
57
QEMU X.Y.Z monitor - type 'help' for more information
58
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
59
+(qemu) info block
60
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
61
Removable device: not locked, tray closed
62
Cache mode: writeback
63
Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1)
64
-(qemu) qququiquit
65
+(qemu) quit
66
67
Testing: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig
68
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig: Driver doesn't support backing files
69
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.f
70
71
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
72
QEMU X.Y.Z monitor - type 'help' for more information
73
-(qemu) qququiquit
74
+(qemu) quit
75
76
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
77
QEMU X.Y.Z monitor - type 'help' for more information
78
-(qemu) qququiquit
79
+(qemu) quit
80
81
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=
82
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: Parameter 'lazy-refcounts' expects 'on' or 'off'
83
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: Lazy ref
84
85
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
86
QEMU X.Y.Z monitor - type 'help' for more information
87
-(qemu) qququiquit
88
+(qemu) quit
89
90
91
=== No medium ===
92
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
93
94
Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on
95
QEMU X.Y.Z monitor - type 'help' for more information
96
-(qemu) qququiquit
97
+(qemu) quit
98
99
100
=== Cache modes ===
101
102
Testing: -drive driver=null-co,cache=none
103
QEMU X.Y.Z monitor - type 'help' for more information
104
-(qemu) qququiquit
105
+(qemu) quit
106
107
Testing: -drive driver=null-co,cache=directsync
108
QEMU X.Y.Z monitor - type 'help' for more information
109
-(qemu) qququiquit
110
+(qemu) quit
111
112
Testing: -drive driver=null-co,cache=writeback
113
QEMU X.Y.Z monitor - type 'help' for more information
114
-(qemu) qququiquit
115
+(qemu) quit
116
117
Testing: -drive driver=null-co,cache=writethrough
118
QEMU X.Y.Z monitor - type 'help' for more information
119
-(qemu) qququiquit
120
+(qemu) quit
121
122
Testing: -drive driver=null-co,cache=unsafe
123
QEMU X.Y.Z monitor - type 'help' for more information
124
-(qemu) qququiquit
125
+(qemu) quit
126
127
Testing: -drive driver=null-co,cache=invalid_value
128
QEMU_PROG: -drive driver=null-co,cache=invalid_value: invalid cache option
129
130
Testing: -drive file=TEST_DIR/t.qcow2,cache=writeback,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
131
QEMU X.Y.Z monitor - type 'help' for more information
132
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
133
+(qemu) info block
134
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
135
Removable device: not locked, tray closed
136
Cache mode: writeback
137
Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
138
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block finfo block fiinfo block filinfo block file
139
+(qemu) info block file
140
141
file: TEST_DIR/t.qcow2 (file)
142
Cache mode: writeback
143
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backing
144
+(qemu) info block backing
145
backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
146
Cache mode: writeback, ignore flushes
147
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backinginfo block backing-info block backing-finfo block backing-fiinf
148
o block backing-filinfo block backing-file
149
+(qemu) info block backing-file
150
151
backing-file: TEST_DIR/t.qcow2.base (file, read-only)
152
Cache mode: writeback, ignore flushes
153
-(qemu) qququiquit
154
+(qemu) quit
155
156
Testing: -drive file=TEST_DIR/t.qcow2,cache=writethrough,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
157
QEMU X.Y.Z monitor - type 'help' for more information
158
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
159
+(qemu) info block
160
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
161
Removable device: not locked, tray closed
162
Cache mode: writethrough
163
Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
164
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block finfo block fiinfo block filinfo block file
165
+(qemu) info block file
166
167
file: TEST_DIR/t.qcow2 (file)
168
Cache mode: writeback
169
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backing
170
+(qemu) info block backing
171
backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
172
Cache mode: writeback, ignore flushes
173
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backinginfo block backing-info block backing-finfo block backing-fiinf
174
o block backing-filinfo block backing-file
175
+(qemu) info block backing-file
176
177
backing-file: TEST_DIR/t.qcow2.base (file, read-only)
178
Cache mode: writeback, ignore flushes
179
-(qemu) qququiquit
180
+(qemu) quit
181
182
Testing: -drive file=TEST_DIR/t.qcow2,cache=unsafe,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
183
QEMU X.Y.Z monitor - type 'help' for more information
184
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
185
+(qemu) info block
186
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
187
Removable device: not locked, tray closed
188
Cache mode: writeback, ignore flushes
189
Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
190
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block finfo block fiinfo block filinfo block file
191
+(qemu) info block file
192
193
file: TEST_DIR/t.qcow2 (file)
194
Cache mode: writeback, ignore flushes
195
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backing
196
+(qemu) info block backing
197
backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
198
Cache mode: writeback, ignore flushes
199
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backinginfo block backing-info block backing-finfo block backing-fiinf
200
o block backing-filinfo block backing-file
201
+(qemu) info block backing-file
202
203
backing-file: TEST_DIR/t.qcow2.base (file, read-only)
204
Cache mode: writeback, ignore flushes
205
-(qemu) qququiquit
206
+(qemu) quit
207
208
Testing: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
209
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0: invalid cache option
210
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filenam
211
212
Testing: -drive file=TEST_DIR/t.qcow2,file.driver=file
213
QEMU X.Y.Z monitor - type 'help' for more information
214
-(qemu) qququiquit
215
+(qemu) quit
216
217
218
=== Leaving out required options ===
219
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5: bps/iops/max va
220
221
Testing: -drive file=TEST_DIR/t.qcow2,bps=0
222
QEMU X.Y.Z monitor - type 'help' for more information
223
-(qemu) qququiquit
224
+(qemu) quit
225
226
Testing: -drive file=TEST_DIR/t.qcow2,bps=1
227
QEMU X.Y.Z monitor - type 'help' for more information
228
-(qemu) qququiquit
229
+(qemu) quit
230
231
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000000
232
QEMU X.Y.Z monitor - type 'help' for more information
233
-(qemu) qququiquit
234
+(qemu) quit
235
236
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001
237
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001: bps/iops/max values must be within [0, 1000000000000000]
238
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file.filename=foo:bar: Could not open 'foo:bar': No such file
239
240
Testing: -hda file:TEST_DIR/t.qcow2
241
QEMU X.Y.Z monitor - type 'help' for more information
242
-(qemu) qququiquit
243
+(qemu) quit
244
245
Testing: -drive file=file:TEST_DIR/t.qcow2
246
QEMU X.Y.Z monitor - type 'help' for more information
247
-(qemu) qququiquit
248
+(qemu) quit
249
250
Testing: -drive file.filename=file:TEST_DIR/t.qcow2
251
QEMU_PROG: -drive file.filename=file:TEST_DIR/t.qcow2: Could not open 'file:TEST_DIR/t.qcow2': No such file or directory
252
@@ -XXX,XX +XXX,XX @@ wrote 4096/4096 bytes at offset 0
253
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
254
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
255
QEMU X.Y.Z monitor - type 'help' for more information
256
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
257
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
258
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
259
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
260
wrote 4096/4096 bytes at offset 0
261
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
262
-(qemu) qququiquit
263
+(qemu) quit
264
265
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
266
QEMU X.Y.Z monitor - type 'help' for more information
267
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
268
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
269
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
270
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
271
wrote 4096/4096 bytes at offset 0
272
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
273
-(qemu) qququiquit
274
+(qemu) quit
275
276
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,snapshot=on,if=none,id=drive0
277
QEMU X.Y.Z monitor - type 'help' for more information
278
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
279
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
280
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
281
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
282
wrote 4096/4096 bytes at offset 0
283
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
284
-(qemu) qququiquit
285
+(qemu) quit
286
287
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,if=none,id=drive0 -snapshot
288
QEMU X.Y.Z monitor - type 'help' for more information
289
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
290
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
291
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
292
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
293
wrote 4096/4096 bytes at offset 0
294
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
295
-(qemu) qququiquit
296
+(qemu) quit
297
298
Testing: -drive file=file:TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
299
QEMU X.Y.Z monitor - type 'help' for more information
300
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
301
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
302
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
303
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
304
wrote 4096/4096 bytes at offset 0
305
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
306
-(qemu) qququiquit
307
+(qemu) quit
308
309
Testing: -drive file=file:TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
310
QEMU X.Y.Z monitor - type 'help' for more information
311
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
312
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
313
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
314
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
315
wrote 4096/4096 bytes at offset 0
316
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
317
-(qemu) qququiquit
318
+(qemu) quit
319
320
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
321
QEMU X.Y.Z monitor - type 'help' for more information
322
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
323
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
324
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
325
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
326
wrote 4096/4096 bytes at offset 0
327
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
328
-(qemu) qququiquit
329
+(qemu) quit
330
331
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
332
QEMU X.Y.Z monitor - type 'help' for more information
333
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
334
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
335
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
336
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
337
wrote 4096/4096 bytes at offset 0
338
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
339
-(qemu) qququiquit
340
+(qemu) quit
341
342
read 4096/4096 bytes at offset 0
343
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
344
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=off,if=none,id=drive0
345
QEMU X.Y.Z monitor - type 'help' for more information
346
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
347
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
348
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
349
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
350
wrote 4096/4096 bytes at offset 0
351
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
352
-(qemu) qququiquit
353
+(qemu) quit
354
355
read 4096/4096 bytes at offset 0
356
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
357
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
358
QEMU X.Y.Z monitor - type 'help' for more information
359
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
360
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x3qemu-io drive0 "write -P 0x33qemu-io drive0 "write -P 0x33 qemu-io drive0 "write -P 0x33 0
361
qemu-io drive0 "write -P 0x33 0 qemu-io drive0 "write -P 0x33 0 4qemu-io drive0 "write -P 0x33 0 4kqemu-io drive0 "write -P 0x33 0 4k"
362
+(qemu) qemu-io drive0 "write -P 0x33 0 4k"
363
wrote 4096/4096 bytes at offset 0
364
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
365
-(qemu) ccocomcommcommicommitcommit commit dcommit drcommit dricommit drivcommit drivecommit drive0
366
-(qemu) qququiquit
367
+(qemu) commit drive0
368
+(qemu) quit
369
370
read 4096/4096 bytes at offset 0
371
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
372
diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
373
index XXXXXXX..XXXXXXX 100644
374
--- a/tests/qemu-iotests/051.pc.out
375
+++ b/tests/qemu-iotests/051.pc.out
376
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
377
378
Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig,if=none,id=drive0 -nodefaults
379
QEMU X.Y.Z monitor - type 'help' for more information
380
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
381
+(qemu) info block
382
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
383
Removable device: not locked, tray closed
384
Cache mode: writeback
385
Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1)
386
-(qemu) qququiquit
387
+(qemu) quit
388
389
Testing: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig
390
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig: Driver doesn't support backing files
391
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.f
392
393
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
394
QEMU X.Y.Z monitor - type 'help' for more information
395
-(qemu) qququiquit
396
+(qemu) quit
397
398
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
399
QEMU X.Y.Z monitor - type 'help' for more information
400
-(qemu) qququiquit
401
+(qemu) quit
402
403
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=
404
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: Parameter 'lazy-refcounts' expects 'on' or 'off'
405
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: Lazy ref
406
407
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
408
QEMU X.Y.Z monitor - type 'help' for more information
409
-(qemu) qququiquit
410
+(qemu) quit
411
412
413
=== No medium ===
414
415
Testing: -drive if=floppy
416
QEMU X.Y.Z monitor - type 'help' for more information
417
-(qemu) qququiquit
418
+(qemu) quit
419
420
Testing: -drive if=ide,media=cdrom
421
QEMU X.Y.Z monitor - type 'help' for more information
422
-(qemu) qququiquit
423
+(qemu) quit
424
425
Testing: -drive if=scsi,media=cdrom
426
QEMU X.Y.Z monitor - type 'help' for more information
427
(qemu) QEMU_PROG: -drive if=scsi,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
428
-qququiquit
429
+quit
430
431
Testing: -drive if=ide
432
QEMU X.Y.Z monitor - type 'help' for more information
433
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
434
435
Testing: -drive if=none,id=disk -device ide-cd,drive=disk
436
QEMU X.Y.Z monitor - type 'help' for more information
437
-(qemu) qququiquit
438
+(qemu) quit
439
440
Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk
441
QEMU X.Y.Z monitor - type 'help' for more information
442
-(qemu) qququiquit
443
+(qemu) quit
444
445
Testing: -drive if=none,id=disk -device ide-drive,drive=disk
446
QEMU X.Y.Z monitor - type 'help' for more information
447
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
448
449
Testing: -drive file=TEST_DIR/t.qcow2,if=floppy,readonly=on
450
QEMU X.Y.Z monitor - type 'help' for more information
451
-(qemu) qququiquit
452
+(qemu) quit
453
454
Testing: -drive file=TEST_DIR/t.qcow2,if=ide,media=cdrom,readonly=on
455
QEMU X.Y.Z monitor - type 'help' for more information
456
-(qemu) qququiquit
457
+(qemu) quit
458
459
Testing: -drive file=TEST_DIR/t.qcow2,if=scsi,media=cdrom,readonly=on
460
QEMU X.Y.Z monitor - type 'help' for more information
461
(qemu) QEMU_PROG: -drive file=TEST_DIR/t.qcow2,if=scsi,media=cdrom,readonly=on: warning: bus=0,unit=0 is deprecated with this machine type
462
-qququiquit
463
+quit
464
465
Testing: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on
466
QEMU X.Y.Z monitor - type 'help' for more information
467
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: Initialization of device ide-hd failed: Device initialization failed.
468
Testing: -drive file=TEST_DIR/t.qcow2,if=scsi,readonly=on
469
QEMU X.Y.Z monitor - type 'help' for more information
470
(qemu) QEMU_PROG: -drive file=TEST_DIR/t.qcow2,if=scsi,readonly=on: warning: bus=0,unit=0 is deprecated with this machine type
471
-qququiquit
472
+quit
473
474
Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on
475
QEMU X.Y.Z monitor - type 'help' for more information
476
-(qemu) qququiquit
477
+(qemu) quit
478
479
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-cd,drive=disk
480
QEMU X.Y.Z monitor - type 'help' for more information
481
-(qemu) qququiquit
482
+(qemu) quit
483
484
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk
485
QEMU X.Y.Z monitor - type 'help' for more information
486
-(qemu) qququiquit
487
+(qemu) quit
488
489
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-drive,drive=disk
490
QEMU X.Y.Z monitor - type 'help' for more information
491
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -device ide-hd,drive=disk: Device initialization failed.
492
493
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk
494
QEMU X.Y.Z monitor - type 'help' for more information
495
-(qemu) qququiquit
496
+(qemu) quit
497
498
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk
499
QEMU X.Y.Z monitor - type 'help' for more information
500
-(qemu) qququiquit
501
+(qemu) quit
502
503
504
=== Cache modes ===
505
506
Testing: -drive driver=null-co,cache=none
507
QEMU X.Y.Z monitor - type 'help' for more information
508
-(qemu) qququiquit
509
+(qemu) quit
510
511
Testing: -drive driver=null-co,cache=directsync
512
QEMU X.Y.Z monitor - type 'help' for more information
513
-(qemu) qququiquit
514
+(qemu) quit
515
516
Testing: -drive driver=null-co,cache=writeback
517
QEMU X.Y.Z monitor - type 'help' for more information
518
-(qemu) qququiquit
519
+(qemu) quit
520
521
Testing: -drive driver=null-co,cache=writethrough
522
QEMU X.Y.Z monitor - type 'help' for more information
523
-(qemu) qququiquit
524
+(qemu) quit
525
526
Testing: -drive driver=null-co,cache=unsafe
527
QEMU X.Y.Z monitor - type 'help' for more information
528
-(qemu) qququiquit
529
+(qemu) quit
530
531
Testing: -drive driver=null-co,cache=invalid_value
532
QEMU_PROG: -drive driver=null-co,cache=invalid_value: invalid cache option
533
534
Testing: -drive file=TEST_DIR/t.qcow2,cache=writeback,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
535
QEMU X.Y.Z monitor - type 'help' for more information
536
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
537
+(qemu) info block
538
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
539
Removable device: not locked, tray closed
540
Cache mode: writeback
541
Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
542
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block finfo block fiinfo block filinfo block file
543
+(qemu) info block file
544
545
file: TEST_DIR/t.qcow2 (file)
546
Cache mode: writeback
547
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backing
548
+(qemu) info block backing
549
backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
550
Cache mode: writeback, ignore flushes
551
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backinginfo block backing-info block backing-finfo block backing-fiinf
552
o block backing-filinfo block backing-file
553
+(qemu) info block backing-file
554
555
backing-file: TEST_DIR/t.qcow2.base (file, read-only)
556
Cache mode: writeback, ignore flushes
557
-(qemu) qququiquit
558
+(qemu) quit
559
560
Testing: -drive file=TEST_DIR/t.qcow2,cache=writethrough,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
561
QEMU X.Y.Z monitor - type 'help' for more information
562
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
563
+(qemu) info block
564
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
565
Removable device: not locked, tray closed
566
Cache mode: writethrough
567
Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
568
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block finfo block fiinfo block filinfo block file
569
+(qemu) info block file
570
571
file: TEST_DIR/t.qcow2 (file)
572
Cache mode: writeback
573
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backing
574
+(qemu) info block backing
575
backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
576
Cache mode: writeback, ignore flushes
577
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backinginfo block backing-info block backing-finfo block backing-fiinf
578
o block backing-filinfo block backing-file
579
+(qemu) info block backing-file
580
581
backing-file: TEST_DIR/t.qcow2.base (file, read-only)
582
Cache mode: writeback, ignore flushes
583
-(qemu) qququiquit
584
+(qemu) quit
585
586
Testing: -drive file=TEST_DIR/t.qcow2,cache=unsafe,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
587
QEMU X.Y.Z monitor - type 'help' for more information
588
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo block
589
+(qemu) info block
590
drive0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
591
Removable device: not locked, tray closed
592
Cache mode: writeback, ignore flushes
593
Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
594
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block finfo block fiinfo block filinfo block file
595
+(qemu) info block file
596
597
file: TEST_DIR/t.qcow2 (file)
598
Cache mode: writeback, ignore flushes
599
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backing
600
+(qemu) info block backing
601
backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
602
Cache mode: writeback, ignore flushes
603
-(qemu) iininfinfoinfo info binfo blinfo bloinfo blocinfo blockinfo block info block binfo block bainfo block bacinfo block backinfo block backiinfo block backininfo block backinginfo block backing-info block backing-finfo block backing-fiinf
604
o block backing-filinfo block backing-file
605
+(qemu) info block backing-file
606
607
backing-file: TEST_DIR/t.qcow2.base (file, read-only)
608
Cache mode: writeback, ignore flushes
609
-(qemu) qququiquit
610
+(qemu) quit
611
612
Testing: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
613
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0: invalid cache option
614
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filenam
615
616
Testing: -drive file=TEST_DIR/t.qcow2,file.driver=file
617
QEMU X.Y.Z monitor - type 'help' for more information
618
-(qemu) qququiquit
619
+(qemu) quit
620
621
622
=== Leaving out required options ===
623
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5: bps/iops/max va
624
625
Testing: -drive file=TEST_DIR/t.qcow2,bps=0
626
QEMU X.Y.Z monitor - type 'help' for more information
627
-(qemu) qququiquit
628
+(qemu) quit
629
630
Testing: -drive file=TEST_DIR/t.qcow2,bps=1
631
QEMU X.Y.Z monitor - type 'help' for more information
632
-(qemu) qququiquit
633
+(qemu) quit
634
635
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000000
636
QEMU X.Y.Z monitor - type 'help' for more information
637
-(qemu) qququiquit
638
+(qemu) quit
639
640
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001
641
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001: bps/iops/max values must be within [0, 1000000000000000]
642
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file.filename=foo:bar: Could not open 'foo:bar': No such file
643
644
Testing: -hda file:TEST_DIR/t.qcow2
645
QEMU X.Y.Z monitor - type 'help' for more information
646
-(qemu) qququiquit
647
+(qemu) quit
648
649
Testing: -drive file=file:TEST_DIR/t.qcow2
650
QEMU X.Y.Z monitor - type 'help' for more information
651
-(qemu) qququiquit
652
+(qemu) quit
653
654
Testing: -drive file.filename=file:TEST_DIR/t.qcow2
655
QEMU_PROG: -drive file.filename=file:TEST_DIR/t.qcow2: Could not open 'file:TEST_DIR/t.qcow2': No such file or directory
656
@@ -XXX,XX +XXX,XX @@ wrote 4096/4096 bytes at offset 0
657
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
658
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
659
QEMU X.Y.Z monitor - type 'help' for more information
660
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
661
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
662
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
663
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
664
wrote 4096/4096 bytes at offset 0
665
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
666
-(qemu) qququiquit
667
+(qemu) quit
668
669
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
670
QEMU X.Y.Z monitor - type 'help' for more information
671
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
672
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
673
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
674
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
675
wrote 4096/4096 bytes at offset 0
676
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
677
-(qemu) qququiquit
678
+(qemu) quit
679
680
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,snapshot=on,if=none,id=drive0
681
QEMU X.Y.Z monitor - type 'help' for more information
682
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
683
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
684
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
685
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
686
wrote 4096/4096 bytes at offset 0
687
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
688
-(qemu) qququiquit
689
+(qemu) quit
690
691
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,if=none,id=drive0 -snapshot
692
QEMU X.Y.Z monitor - type 'help' for more information
693
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
694
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
695
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
696
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
697
wrote 4096/4096 bytes at offset 0
698
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
699
-(qemu) qququiquit
700
+(qemu) quit
701
702
Testing: -drive file=file:TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
703
QEMU X.Y.Z monitor - type 'help' for more information
704
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
705
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
706
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
707
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
708
wrote 4096/4096 bytes at offset 0
709
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
710
-(qemu) qququiquit
711
+(qemu) quit
712
713
Testing: -drive file=file:TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
714
QEMU X.Y.Z monitor - type 'help' for more information
715
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
716
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
717
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
718
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
719
wrote 4096/4096 bytes at offset 0
720
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
721
-(qemu) qququiquit
722
+(qemu) quit
723
724
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
725
QEMU X.Y.Z monitor - type 'help' for more information
726
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
727
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
728
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
729
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
730
wrote 4096/4096 bytes at offset 0
731
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
732
-(qemu) qququiquit
733
+(qemu) quit
734
735
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
736
QEMU X.Y.Z monitor - type 'help' for more information
737
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
738
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
739
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
740
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
741
wrote 4096/4096 bytes at offset 0
742
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
743
-(qemu) qququiquit
744
+(qemu) quit
745
746
read 4096/4096 bytes at offset 0
747
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
748
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=off,if=none,id=drive0
749
QEMU X.Y.Z monitor - type 'help' for more information
750
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
751
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x2qemu-io drive0 "write -P 0x22qemu-io drive0 "write -P 0x22 qemu-io drive0 "write -P 0x22 0
752
qemu-io drive0 "write -P 0x22 0 qemu-io drive0 "write -P 0x22 0 4qemu-io drive0 "write -P 0x22 0 4kqemu-io drive0 "write -P 0x22 0 4k"
753
+(qemu) qemu-io drive0 "write -P 0x22 0 4k"
754
wrote 4096/4096 bytes at offset 0
755
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
756
-(qemu) qququiquit
757
+(qemu) quit
758
759
read 4096/4096 bytes at offset 0
760
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
761
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
762
QEMU X.Y.Z monitor - type 'help' for more information
763
-(qemu) qqeqemqemuqemu-qemu-iqemu-ioqemu-io qemu-io dqemu-io drqemu-io driqemu-io drivqemu-io driveqemu-io drive0qemu-io drive0 qemu-io drive0 "qemu-io drive0 "wqemu-io drive0 "wrqemu-io drive0 "wriqemu-io drive0 "writqemu-io drive0 "writeqem
764
u-io drive0 "write qemu-io drive0 "write -qemu-io drive0 "write -Pqemu-io drive0 "write -P qemu-io drive0 "write -P 0qemu-io drive0 "write -P 0xqemu-io drive0 "write -P 0x3qemu-io drive0 "write -P 0x33qemu-io drive0 "write -P 0x33 qemu-io drive0 "write -P 0x33 0
765
qemu-io drive0 "write -P 0x33 0 qemu-io drive0 "write -P 0x33 0 4qemu-io drive0 "write -P 0x33 0 4kqemu-io drive0 "write -P 0x33 0 4k"
766
+(qemu) qemu-io drive0 "write -P 0x33 0 4k"
767
wrote 4096/4096 bytes at offset 0
768
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
769
-(qemu) ccocomcommcommicommitcommit commit dcommit drcommit dricommit drivcommit drivecommit drive0
770
-(qemu) qququiquit
771
+(qemu) commit drive0
772
+(qemu) quit
773
774
read 4096/4096 bytes at offset 0
775
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
776
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
777
index XXXXXXX..XXXXXXX 100755
778
--- a/tests/qemu-iotests/068
779
+++ b/tests/qemu-iotests/068
780
@@ -XXX,XX +XXX,XX @@ esac
781
# Give qemu some time to boot before saving the VM state
782
bash -c 'sleep 1; echo -e "savevm 0\nquit"' |\
783
$QEMU $platform_parm -nographic -monitor stdio -serial none -hda "$TEST_IMG" |\
784
- _filter_qemu
785
+ _filter_qemu | _filter_hmp
786
# Now try to continue from that VM state (this should just work)
787
echo quit |\
788
$QEMU $platform_parm -nographic -monitor stdio -serial none -hda "$TEST_IMG" -loadvm 0 |\
789
- _filter_qemu
790
+ _filter_qemu | _filter_hmp
791
792
# success, all done
793
echo "*** done"
794
diff --git a/tests/qemu-iotests/068.out b/tests/qemu-iotests/068.out
795
index XXXXXXX..XXXXXXX 100644
796
--- a/tests/qemu-iotests/068.out
797
+++ b/tests/qemu-iotests/068.out
798
@@ -XXX,XX +XXX,XX @@ QA output created by 068
799
800
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072
801
QEMU X.Y.Z monitor - type 'help' for more information
802
-(qemu) ssasavsavesavevsavevmsavevm savevm 0
803
-(qemu) qququiquit
804
+(qemu) savevm 0
805
+(qemu) quit
806
QEMU X.Y.Z monitor - type 'help' for more information
807
-(qemu) qququiquit
808
+(qemu) quit
809
*** done
810
diff --git a/tests/qemu-iotests/130.out b/tests/qemu-iotests/130.out
811
index XXXXXXX..XXXXXXX 100644
812
--- a/tests/qemu-iotests/130.out
813
+++ b/tests/qemu-iotests/130.out
814
@@ -XXX,XX +XXX,XX @@ virtual size: 64M (67108864 bytes)
815
=== HMP commit ===
816
817
QEMU X.Y.Z monitor - type 'help' for more information
818
-(qemu) ccocomcommcommicommitcommit commit tcommit tecommit tescommit testcommit testdcommit testdicommit testdiscommit testdisk
819
+(qemu) commit testdisk
820
(qemu)
821
image: TEST_DIR/t.IMGFMT
822
file format: IMGFMT
823
virtual size: 64M (67108864 bytes)
824
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw
825
QEMU X.Y.Z monitor - type 'help' for more information
826
-(qemu) ccocomcommcommicommitcommit commit tcommit tecommit tescommit testcommit testdcommit testdicommit testdiscommit testdisk
827
+(qemu) commit testdisk
828
(qemu)
829
image: TEST_DIR/t.IMGFMT
830
file format: IMGFMT
831
diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
832
index XXXXXXX..XXXXXXX 100755
833
--- a/tests/qemu-iotests/142
834
+++ b/tests/qemu-iotests/142
835
@@ -XXX,XX +XXX,XX @@ function do_run_qemu()
836
837
function run_qemu()
838
{
839
- do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu
840
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp
841
}
842
843
size=128M
844
diff --git a/tests/qemu-iotests/142.out b/tests/qemu-iotests/142.out
845
index XXXXXXX..XXXXXXX 100644
846
--- a/tests/qemu-iotests/142.out
847
+++ b/tests/qemu-iotests/142.out
848
@@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
849
850
Testing: -drive file=TEST_DIR/t.qcow2,cache=none
851
QEMU X.Y.Z monitor - type 'help' for more information
852
-(qemu) qququiquit
853
+(qemu) quit
854
855
Testing: -drive file=TEST_DIR/t.qcow2,cache=directsync
856
QEMU X.Y.Z monitor - type 'help' for more information
857
-(qemu) qququiquit
858
+(qemu) quit
859
860
Testing: -drive file=TEST_DIR/t.qcow2,cache=writeback
861
QEMU X.Y.Z monitor - type 'help' for more information
862
-(qemu) qququiquit
863
+(qemu) quit
864
865
Testing: -drive file=TEST_DIR/t.qcow2,cache=writethrough
866
QEMU X.Y.Z monitor - type 'help' for more information
867
-(qemu) qququiquit
868
+(qemu) quit
869
870
Testing: -drive file=TEST_DIR/t.qcow2,cache=unsafe
871
QEMU X.Y.Z monitor - type 'help' for more information
872
-(qemu) qququiquit
873
+(qemu) quit
874
875
Testing: -drive file=TEST_DIR/t.qcow2,cache=invalid_value
876
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value: invalid cache option
877
diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145
878
index XXXXXXX..XXXXXXX 100755
879
--- a/tests/qemu-iotests/145
880
+++ b/tests/qemu-iotests/145
881
@@ -XXX,XX +XXX,XX @@ _supported_proto generic
882
_supported_os Linux
883
884
_make_test_img 1M
885
-echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snapshot -serial none -monitor stdio | _filter_qemu
886
+echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snapshot -serial none -monitor stdio |
887
+ _filter_qemu | _filter_hmp
888
889
# success, all done
890
echo "*** done"
891
diff --git a/tests/qemu-iotests/145.out b/tests/qemu-iotests/145.out
892
index XXXXXXX..XXXXXXX 100644
893
--- a/tests/qemu-iotests/145.out
894
+++ b/tests/qemu-iotests/145.out
895
@@ -XXX,XX +XXX,XX @@
896
QA output created by 145
897
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
898
QEMU X.Y.Z monitor - type 'help' for more information
899
-(qemu) qququiquit
900
+(qemu) quit
901
*** done
902
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
903
index XXXXXXX..XXXXXXX 100644
904
--- a/tests/qemu-iotests/common.filter
905
+++ b/tests/qemu-iotests/common.filter
906
@@ -XXX,XX +XXX,XX @@ _filter_qmp()
907
-e ' QMP_VERSION'
908
}
909
910
+# readline makes HMP command strings so long that git complains
911
+_filter_hmp()
912
+{
913
+ sed -e $'s/^\\((qemu) \\)\\?.*\e\\[D/\\1/g' \
914
+ -e $'s/\e\\[K//g'
915
+}
916
+
917
# replace block job offset
918
_filter_block_job_offset()
919
{
920
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
921
index XXXXXXX..XXXXXXX 100644
922
--- a/tests/qemu-iotests/common.qemu
923
+++ b/tests/qemu-iotests/common.qemu
924
@@ -XXX,XX +XXX,XX @@ function _timed_wait_for()
925
do
926
if [ -z "${silent}" ]; then
927
echo "${resp}" | _filter_testdir | _filter_qemu \
928
- | _filter_qemu_io | _filter_qmp
929
+ | _filter_qemu_io | _filter_qmp | _filter_hmp
930
fi
931
grep -q "${*}" < <(echo ${resp})
932
if [ $? -eq 0 ]; then
933
@@ -XXX,XX +XXX,XX @@ function _cleanup_qemu()
934
935
if [ -n "${wait}" ]; then
936
cat <&${QEMU_OUT[$i]} | _filter_testdir | _filter_qemu \
937
- | _filter_qemu_io | _filter_qmp
938
+ | _filter_qemu_io | _filter_qmp | _filter_hmp
939
fi
940
rm -f "${QEMU_FIFO_IN}_${i}" "${QEMU_FIFO_OUT}_${i}"
941
eval "exec ${QEMU_IN[$i]}<&-" # close file descriptors
942
--
943
1.8.3.1
944
945
diff view generated by jsdifflib
Deleted patch
1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
3
---
4
tests/qemu-iotests/181 | 119 +++++++++++++++++++++++++++++++++++++++++++++
5
tests/qemu-iotests/181.out | 38 +++++++++++++++
6
tests/qemu-iotests/group | 1 +
7
3 files changed, 158 insertions(+)
8
create mode 100755 tests/qemu-iotests/181
9
create mode 100644 tests/qemu-iotests/181.out
10
1
11
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
12
new file mode 100755
13
index XXXXXXX..XXXXXXX
14
--- /dev/null
15
+++ b/tests/qemu-iotests/181
16
@@ -XXX,XX +XXX,XX @@
17
+#!/bin/bash
18
+#
19
+# Test postcopy live migration with shared storage
20
+#
21
+# Copyright (C) 2017 Red Hat, Inc.
22
+#
23
+# This program is free software; you can redistribute it and/or modify
24
+# it under the terms of the GNU General Public License as published by
25
+# the Free Software Foundation; either version 2 of the License, or
26
+# (at your option) any later version.
27
+#
28
+# This program is distributed in the hope that it will be useful,
29
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
30
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
+# GNU General Public License for more details.
32
+#
33
+# You should have received a copy of the GNU General Public License
34
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
35
+#
36
+
37
+# creator
38
+owner=kwolf@redhat.com
39
+
40
+seq=`basename $0`
41
+echo "QA output created by $seq"
42
+
43
+here=`pwd`
44
+status=1    # failure is the default!
45
+
46
+MIG_SOCKET="${TEST_DIR}/migrate"
47
+
48
+_cleanup()
49
+{
50
+ rm -f "${MIG_SOCKET}"
51
+    _cleanup_test_img
52
+ _cleanup_qemu
53
+}
54
+trap "_cleanup; exit \$status" 0 1 2 3 15
55
+
56
+# get standard environment, filters and checks
57
+. ./common.rc
58
+. ./common.filter
59
+. ./common.qemu
60
+
61
+_supported_fmt generic
62
+_supported_proto generic
63
+_supported_os Linux
64
+
65
+size=64M
66
+_make_test_img $size
67
+
68
+echo
69
+echo === Starting VMs ===
70
+echo
71
+
72
+qemu_comm_method="monitor"
73
+
74
+_launch_qemu \
75
+ -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk
76
+src=$QEMU_HANDLE
77
+
78
+_launch_qemu \
79
+ -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \
80
+ -incoming "unix:${MIG_SOCKET}"
81
+dest=$QEMU_HANDLE
82
+
83
+echo
84
+echo === Write something on the source ===
85
+echo
86
+
87
+silent=
88
+_send_qemu_cmd $src 'qemu-io disk "write -P 0x55 0 64k"' "(qemu)"
89
+_send_qemu_cmd $src "" "ops/sec"
90
+_send_qemu_cmd $src 'qemu-io disk "read -P 0x55 0 64k"' "(qemu)"
91
+_send_qemu_cmd $src "" "ops/sec"
92
+
93
+echo
94
+echo === Do postcopy migration to destination ===
95
+echo
96
+
97
+# Slow down migration so much that it definitely won't finish before we can
98
+# switch to postcopy
99
+silent=yes
100
+_send_qemu_cmd $src 'migrate_set_speed 4k' "(qemu)"
101
+_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
102
+_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
103
+_send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)"
104
+
105
+QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \
106
+ _send_qemu_cmd $src "info migrate" "completed\|failed"
107
+silent=yes _send_qemu_cmd $src "" "(qemu)"
108
+
109
+echo
110
+echo === Do some I/O on the destination ===
111
+echo
112
+
113
+# It is important that we use the BlockBackend of the guest device here instead
114
+# of the node name, which would create a new BlockBackend and not test whether
115
+# the guest has the necessary permissions to access the image now
116
+silent=
117
+_send_qemu_cmd $dest 'qemu-io disk "read -P 0x55 0 64k"' "(qemu)"
118
+_send_qemu_cmd $dest "" "ops/sec"
119
+_send_qemu_cmd $dest 'qemu-io disk "write -P 0x66 1M 64k"' "(qemu)"
120
+_send_qemu_cmd $dest "" "ops/sec"
121
+
122
+echo
123
+echo === Shut down and check image ===
124
+echo
125
+
126
+_send_qemu_cmd $src 'quit' ""
127
+_send_qemu_cmd $dest 'quit' ""
128
+wait=1 _cleanup_qemu
129
+
130
+_check_test_img
131
+
132
+# success, all done
133
+echo "*** done"
134
+rm -f $seq.full
135
+status=0
136
diff --git a/tests/qemu-iotests/181.out b/tests/qemu-iotests/181.out
137
new file mode 100644
138
index XXXXXXX..XXXXXXX
139
--- /dev/null
140
+++ b/tests/qemu-iotests/181.out
141
@@ -XXX,XX +XXX,XX @@
142
+QA output created by 181
143
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
144
+
145
+=== Starting VMs ===
146
+
147
+
148
+=== Write something on the source ===
149
+
150
+QEMU X.Y.Z monitor - type 'help' for more information
151
+(qemu) qemu-io disk "write -P 0x55 0 64k"
152
+wrote 65536/65536 bytes at offset 0
153
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
154
+(qemu)
155
+(qemu) qemu-io disk "read -P 0x55 0 64k"
156
+read 65536/65536 bytes at offset 0
157
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
158
+
159
+=== Do postcopy migration to destination ===
160
+
161
+
162
+=== Do some I/O on the destination ===
163
+
164
+QEMU X.Y.Z monitor - type 'help' for more information
165
+(qemu) qemu-io disk "read -P 0x55 0 64k"
166
+read 65536/65536 bytes at offset 0
167
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
168
+(qemu)
169
+(qemu) qemu-io disk "write -P 0x66 1M 64k"
170
+wrote 65536/65536 bytes at offset 1048576
171
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
172
+
173
+=== Shut down and check image ===
174
+
175
+(qemu) quit
176
+(qemu)
177
+(qemu) quit
178
+No errors were found on the image.
179
+*** done
180
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
181
index XXXXXXX..XXXXXXX 100644
182
--- a/tests/qemu-iotests/group
183
+++ b/tests/qemu-iotests/group
184
@@ -XXX,XX +XXX,XX @@
185
174 auto
186
175 auto quick
187
176 rw auto backing
188
+181 rw auto migration
189
--
190
1.8.3.1
191
192
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Reproducer:
4
$ ./qemu-img info ''
5
qemu-img: ./block.c:1008: bdrv_open_driver: Assertion
6
`!drv->bdrv_needs_filename || bs->filename[0]' failed.
7
[1] 26105 abort (core dumped) ./qemu-img info ''
8
9
This patch fixes this to be:
10
$ ./qemu-img info ''
11
qemu-img: Could not open '': The 'file' block driver requires a file
12
name
13
14
Cc: qemu-stable <qemu-stable@nongnu.org>
15
Signed-off-by: Max Reitz <mreitz@redhat.com>
16
Reviewed-by: Eric Blake <eblake@redhat.com>
17
Reviewed-by: Fam Zheng <famz@redhat.com>
18
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
19
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
20
---
21
block.c | 2 +-
22
1 file changed, 1 insertion(+), 1 deletion(-)
23
24
diff --git a/block.c b/block.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/block.c
27
+++ b/block.c
28
@@ -XXX,XX +XXX,XX @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
29
filename = qdict_get_try_str(options, "filename");
30
}
31
32
- if (drv->bdrv_needs_filename && !filename) {
33
+ if (drv->bdrv_needs_filename && (!filename || !filename[0])) {
34
error_setg(errp, "The '%s' block driver requires a file name",
35
drv->format_name);
36
ret = -EINVAL;
37
--
38
1.8.3.1
39
40
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Signed-off-by: Max Reitz <mreitz@redhat.com>
4
Reviewed-by: Eric Blake <eblake@redhat.com>
5
Reviewed-by: Fam Zheng <famz@redhat.com>
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
8
tests/qemu-iotests/051 | 1 +
9
tests/qemu-iotests/051.out | 3 +++
10
tests/qemu-iotests/051.pc.out | 3 +++
11
3 files changed, 7 insertions(+)
12
13
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
14
index XXXXXXX..XXXXXXX 100755
15
--- a/tests/qemu-iotests/051
16
+++ b/tests/qemu-iotests/051
17
@@ -XXX,XX +XXX,XX @@ echo === Leaving out required options ===
18
echo
19
20
run_qemu -drive driver=file
21
+run_qemu -drive driver=file,filename=
22
run_qemu -drive driver=nbd
23
run_qemu -drive driver=raw
24
run_qemu -drive file.driver=file
25
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
26
index XXXXXXX..XXXXXXX 100644
27
--- a/tests/qemu-iotests/051.out
28
+++ b/tests/qemu-iotests/051.out
29
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
30
Testing: -drive driver=file
31
QEMU_PROG: -drive driver=file: The 'file' block driver requires a file name
32
33
+Testing: -drive driver=file,filename=
34
+QEMU_PROG: -drive driver=file,filename=: The 'file' block driver requires a file name
35
+
36
Testing: -drive driver=nbd
37
QEMU_PROG: -drive driver=nbd: NBD server address missing
38
39
diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
40
index XXXXXXX..XXXXXXX 100644
41
--- a/tests/qemu-iotests/051.pc.out
42
+++ b/tests/qemu-iotests/051.pc.out
43
@@ -XXX,XX +XXX,XX @@ QEMU X.Y.Z monitor - type 'help' for more information
44
Testing: -drive driver=file
45
QEMU_PROG: -drive driver=file: The 'file' block driver requires a file name
46
47
+Testing: -drive driver=file,filename=
48
+QEMU_PROG: -drive driver=file,filename=: The 'file' block driver requires a file name
49
+
50
Testing: -drive driver=nbd
51
QEMU_PROG: -drive driver=nbd: NBD server address missing
52
53
--
54
1.8.3.1
55
56
diff view generated by jsdifflib
Deleted patch
1
We test for the presence of perl and bc and save their path in the
2
variables PERL_PROG and BC_PROG, but never actually make use of them.
3
Remove the checks and assignments so qemu-iotests can run even when
4
bc isn't installed.
5
1
6
Reported-by: Yash Mankad <ymankad@redhat.com>
7
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Reviewed-by: Eric Blake <eblake@redhat.com>
9
Reviewed-by: Fam Zheng <famz@redhat.com>
10
---
11
tests/qemu-iotests/common.config | 6 ------
12
1 file changed, 6 deletions(-)
13
14
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
15
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qemu-iotests/common.config
17
+++ b/tests/qemu-iotests/common.config
18
@@ -XXX,XX +XXX,XX @@ _fatal()
19
exit 1
20
}
21
22
-export PERL_PROG="`set_prog_path perl`"
23
-[ "$PERL_PROG" = "" ] && _fatal "perl not found"
24
-
25
export AWK_PROG="`set_prog_path awk`"
26
[ "$AWK_PROG" = "" ] && _fatal "awk not found"
27
28
export SED_PROG="`set_prog_path sed`"
29
[ "$SED_PROG" = "" ] && _fatal "sed not found"
30
31
-export BC_PROG="`set_prog_path bc`"
32
-[ "$BC_PROG" = "" ] && _fatal "bc not found"
33
-
34
export PS_ALL_FLAGS="-ef"
35
36
if [ -z "$QEMU_PROG" ]; then
37
--
38
1.8.3.1
39
40
diff view generated by jsdifflib
Deleted patch
1
It is unused.
2
1
3
Suggested-by: Fam Zheng <famz@redhat.com>
4
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5
Reviewed-by: Max Reitz <mreitz@redhat.com>
6
Reviewed-by: Eric Blake <eblake@redhat.com>
7
Reviewed-by: Fam Zheng <famz@redhat.com>
8
---
9
tests/qemu-iotests/common.config | 18 ------------------
10
1 file changed, 18 deletions(-)
11
12
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
13
index XXXXXXX..XXXXXXX 100644
14
--- a/tests/qemu-iotests/common.config
15
+++ b/tests/qemu-iotests/common.config
16
@@ -XXX,XX +XXX,XX @@ fi
17
18
export SAMPLE_IMG_DIR
19
20
-_readlink()
21
-{
22
- if [ $# -ne 1 ]; then
23
- echo "Usage: _readlink filename" 1>&2
24
- exit 1
25
- fi
26
-
27
- perl -e "\$in=\"$1\";" -e '
28
- $lnk = readlink($in);
29
- if ($lnk =~ m!^/.*!) {
30
- print "$lnk\n";
31
- }
32
- else {
33
- chomp($dir = `dirname $in`);
34
- print "$dir/$lnk\n";
35
- }'
36
-}
37
-
38
# make sure this script returns success
39
true
40
--
41
1.8.3.1
42
43
diff view generated by jsdifflib
Deleted patch
1
From: Fam Zheng <famz@redhat.com>
2
1
3
Reported by Coverity. We already use bs in bdrv_inc_in_flight before
4
checking for NULL. It is unnecessary as all callers pass non-NULL bs, so
5
drop it.
6
7
Signed-off-by: Fam Zheng <famz@redhat.com>
8
Reviewed-by: Max Reitz <mreitz@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
11
block/io.c | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
13
14
diff --git a/block/io.c b/block/io.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/block/io.c
17
+++ b/block/io.c
18
@@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
19
20
bdrv_inc_in_flight(bs);
21
22
- if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
23
+ if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
24
bdrv_is_sg(bs)) {
25
goto early_exit;
26
}
27
--
28
1.8.3.1
29
30
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
There is no reason for the qemu-nbd server used for tests not to accept
4
an arbitrary number of clients. In fact, test 181 will require it to
5
accept two clients at the same time (and thus it fails before this
6
patch).
7
8
This patch updates common.rc to launch qemu-nbd with -e 42 which should
9
be enough for all of our current and future tests.
10
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
Reviewed-by: Eric Blake <eblake@redhat.com>
13
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14
---
15
tests/qemu-iotests/common.rc | 4 +++-
16
1 file changed, 3 insertions(+), 1 deletion(-)
17
18
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
19
index XXXXXXX..XXXXXXX 100644
20
--- a/tests/qemu-iotests/common.rc
21
+++ b/tests/qemu-iotests/common.rc
22
@@ -XXX,XX +XXX,XX @@ _make_test_img()
23
24
# Start an NBD server on the image file, which is what we'll be talking to
25
if [ $IMGPROTO = "nbd" ]; then
26
- eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 -f $IMGFMT $TEST_IMG_FILE >/dev/null &"
27
+ # Pass a sufficiently high number to -e that should be enough for all
28
+ # tests
29
+ eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 -f $IMGFMT -e 42 $TEST_IMG_FILE >/dev/null &"
30
sleep 1 # FIXME: qemu-nbd needs to be listening before we continue
31
fi
32
33
--
34
1.8.3.1
35
36
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
If the user needs to specify the disk geometry, the corresponding
4
parameters of the "-device ide-hd" option should be used instead.
5
"-hdachs" is considered as deprecated and might be removed soon.
6
7
Signed-off-by: Thomas Huth <thuth@redhat.com>
8
Reviewed-by: Eric Blake <eblake@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
11
qemu-options.hx | 4 ++--
12
vl.c | 2 ++
13
2 files changed, 4 insertions(+), 2 deletions(-)
14
15
diff --git a/qemu-options.hx b/qemu-options.hx
16
index XXXXXXX..XXXXXXX 100644
17
--- a/qemu-options.hx
18
+++ b/qemu-options.hx
19
@@ -XXX,XX +XXX,XX @@ STEXI
20
Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
21
@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
22
translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
23
-all those parameters. This option is useful for old MS-DOS disk
24
-images.
25
+all those parameters. This option is deprecated, please use
26
+@code{-device ide-hd,cyls=c,heads=h,secs=s,...} instead.
27
ETEXI
28
29
DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
30
diff --git a/vl.c b/vl.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/vl.c
33
+++ b/vl.c
34
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp)
35
}
36
}
37
}
38
+ error_report("'-hdachs' is deprecated, please use '-device"
39
+ " ide-hd,cyls=c,heads=h,secs=s,...' instead");
40
break;
41
case QEMU_OPTION_numa:
42
opts = qemu_opts_parse_noisily(qemu_find_opts("numa"),
43
--
44
1.8.3.1
45
46
diff view generated by jsdifflib
Deleted patch
1
From: Eric Blake <eblake@redhat.com>
2
1
3
s/refcout/refcount/
4
5
CC: qemu-trivial@nongnu.org
6
Signed-off-by: Eric Blake <eblake@redhat.com>
7
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9
---
10
tests/qemu-iotests/026 | 2 +-
11
tests/qemu-iotests/026.out | 2 +-
12
tests/qemu-iotests/026.out.nocache | 2 +-
13
3 files changed, 3 insertions(+), 3 deletions(-)
14
15
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
16
index XXXXXXX..XXXXXXX 100755
17
--- a/tests/qemu-iotests/026
18
+++ b/tests/qemu-iotests/026
19
@@ -XXX,XX +XXX,XX @@ done
20
21
22
echo
23
-echo === Refcout table growth tests ===
24
+echo === Refcount table growth tests ===
25
echo
26
CLUSTER_SIZE=512
27
28
diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out
29
index XXXXXXX..XXXXXXX 100644
30
--- a/tests/qemu-iotests/026.out
31
+++ b/tests/qemu-iotests/026.out
32
@@ -XXX,XX +XXX,XX @@ Event: cluster_alloc; errno: 28; imm: off; once: off; write -b
33
write failed: No space left on device
34
No errors were found on the image.
35
36
-=== Refcout table growth tests ===
37
+=== Refcount table growth tests ===
38
39
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
40
41
diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache
42
index XXXXXXX..XXXXXXX 100644
43
--- a/tests/qemu-iotests/026.out.nocache
44
+++ b/tests/qemu-iotests/026.out.nocache
45
@@ -XXX,XX +XXX,XX @@ Event: cluster_alloc; errno: 28; imm: off; once: off; write -b
46
write failed: No space left on device
47
No errors were found on the image.
48
49
-=== Refcout table growth tests ===
50
+=== Refcount table growth tests ===
51
52
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
53
54
--
55
1.8.3.1
56
57
diff view generated by jsdifflib
Deleted patch
1
From: Fam Zheng <famz@redhat.com>
2
1
3
Mirror calculates job len from current I/O progress:
4
5
s->common.len = s->common.offset +
6
(cnt + s->sectors_in_flight) * BDRV_SECTOR_SIZE;
7
8
The final "len" of a failed mirror job in iotests 109 depends on the
9
subtle timing of the completion of read and write issued in the first
10
mirror iteration. The second iteration may or may not have run when the
11
I/O error happens, resulting in non-deterministic output of the
12
BLOCK_JOB_COMPLETED event text.
13
14
Similar to what was done in a752e4786, filter out the field to make the
15
test robust.
16
17
Signed-off-by: Fam Zheng <famz@redhat.com>
18
Reviewed-by: Eric Blake <eblake@redhat.com>
19
Tested-by: Eric Blake <eblake@redhat.com>
20
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
21
---
22
tests/qemu-iotests/109 | 6 ++++--
23
tests/qemu-iotests/109.out | 20 ++++++++++----------
24
tests/qemu-iotests/common.filter | 6 ++++++
25
3 files changed, 20 insertions(+), 12 deletions(-)
26
27
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
28
index XXXXXXX..XXXXXXX 100755
29
--- a/tests/qemu-iotests/109
30
+++ b/tests/qemu-iotests/109
31
@@ -XXX,XX +XXX,XX @@ for fmt in qcow qcow2 qed vdi vmdk vpc; do
32
33
# This first test should fail: The image format was probed, we may not
34
# write an image header at the start of the image
35
- run_qemu "$TEST_IMG" "$TEST_IMG.src" "" "BLOCK_JOB_ERROR"
36
+ run_qemu "$TEST_IMG" "$TEST_IMG.src" "" "BLOCK_JOB_ERROR" |
37
+ _filter_block_job_len
38
$QEMU_IO -c 'read -P 0 0 64k' "$TEST_IMG" | _filter_qemu_io
39
40
41
@@ -XXX,XX +XXX,XX @@ for sample_img in empty.bochs iotest-dirtylog-10G-4M.vhdx parallels-v1 \
42
_make_test_img 64M
43
bzcat "$SAMPLE_IMG_DIR/$sample_img.bz2" > "$TEST_IMG.src"
44
45
- run_qemu "$TEST_IMG" "$TEST_IMG.src" "" "BLOCK_JOB_ERROR" | _filter_block_job_offset
46
+ run_qemu "$TEST_IMG" "$TEST_IMG.src" "" "BLOCK_JOB_ERROR" |
47
+ _filter_block_job_offset | _filter_block_job_len
48
$QEMU_IO -c 'read -P 0 0 64k' "$TEST_IMG" | _filter_qemu_io
49
50
run_qemu "$TEST_IMG" "$TEST_IMG.src" "'format': 'raw'," "BLOCK_JOB_READY"
51
diff --git a/tests/qemu-iotests/109.out b/tests/qemu-iotests/109.out
52
index XXXXXXX..XXXXXXX 100644
53
--- a/tests/qemu-iotests/109.out
54
+++ b/tests/qemu-iotests/109.out
55
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
56
Specify the 'raw' format explicitly to remove the restrictions.
57
{"return": {}}
58
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
59
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
60
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
61
{"return": []}
62
read 65536/65536 bytes at offset 0
63
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
64
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
65
Specify the 'raw' format explicitly to remove the restrictions.
66
{"return": {}}
67
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
68
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 197120, "offset": 512, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
69
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": 512, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
70
{"return": []}
71
read 65536/65536 bytes at offset 0
72
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
73
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
74
Specify the 'raw' format explicitly to remove the restrictions.
75
{"return": {}}
76
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
77
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 327680, "offset": 262144, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
78
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": 262144, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
79
{"return": []}
80
read 65536/65536 bytes at offset 0
81
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
82
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
83
Specify the 'raw' format explicitly to remove the restrictions.
84
{"return": {}}
85
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
86
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
87
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
88
{"return": []}
89
read 65536/65536 bytes at offset 0
90
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
91
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
92
Specify the 'raw' format explicitly to remove the restrictions.
93
{"return": {}}
94
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
95
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
96
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
97
{"return": []}
98
read 65536/65536 bytes at offset 0
99
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
100
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
101
Specify the 'raw' format explicitly to remove the restrictions.
102
{"return": {}}
103
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
104
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
105
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
106
{"return": []}
107
read 65536/65536 bytes at offset 0
108
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
109
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
110
Specify the 'raw' format explicitly to remove the restrictions.
111
{"return": {}}
112
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
113
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
114
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
115
{"return": []}
116
read 65536/65536 bytes at offset 0
117
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
118
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
119
Specify the 'raw' format explicitly to remove the restrictions.
120
{"return": {}}
121
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
122
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 31457280, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
123
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
124
{"return": []}
125
read 65536/65536 bytes at offset 0
126
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
127
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
128
Specify the 'raw' format explicitly to remove the restrictions.
129
{"return": {}}
130
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
131
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 327680, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
132
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
133
{"return": []}
134
read 65536/65536 bytes at offset 0
135
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
136
@@ -XXX,XX +XXX,XX @@ Automatically detecting the format is dangerous for raw images, write operations
137
Specify the 'raw' format explicitly to remove the restrictions.
138
{"return": {}}
139
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
140
-{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
141
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": LEN, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
142
{"return": []}
143
read 65536/65536 bytes at offset 0
144
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
145
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
146
index XXXXXXX..XXXXXXX 100644
147
--- a/tests/qemu-iotests/common.filter
148
+++ b/tests/qemu-iotests/common.filter
149
@@ -XXX,XX +XXX,XX @@ _filter_block_job_offset()
150
sed -e 's/, "offset": [0-9]\+,/, "offset": OFFSET,/'
151
}
152
153
+# replace block job len
154
+_filter_block_job_len()
155
+{
156
+ sed -e 's/, "len": [0-9]\+,/, "len": LEN,/g'
157
+}
158
+
159
# replace driver-specific options in the "Formatting..." line
160
_filter_img_create()
161
{
162
--
163
1.8.3.1
164
165
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
The block layer takes care of removing the bs->file child if the block
4
driver's bdrv_open()/bdrv_file_open() implementation fails. The block
5
driver therefore does not need to do so, and indeed should not unless it
6
sets bs->file to NULL afterwards -- because if this is not done, the
7
bdrv_unref_child() in bdrv_open_inherit() will dereference the freed
8
memory block at bs->file afterwards, which is not good.
9
10
We can now decide whether to add a "bs->file = NULL;" after each of the
11
offending bdrv_unref_child() invocations, or just drop them altogether.
12
The latter is simpler, so let's do that.
13
14
Cc: qemu-stable <qemu-stable@nongnu.org>
15
Signed-off-by: Max Reitz <mreitz@redhat.com>
16
Reviewed-by: Eric Blake <eblake@redhat.com>
17
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
18
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
19
---
20
block/blkdebug.c | 4 +---
21
block/blkreplay.c | 3 ---
22
block/blkverify.c | 3 ---
23
3 files changed, 1 insertion(+), 9 deletions(-)
24
25
diff --git a/block/blkdebug.c b/block/blkdebug.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/block/blkdebug.c
28
+++ b/block/blkdebug.c
29
@@ -XXX,XX +XXX,XX @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
30
} else if (align) {
31
error_setg(errp, "Invalid alignment");
32
ret = -EINVAL;
33
- goto fail_unref;
34
+ goto out;
35
}
36
37
ret = 0;
38
goto out;
39
40
-fail_unref:
41
- bdrv_unref_child(bs, bs->file);
42
out:
43
if (ret < 0) {
44
g_free(s->config_file);
45
diff --git a/block/blkreplay.c b/block/blkreplay.c
46
index XXXXXXX..XXXXXXX 100755
47
--- a/block/blkreplay.c
48
+++ b/block/blkreplay.c
49
@@ -XXX,XX +XXX,XX @@ static int blkreplay_open(BlockDriverState *bs, QDict *options, int flags,
50
51
ret = 0;
52
fail:
53
- if (ret < 0) {
54
- bdrv_unref_child(bs, bs->file);
55
- }
56
return ret;
57
}
58
59
diff --git a/block/blkverify.c b/block/blkverify.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/block/blkverify.c
62
+++ b/block/blkverify.c
63
@@ -XXX,XX +XXX,XX @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
64
65
ret = 0;
66
fail:
67
- if (ret < 0) {
68
- bdrv_unref_child(bs, bs->file);
69
- }
70
qemu_opts_del(opts);
71
return ret;
72
}
73
--
74
1.8.3.1
75
76
diff view generated by jsdifflib
Deleted patch
1
From: "Denis V. Lunev" <den@openvz.org>
2
1
3
tail_padding_bytes is calculated wrong. F.e. for
4
offset = 0
5
bytes = 2048
6
align = 512
7
we will have tail_padding_bytes = 512 which is definitely wrong. The patch
8
fixes that arithmetics.
9
10
Fortunately this problem is harmless, we will have 1 extra allocation and
11
free thus there is no need to put this into stable. The problem is here
12
from the very beginning.
13
14
Signed-off-by: Denis V. Lunev <den@openvz.org>
15
CC: Stefan Hajnoczi <stefanha@redhat.com>
16
CC: Fam Zheng <famz@redhat.com>
17
Reviewed-by: Eric Blake <eblake@redhat.com>
18
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
19
---
20
block/io.c | 2 +-
21
1 file changed, 1 insertion(+), 1 deletion(-)
22
23
diff --git a/block/io.c b/block/io.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/block/io.c
26
+++ b/block/io.c
27
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild *child,
28
int ret = 0;
29
30
head_padding_bytes = offset & (align - 1);
31
- tail_padding_bytes = align - ((offset + bytes) & (align - 1));
32
+ tail_padding_bytes = (align - (offset + bytes)) & (align - 1);
33
34
35
assert(flags & BDRV_REQ_ZERO_WRITE);
36
--
37
1.8.3.1
38
39
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
After storing the creation options for the new image into @opts, we
4
fetch some things for our own information, like the backing file name,
5
or whether to use encryption or preallocation.
6
7
With the -n parameter, there will not be any creation options; this is
8
not too bad because this just means that querying a NULL @opts will
9
always return the default value.
10
11
However, we also use @opts for the --object options. Therefore, @opts is
12
not necessarily NULL if -n was specified; instead, it may contain those
13
options. In practice, this probably does not cause any problems because
14
there most likely is no object that supports any of the parameters we
15
query here, but this is neither something we should rely on nor does
16
this variable reuse make the code very nice to read.
17
18
Therefore, just use a separate variable for the --object options.
19
20
Signed-off-by: Max Reitz <mreitz@redhat.com>
21
Reviewed-by: Eric Blake <eblake@redhat.com>
22
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
23
---
24
qemu-img.c | 10 ++++++----
25
1 file changed, 6 insertions(+), 4 deletions(-)
26
27
diff --git a/qemu-img.c b/qemu-img.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/qemu-img.c
30
+++ b/qemu-img.c
31
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
32
case 'W':
33
s.wr_in_order = false;
34
break;
35
- case OPTION_OBJECT:
36
- opts = qemu_opts_parse_noisily(&qemu_object_opts,
37
- optarg, true);
38
- if (!opts) {
39
+ case OPTION_OBJECT: {
40
+ QemuOpts *object_opts;
41
+ object_opts = qemu_opts_parse_noisily(&qemu_object_opts,
42
+ optarg, true);
43
+ if (!object_opts) {
44
goto fail_getopt;
45
}
46
break;
47
+ }
48
case OPTION_IMAGE_OPTS:
49
image_opts = true;
50
break;
51
--
52
1.8.3.1
53
54
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
It does not make much sense to use a backing image for the target when
4
you concatenate multiple images (because then there is no correspondence
5
between the source images' backing files and the target's); but it was
6
still possible to give one by using -o backing_file=X instead of -B X.
7
8
Fix this by moving the check.
9
10
(Also, change the error message because -B is not the only way to
11
specify the backing file, evidently.)
12
13
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
Reviewed-by: Eric Blake <eblake@redhat.com>
15
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
16
---
17
qemu-img.c | 13 +++++++------
18
tests/qemu-iotests/122.out | 4 ++--
19
2 files changed, 9 insertions(+), 8 deletions(-)
20
21
diff --git a/qemu-img.c b/qemu-img.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/qemu-img.c
24
+++ b/qemu-img.c
25
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
26
}
27
28
29
- if (s.src_num > 1 && out_baseimg) {
30
- error_report("-B makes no sense when concatenating multiple input "
31
- "images");
32
- goto fail_getopt;
33
- }
34
-
35
/* ret is still -EINVAL until here */
36
ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
37
if (ret < 0) {
38
@@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv)
39
}
40
s.target_has_backing = (bool) out_baseimg;
41
42
+ if (s.src_num > 1 && out_baseimg) {
43
+ error_report("Having a backing file for the target makes no sense when "
44
+ "concatenating multiple input images");
45
+ ret = -1;
46
+ goto out;
47
+ }
48
+
49
/* Check if compression is supported */
50
if (s.compressed) {
51
bool encryption =
52
diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out
53
index XXXXXXX..XXXXXXX 100644
54
--- a/tests/qemu-iotests/122.out
55
+++ b/tests/qemu-iotests/122.out
56
@@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 4194304
57
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
58
read 65536/65536 bytes at offset 8388608
59
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
60
-qemu-img: -B makes no sense when concatenating multiple input images
61
-qemu-img: -B makes no sense when concatenating multiple input images
62
+qemu-img: Having a backing file for the target makes no sense when concatenating multiple input images
63
+qemu-img: Having a backing file for the target makes no sense when concatenating multiple input images
64
65
=== Compression with misaligned allocations and image sizes ===
66
67
--
68
1.8.3.1
69
70
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
The create and convert subcommands have shorthands to set the
4
backing_file and, in the case of create, the backing_fmt options for the
5
new image. However, they have not been documented so far, which is
6
remedied by this patch.
7
8
Reported-by: Eric Blake <eblake@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
---
13
qemu-img-cmds.hx | 8 ++++----
14
qemu-img.texi | 4 ++--
15
2 files changed, 6 insertions(+), 6 deletions(-)
16
17
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
18
index XXXXXXX..XXXXXXX 100644
19
--- a/qemu-img-cmds.hx
20
+++ b/qemu-img-cmds.hx
21
@@ -XXX,XX +XXX,XX @@ STEXI
22
ETEXI
23
24
DEF("create", img_create,
25
- "create [-q] [--object objectdef] [-f fmt] [-o options] filename [size]")
26
+ "create [-q] [--object objectdef] [-f fmt] [-b backing_file] [-F backing_fmt] [-o options] filename [size]")
27
STEXI
28
-@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-o @var{options}] @var{filename} [@var{size}]
29
+@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-o @var{options}] @var{filename} [@var{size}]
30
ETEXI
31
32
DEF("commit", img_commit,
33
@@ -XXX,XX +XXX,XX @@ STEXI
34
ETEXI
35
36
DEF("convert", img_convert,
37
- "convert [--object objectdef] [--image-opts] [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-o options] [-s snapshot_id_or_name] [-l snapshot_param] [-S sparse_size] [-m num_coroutines] [-W] filename [filename2 [...]] output_filename")
38
+ "convert [--object objectdef] [--image-opts] [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-B backing_file] [-o options] [-s snapshot_id_or_name] [-l snapshot_param] [-S sparse_size] [-m num_coroutines] [-W] filename [filename2 [...]] output_filename")
39
STEXI
40
-@item convert [--object @var{objectdef}] [--image-opts] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W] @var{filename} [@var{filename2} [...]] @var{output_filename}
41
+@item convert [--object @var{objectdef}] [--image-opts] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W] @var{filename} [@var{filename2} [...]] @var{output_filename}
42
ETEXI
43
44
DEF("dd", img_dd,
45
diff --git a/qemu-img.texi b/qemu-img.texi
46
index XXXXXXX..XXXXXXX 100644
47
--- a/qemu-img.texi
48
+++ b/qemu-img.texi
49
@@ -XXX,XX +XXX,XX @@ If @code{-r} is specified, exit codes representing the image state refer to the
50
state after (the attempt at) repairing it. That is, a successful @code{-r all}
51
will yield the exit code 0, independently of the image state before.
52
53
-@item create [-f @var{fmt}] [-o @var{options}] @var{filename} [@var{size}]
54
+@item create [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-o @var{options}] @var{filename} [@var{size}]
55
56
Create the new disk image @var{filename} of size @var{size} and format
57
@var{fmt}. Depending on the file format, you can add one or more @var{options}
58
@@ -XXX,XX +XXX,XX @@ Error on reading data
59
60
@end table
61
62
-@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-m @var{num_coroutines}] [-W] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
63
+@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-m @var{num_coroutines}] [-W] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
64
65
Convert the disk image @var{filename} or a snapshot @var{snapshot_param}(@var{snapshot_id_or_name} is deprecated)
66
to disk image @var{output_filename} using format @var{output_fmt}. It can be optionally compressed (@code{-c}
67
--
68
1.8.3.1
69
70
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
This patch makes vhdx_create() always set errp in case of an error. It
4
also adds errp parameters to vhdx_create_bat() and
5
vhdx_create_new_region_table() so we can pass on the error object
6
generated by blk_truncate() as of a future commit.
7
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
10
Message-id: 20170328205129.15138-2-mreitz@redhat.com
11
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
12
Signed-off-by: Max Reitz <mreitz@redhat.com>
13
---
14
block/vhdx.c | 23 +++++++++++++++++++----
15
1 file changed, 19 insertions(+), 4 deletions(-)
16
17
diff --git a/block/vhdx.c b/block/vhdx.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/block/vhdx.c
20
+++ b/block/vhdx.c
21
@@ -XXX,XX +XXX,XX @@ exit:
22
static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s,
23
uint64_t image_size, VHDXImageType type,
24
bool use_zero_blocks, uint64_t file_offset,
25
- uint32_t length)
26
+ uint32_t length, Error **errp)
27
{
28
int ret = 0;
29
uint64_t data_file_offset;
30
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s,
31
* is the furthest thing we have written yet */
32
ret = blk_truncate(blk, data_file_offset);
33
if (ret < 0) {
34
+ error_setg_errno(errp, -ret,
35
+ "Failed to resize the underlying file");
36
goto exit;
37
}
38
} else if (type == VHDX_TYPE_FIXED) {
39
ret = blk_truncate(blk, data_file_offset + image_size);
40
if (ret < 0) {
41
+ error_setg_errno(errp, -ret,
42
+ "Failed to resize the underlying file");
43
goto exit;
44
}
45
} else {
46
+ error_setg(errp, "Unsupported image type");
47
ret = -ENOTSUP;
48
goto exit;
49
}
50
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s,
51
/* for a fixed file, the default BAT entry is not zero */
52
s->bat = g_try_malloc0(length);
53
if (length && s->bat == NULL) {
54
+ error_setg(errp, "Failed to allocate memory for the BAT");
55
ret = -ENOMEM;
56
goto exit;
57
}
58
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s,
59
}
60
ret = blk_pwrite(blk, file_offset, s->bat, length, 0);
61
if (ret < 0) {
62
+ error_setg_errno(errp, -ret, "Failed to write the BAT");
63
goto exit;
64
}
65
}
66
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_new_region_table(BlockBackend *blk,
67
uint32_t log_size,
68
bool use_zero_blocks,
69
VHDXImageType type,
70
- uint64_t *metadata_offset)
71
+ uint64_t *metadata_offset,
72
+ Error **errp)
73
{
74
int ret = 0;
75
uint32_t offset = 0;
76
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_new_region_table(BlockBackend *blk,
77
/* The region table gives us the data we need to create the BAT,
78
* so do that now */
79
ret = vhdx_create_bat(blk, s, image_size, type, use_zero_blocks,
80
- bat_file_offset, bat_length);
81
+ bat_file_offset, bat_length, errp);
82
if (ret < 0) {
83
goto exit;
84
}
85
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_new_region_table(BlockBackend *blk,
86
ret = blk_pwrite(blk, VHDX_REGION_TABLE_OFFSET, buffer,
87
VHDX_HEADER_BLOCK_SIZE, 0);
88
if (ret < 0) {
89
+ error_setg_errno(errp, -ret, "Failed to write first region table");
90
goto exit;
91
}
92
93
ret = blk_pwrite(blk, VHDX_REGION_TABLE2_OFFSET, buffer,
94
VHDX_HEADER_BLOCK_SIZE, 0);
95
if (ret < 0) {
96
+ error_setg_errno(errp, -ret, "Failed to write second region table");
97
goto exit;
98
}
99
100
@@ -XXX,XX +XXX,XX @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp)
101
ret = -ENOTSUP;
102
goto exit;
103
} else {
104
+ error_setg(errp, "Invalid subformat '%s'", type);
105
ret = -EINVAL;
106
goto exit;
107
}
108
@@ -XXX,XX +XXX,XX @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp)
109
ret = blk_pwrite(blk, VHDX_FILE_ID_OFFSET, &signature, sizeof(signature),
110
0);
111
if (ret < 0) {
112
+ error_setg_errno(errp, -ret, "Failed to write file signature");
113
goto delete_and_exit;
114
}
115
if (creator) {
116
ret = blk_pwrite(blk, VHDX_FILE_ID_OFFSET + sizeof(signature),
117
creator, creator_items * sizeof(gunichar2), 0);
118
if (ret < 0) {
119
+ error_setg_errno(errp, -ret, "Failed to write creator field");
120
goto delete_and_exit;
121
}
122
}
123
@@ -XXX,XX +XXX,XX @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp)
124
/* Creates (B),(C) */
125
ret = vhdx_create_new_headers(blk, image_size, log_size);
126
if (ret < 0) {
127
+ error_setg_errno(errp, -ret, "Failed to write image headers");
128
goto delete_and_exit;
129
}
130
131
/* Creates (D),(E),(G) explicitly. (F) created as by-product */
132
ret = vhdx_create_new_region_table(blk, image_size, block_size, 512,
133
log_size, use_zero_blocks, image_type,
134
- &metadata_offset);
135
+ &metadata_offset, errp);
136
if (ret < 0) {
137
goto delete_and_exit;
138
}
139
@@ -XXX,XX +XXX,XX @@ static int vhdx_create(const char *filename, QemuOpts *opts, Error **errp)
140
ret = vhdx_create_new_metadata(blk, image_size, block_size, 512,
141
metadata_offset, image_type);
142
if (ret < 0) {
143
+ error_setg_errno(errp, -ret, "Failed to initialize metadata");
144
goto delete_and_exit;
145
}
146
147
--
148
1.8.3.1
149
150
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
For one thing, this allows us to drop the error message generation from
4
qemu-img.c and blockdev.c and instead have it unified in
5
bdrv_truncate().
6
7
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
Message-id: 20170328205129.15138-3-mreitz@redhat.com
9
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
---
12
block.c | 16 ++++++++++++----
13
block/blkdebug.c | 2 +-
14
block/block-backend.c | 5 +++--
15
block/commit.c | 5 +++--
16
block/crypto.c | 2 +-
17
block/mirror.c | 2 +-
18
block/parallels.c | 13 ++++++++-----
19
block/qcow.c | 6 +++---
20
block/qcow2-refcount.c | 5 ++++-
21
block/qcow2.c | 14 +++++++++-----
22
block/qed.c | 2 +-
23
block/raw-format.c | 2 +-
24
block/vdi.c | 4 ++--
25
block/vhdx-log.c | 2 +-
26
block/vhdx.c | 10 +++-------
27
block/vmdk.c | 13 +++----------
28
block/vpc.c | 13 +++++++------
29
blockdev.c | 21 +--------------------
30
include/block/block.h | 2 +-
31
include/sysemu/block-backend.h | 2 +-
32
qemu-img.c | 17 ++++-------------
33
qemu-io-cmds.c | 5 +++--
34
22 files changed, 73 insertions(+), 90 deletions(-)
35
36
diff --git a/block.c b/block.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/block.c
39
+++ b/block.c
40
@@ -XXX,XX +XXX,XX @@ exit:
41
/**
42
* Truncate file to 'offset' bytes (needed only for file protocols)
43
*/
44
-int bdrv_truncate(BdrvChild *child, int64_t offset)
45
+int bdrv_truncate(BdrvChild *child, int64_t offset, Error **errp)
46
{
47
BlockDriverState *bs = child->bs;
48
BlockDriver *drv = bs->drv;
49
@@ -XXX,XX +XXX,XX @@ int bdrv_truncate(BdrvChild *child, int64_t offset)
50
51
assert(child->perm & BLK_PERM_RESIZE);
52
53
- if (!drv)
54
+ if (!drv) {
55
+ error_setg(errp, "No medium inserted");
56
return -ENOMEDIUM;
57
- if (!drv->bdrv_truncate)
58
+ }
59
+ if (!drv->bdrv_truncate) {
60
+ error_setg(errp, "Image format driver does not support resize");
61
return -ENOTSUP;
62
- if (bs->read_only)
63
+ }
64
+ if (bs->read_only) {
65
+ error_setg(errp, "Image is read-only");
66
return -EACCES;
67
+ }
68
69
ret = drv->bdrv_truncate(bs, offset);
70
if (ret == 0) {
71
@@ -XXX,XX +XXX,XX @@ int bdrv_truncate(BdrvChild *child, int64_t offset)
72
bdrv_dirty_bitmap_truncate(bs);
73
bdrv_parent_cb_resize(bs);
74
++bs->write_gen;
75
+ } else {
76
+ error_setg_errno(errp, -ret, "Failed to resize image");
77
}
78
return ret;
79
}
80
diff --git a/block/blkdebug.c b/block/blkdebug.c
81
index XXXXXXX..XXXXXXX 100644
82
--- a/block/blkdebug.c
83
+++ b/block/blkdebug.c
84
@@ -XXX,XX +XXX,XX @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
85
86
static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
87
{
88
- return bdrv_truncate(bs->file, offset);
89
+ return bdrv_truncate(bs->file, offset, NULL);
90
}
91
92
static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
93
diff --git a/block/block-backend.c b/block/block-backend.c
94
index XXXXXXX..XXXXXXX 100644
95
--- a/block/block-backend.c
96
+++ b/block/block-backend.c
97
@@ -XXX,XX +XXX,XX @@ int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf,
98
BDRV_REQ_WRITE_COMPRESSED);
99
}
100
101
-int blk_truncate(BlockBackend *blk, int64_t offset)
102
+int blk_truncate(BlockBackend *blk, int64_t offset, Error **errp)
103
{
104
if (!blk_is_available(blk)) {
105
+ error_setg(errp, "No medium inserted");
106
return -ENOMEDIUM;
107
}
108
109
- return bdrv_truncate(blk->root, offset);
110
+ return bdrv_truncate(blk->root, offset, errp);
111
}
112
113
static void blk_pdiscard_entry(void *opaque)
114
diff --git a/block/commit.c b/block/commit.c
115
index XXXXXXX..XXXXXXX 100644
116
--- a/block/commit.c
117
+++ b/block/commit.c
118
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn commit_run(void *opaque)
119
}
120
121
if (base_len < s->common.len) {
122
- ret = blk_truncate(s->base, s->common.len);
123
+ ret = blk_truncate(s->base, s->common.len, NULL);
124
if (ret) {
125
goto out;
126
}
127
@@ -XXX,XX +XXX,XX @@ int bdrv_commit(BlockDriverState *bs)
128
* grow the backing file image if possible. If not possible,
129
* we must return an error */
130
if (length > backing_length) {
131
- ret = blk_truncate(backing, length);
132
+ ret = blk_truncate(backing, length, &local_err);
133
if (ret < 0) {
134
+ error_report_err(local_err);
135
goto ro_cleanup;
136
}
137
}
138
diff --git a/block/crypto.c b/block/crypto.c
139
index XXXXXXX..XXXXXXX 100644
140
--- a/block/crypto.c
141
+++ b/block/crypto.c
142
@@ -XXX,XX +XXX,XX @@ static int block_crypto_truncate(BlockDriverState *bs, int64_t offset)
143
144
offset += payload_offset;
145
146
- return bdrv_truncate(bs->file, offset);
147
+ return bdrv_truncate(bs->file, offset, NULL);
148
}
149
150
static void block_crypto_close(BlockDriverState *bs)
151
diff --git a/block/mirror.c b/block/mirror.c
152
index XXXXXXX..XXXXXXX 100644
153
--- a/block/mirror.c
154
+++ b/block/mirror.c
155
@@ -XXX,XX +XXX,XX @@ static void coroutine_fn mirror_run(void *opaque)
156
}
157
158
if (s->bdev_length > base_length) {
159
- ret = blk_truncate(s->target, s->bdev_length);
160
+ ret = blk_truncate(s->target, s->bdev_length, NULL);
161
if (ret < 0) {
162
goto immediate_exit;
163
}
164
diff --git a/block/parallels.c b/block/parallels.c
165
index XXXXXXX..XXXXXXX 100644
166
--- a/block/parallels.c
167
+++ b/block/parallels.c
168
@@ -XXX,XX +XXX,XX @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
169
space << BDRV_SECTOR_BITS, 0);
170
} else {
171
ret = bdrv_truncate(bs->file,
172
- (s->data_end + space) << BDRV_SECTOR_BITS);
173
+ (s->data_end + space) << BDRV_SECTOR_BITS,
174
+ NULL);
175
}
176
if (ret < 0) {
177
return ret;
178
@@ -XXX,XX +XXX,XX @@ static int parallels_check(BlockDriverState *bs, BdrvCheckResult *res,
179
size - res->image_end_offset);
180
res->leaks += count;
181
if (fix & BDRV_FIX_LEAKS) {
182
- ret = bdrv_truncate(bs->file, res->image_end_offset);
183
+ Error *local_err = NULL;
184
+ ret = bdrv_truncate(bs->file, res->image_end_offset, &local_err);
185
if (ret < 0) {
186
+ error_report_err(local_err);
187
res->check_errors++;
188
return ret;
189
}
190
@@ -XXX,XX +XXX,XX @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
191
192
blk_set_allow_write_beyond_eof(file, true);
193
194
- ret = blk_truncate(file, 0);
195
+ ret = blk_truncate(file, 0, errp);
196
if (ret < 0) {
197
goto exit;
198
}
199
@@ -XXX,XX +XXX,XX @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
200
}
201
202
if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||
203
- bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs)) != 0) {
204
+ bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs), NULL) != 0) {
205
s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
206
}
207
208
@@ -XXX,XX +XXX,XX @@ static void parallels_close(BlockDriverState *bs)
209
}
210
211
if (bs->open_flags & BDRV_O_RDWR) {
212
- bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS);
213
+ bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, NULL);
214
}
215
216
g_free(s->bat_dirty_bmap);
217
diff --git a/block/qcow.c b/block/qcow.c
218
index XXXXXXX..XXXXXXX 100644
219
--- a/block/qcow.c
220
+++ b/block/qcow.c
221
@@ -XXX,XX +XXX,XX @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
222
/* round to cluster size */
223
cluster_offset = (cluster_offset + s->cluster_size - 1) &
224
~(s->cluster_size - 1);
225
- bdrv_truncate(bs->file, cluster_offset + s->cluster_size);
226
+ bdrv_truncate(bs->file, cluster_offset + s->cluster_size, NULL);
227
/* if encrypted, we must initialize the cluster
228
content which won't be written */
229
if (bs->encrypted &&
230
@@ -XXX,XX +XXX,XX @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp)
231
232
blk_set_allow_write_beyond_eof(qcow_blk, true);
233
234
- ret = blk_truncate(qcow_blk, 0);
235
+ ret = blk_truncate(qcow_blk, 0, errp);
236
if (ret < 0) {
237
goto exit;
238
}
239
@@ -XXX,XX +XXX,XX @@ static int qcow_make_empty(BlockDriverState *bs)
240
if (bdrv_pwrite_sync(bs->file, s->l1_table_offset, s->l1_table,
241
l1_length) < 0)
242
return -1;
243
- ret = bdrv_truncate(bs->file, s->l1_table_offset + l1_length);
244
+ ret = bdrv_truncate(bs->file, s->l1_table_offset + l1_length, NULL);
245
if (ret < 0)
246
return ret;
247
248
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
249
index XXXXXXX..XXXXXXX 100644
250
--- a/block/qcow2-refcount.c
251
+++ b/block/qcow2-refcount.c
252
@@ -XXX,XX +XXX,XX @@ static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res,
253
254
if (fix & BDRV_FIX_ERRORS) {
255
int64_t new_nb_clusters;
256
+ Error *local_err = NULL;
257
258
if (offset > INT64_MAX - s->cluster_size) {
259
ret = -EINVAL;
260
goto resize_fail;
261
}
262
263
- ret = bdrv_truncate(bs->file, offset + s->cluster_size);
264
+ ret = bdrv_truncate(bs->file, offset + s->cluster_size,
265
+ &local_err);
266
if (ret < 0) {
267
+ error_report_err(local_err);
268
goto resize_fail;
269
}
270
size = bdrv_getlength(bs->file->bs);
271
diff --git a/block/qcow2.c b/block/qcow2.c
272
index XXXXXXX..XXXXXXX 100644
273
--- a/block/qcow2.c
274
+++ b/block/qcow2.c
275
@@ -XXX,XX +XXX,XX @@ static int qcow2_create2(const char *filename, int64_t total_size,
276
}
277
278
/* Okay, now that we have a valid image, let's give it the right size */
279
- ret = blk_truncate(blk, total_size);
280
+ ret = blk_truncate(blk, total_size, errp);
281
if (ret < 0) {
282
- error_setg_errno(errp, -ret, "Could not resize image");
283
+ error_prepend(errp, "Could not resize image: ");
284
goto out;
285
}
286
287
@@ -XXX,XX +XXX,XX @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
288
/* align end of file to a sector boundary to ease reading with
289
sector based I/Os */
290
cluster_offset = bdrv_getlength(bs->file->bs);
291
- return bdrv_truncate(bs->file, cluster_offset);
292
+ return bdrv_truncate(bs->file, cluster_offset, NULL);
293
}
294
295
buf = qemu_blockalign(bs, s->cluster_size);
296
@@ -XXX,XX +XXX,XX @@ fail:
297
static int make_completely_empty(BlockDriverState *bs)
298
{
299
BDRVQcow2State *s = bs->opaque;
300
+ Error *local_err = NULL;
301
int ret, l1_clusters;
302
int64_t offset;
303
uint64_t *new_reftable = NULL;
304
@@ -XXX,XX +XXX,XX @@ static int make_completely_empty(BlockDriverState *bs)
305
goto fail;
306
}
307
308
- ret = bdrv_truncate(bs->file, (3 + l1_clusters) * s->cluster_size);
309
+ ret = bdrv_truncate(bs->file, (3 + l1_clusters) * s->cluster_size,
310
+ &local_err);
311
if (ret < 0) {
312
+ error_report_err(local_err);
313
goto fail;
314
}
315
316
@@ -XXX,XX +XXX,XX @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
317
return ret;
318
}
319
320
- ret = blk_truncate(blk, new_size);
321
+ ret = blk_truncate(blk, new_size, &local_err);
322
blk_unref(blk);
323
if (ret < 0) {
324
+ error_report_err(local_err);
325
return ret;
326
}
327
}
328
diff --git a/block/qed.c b/block/qed.c
329
index XXXXXXX..XXXXXXX 100644
330
--- a/block/qed.c
331
+++ b/block/qed.c
332
@@ -XXX,XX +XXX,XX @@ static int qed_create(const char *filename, uint32_t cluster_size,
333
blk_set_allow_write_beyond_eof(blk, true);
334
335
/* File must start empty and grow, check truncate is supported */
336
- ret = blk_truncate(blk, 0);
337
+ ret = blk_truncate(blk, 0, errp);
338
if (ret < 0) {
339
goto out;
340
}
341
diff --git a/block/raw-format.c b/block/raw-format.c
342
index XXXXXXX..XXXXXXX 100644
343
--- a/block/raw-format.c
344
+++ b/block/raw-format.c
345
@@ -XXX,XX +XXX,XX @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
346
347
s->size = offset;
348
offset += s->offset;
349
- return bdrv_truncate(bs->file, offset);
350
+ return bdrv_truncate(bs->file, offset, NULL);
351
}
352
353
static int raw_media_changed(BlockDriverState *bs)
354
diff --git a/block/vdi.c b/block/vdi.c
355
index XXXXXXX..XXXXXXX 100644
356
--- a/block/vdi.c
357
+++ b/block/vdi.c
358
@@ -XXX,XX +XXX,XX @@ static int vdi_create(const char *filename, QemuOpts *opts, Error **errp)
359
}
360
361
if (image_type == VDI_TYPE_STATIC) {
362
- ret = blk_truncate(blk, offset + blocks * block_size);
363
+ ret = blk_truncate(blk, offset + blocks * block_size, errp);
364
if (ret < 0) {
365
- error_setg(errp, "Failed to statically allocate %s", filename);
366
+ error_prepend(errp, "Failed to statically allocate %s", filename);
367
goto exit;
368
}
369
}
370
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
371
index XXXXXXX..XXXXXXX 100644
372
--- a/block/vhdx-log.c
373
+++ b/block/vhdx-log.c
374
@@ -XXX,XX +XXX,XX @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
375
if (new_file_size % (1024*1024)) {
376
/* round up to nearest 1MB boundary */
377
new_file_size = ((new_file_size >> 20) + 1) << 20;
378
- bdrv_truncate(bs->file, new_file_size);
379
+ bdrv_truncate(bs->file, new_file_size, NULL);
380
}
381
}
382
qemu_vfree(desc_entries);
383
diff --git a/block/vhdx.c b/block/vhdx.c
384
index XXXXXXX..XXXXXXX 100644
385
--- a/block/vhdx.c
386
+++ b/block/vhdx.c
387
@@ -XXX,XX +XXX,XX @@ static int vhdx_allocate_block(BlockDriverState *bs, BDRVVHDXState *s,
388
/* per the spec, the address for a block is in units of 1MB */
389
*new_offset = ROUND_UP(*new_offset, 1024 * 1024);
390
391
- return bdrv_truncate(bs->file, *new_offset + s->block_size);
392
+ return bdrv_truncate(bs->file, *new_offset + s->block_size, NULL);
393
}
394
395
/*
396
@@ -XXX,XX +XXX,XX @@ static int vhdx_create_bat(BlockBackend *blk, BDRVVHDXState *s,
397
if (type == VHDX_TYPE_DYNAMIC) {
398
/* All zeroes, so we can just extend the file - the end of the BAT
399
* is the furthest thing we have written yet */
400
- ret = blk_truncate(blk, data_file_offset);
401
+ ret = blk_truncate(blk, data_file_offset, errp);
402
if (ret < 0) {
403
- error_setg_errno(errp, -ret,
404
- "Failed to resize the underlying file");
405
goto exit;
406
}
407
} else if (type == VHDX_TYPE_FIXED) {
408
- ret = blk_truncate(blk, data_file_offset + image_size);
409
+ ret = blk_truncate(blk, data_file_offset + image_size, errp);
410
if (ret < 0) {
411
- error_setg_errno(errp, -ret,
412
- "Failed to resize the underlying file");
413
goto exit;
414
}
415
} else {
416
diff --git a/block/vmdk.c b/block/vmdk.c
417
index XXXXXXX..XXXXXXX 100644
418
--- a/block/vmdk.c
419
+++ b/block/vmdk.c
420
@@ -XXX,XX +XXX,XX @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
421
blk_set_allow_write_beyond_eof(blk, true);
422
423
if (flat) {
424
- ret = blk_truncate(blk, filesize);
425
- if (ret < 0) {
426
- error_setg_errno(errp, -ret, "Could not truncate file");
427
- }
428
+ ret = blk_truncate(blk, filesize, errp);
429
goto exit;
430
}
431
magic = cpu_to_be32(VMDK4_MAGIC);
432
@@ -XXX,XX +XXX,XX @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
433
goto exit;
434
}
435
436
- ret = blk_truncate(blk, le64_to_cpu(header.grain_offset) << 9);
437
+ ret = blk_truncate(blk, le64_to_cpu(header.grain_offset) << 9, errp);
438
if (ret < 0) {
439
- error_setg_errno(errp, -ret, "Could not truncate file");
440
goto exit;
441
}
442
443
@@ -XXX,XX +XXX,XX @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
444
/* bdrv_pwrite write padding zeros to align to sector, we don't need that
445
* for description file */
446
if (desc_offset == 0) {
447
- ret = blk_truncate(new_blk, desc_len);
448
- if (ret < 0) {
449
- error_setg_errno(errp, -ret, "Could not truncate file");
450
- }
451
+ ret = blk_truncate(new_blk, desc_len, errp);
452
}
453
exit:
454
if (new_blk) {
455
diff --git a/block/vpc.c b/block/vpc.c
456
index XXXXXXX..XXXXXXX 100644
457
--- a/block/vpc.c
458
+++ b/block/vpc.c
459
@@ -XXX,XX +XXX,XX @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t *buf,
460
}
461
462
static int create_fixed_disk(BlockBackend *blk, uint8_t *buf,
463
- int64_t total_size)
464
+ int64_t total_size, Error **errp)
465
{
466
int ret;
467
468
/* Add footer to total size */
469
total_size += HEADER_SIZE;
470
471
- ret = blk_truncate(blk, total_size);
472
+ ret = blk_truncate(blk, total_size, errp);
473
if (ret < 0) {
474
return ret;
475
}
476
477
ret = blk_pwrite(blk, total_size - HEADER_SIZE, buf, HEADER_SIZE, 0);
478
if (ret < 0) {
479
+ error_setg_errno(errp, -ret, "Unable to write VHD header");
480
return ret;
481
}
482
483
@@ -XXX,XX +XXX,XX @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp)
484
485
if (disk_type == VHD_DYNAMIC) {
486
ret = create_dynamic_disk(blk, buf, total_sectors);
487
+ if (ret < 0) {
488
+ error_setg(errp, "Unable to create or write VHD header");
489
+ }
490
} else {
491
- ret = create_fixed_disk(blk, buf, total_size);
492
- }
493
- if (ret < 0) {
494
- error_setg(errp, "Unable to create or write VHD header");
495
+ ret = create_fixed_disk(blk, buf, total_size, errp);
496
}
497
498
out:
499
diff --git a/blockdev.c b/blockdev.c
500
index XXXXXXX..XXXXXXX 100644
501
--- a/blockdev.c
502
+++ b/blockdev.c
503
@@ -XXX,XX +XXX,XX @@ void qmp_block_resize(bool has_device, const char *device,
504
/* complete all in-flight operations before resizing the device */
505
bdrv_drain_all();
506
507
- ret = blk_truncate(blk, size);
508
- switch (ret) {
509
- case 0:
510
- break;
511
- case -ENOMEDIUM:
512
- error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
513
- break;
514
- case -ENOTSUP:
515
- error_setg(errp, QERR_UNSUPPORTED);
516
- break;
517
- case -EACCES:
518
- error_setg(errp, "Device '%s' is read only", device);
519
- break;
520
- case -EBUSY:
521
- error_setg(errp, QERR_DEVICE_IN_USE, device);
522
- break;
523
- default:
524
- error_setg_errno(errp, -ret, "Could not resize");
525
- break;
526
- }
527
+ ret = blk_truncate(blk, size, errp);
528
529
out:
530
blk_unref(blk);
531
diff --git a/include/block/block.h b/include/block/block.h
532
index XXXXXXX..XXXXXXX 100644
533
--- a/include/block/block.h
534
+++ b/include/block/block.h
535
@@ -XXX,XX +XXX,XX @@ BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs,
536
const char *backing_file);
537
int bdrv_get_backing_file_depth(BlockDriverState *bs);
538
void bdrv_refresh_filename(BlockDriverState *bs);
539
-int bdrv_truncate(BdrvChild *child, int64_t offset);
540
+int bdrv_truncate(BdrvChild *child, int64_t offset, Error **errp);
541
int64_t bdrv_nb_sectors(BlockDriverState *bs);
542
int64_t bdrv_getlength(BlockDriverState *bs);
543
int64_t bdrv_get_allocated_file_size(BlockDriverState *bs);
544
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
545
index XXXXXXX..XXXXXXX 100644
546
--- a/include/sysemu/block-backend.h
547
+++ b/include/sysemu/block-backend.h
548
@@ -XXX,XX +XXX,XX @@ int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
549
int count, BdrvRequestFlags flags);
550
int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *buf,
551
int count);
552
-int blk_truncate(BlockBackend *blk, int64_t offset);
553
+int blk_truncate(BlockBackend *blk, int64_t offset, Error **errp);
554
int blk_pdiscard(BlockBackend *blk, int64_t offset, int count);
555
int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf,
556
int64_t pos, int size);
557
diff --git a/qemu-img.c b/qemu-img.c
558
index XXXXXXX..XXXXXXX 100644
559
--- a/qemu-img.c
560
+++ b/qemu-img.c
561
@@ -XXX,XX +XXX,XX @@ static int img_resize(int argc, char **argv)
562
goto out;
563
}
564
565
- ret = blk_truncate(blk, total_size);
566
- switch (ret) {
567
- case 0:
568
+ ret = blk_truncate(blk, total_size, &err);
569
+ if (!ret) {
570
qprintf(quiet, "Image resized.\n");
571
- break;
572
- case -ENOTSUP:
573
- error_report("This image does not support resize");
574
- break;
575
- case -EACCES:
576
- error_report("Image is read-only");
577
- break;
578
- default:
579
- error_report("Error resizing image: %s", strerror(-ret));
580
- break;
581
+ } else {
582
+ error_report_err(err);
583
}
584
out:
585
blk_unref(blk);
586
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
587
index XXXXXXX..XXXXXXX 100644
588
--- a/qemu-io-cmds.c
589
+++ b/qemu-io-cmds.c
590
@@ -XXX,XX +XXX,XX @@ static const cmdinfo_t flush_cmd = {
591
592
static int truncate_f(BlockBackend *blk, int argc, char **argv)
593
{
594
+ Error *local_err = NULL;
595
int64_t offset;
596
int ret;
597
598
@@ -XXX,XX +XXX,XX @@ static int truncate_f(BlockBackend *blk, int argc, char **argv)
599
return 0;
600
}
601
602
- ret = blk_truncate(blk, offset);
603
+ ret = blk_truncate(blk, offset, &local_err);
604
if (ret < 0) {
605
- printf("truncate: %s\n", strerror(-ret));
606
+ error_report_err(local_err);
607
return 0;
608
}
609
610
--
611
1.8.3.1
612
613
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Add an Error parameter to the block drivers' bdrv_truncate() interface.
4
If a block driver does not set this in case of an error, the generic
5
bdrv_truncate() implementation will do so.
6
7
Where it is obvious, this patch also makes some block drivers set this
8
value.
9
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
Message-id: 20170328205129.15138-4-mreitz@redhat.com
12
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
13
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
---
15
block.c | 4 ++--
16
block/blkdebug.c | 4 ++--
17
block/crypto.c | 5 +++--
18
block/file-posix.c | 2 +-
19
block/file-win32.c | 6 +++---
20
block/gluster.c | 3 ++-
21
block/iscsi.c | 4 ++--
22
block/nfs.c | 2 +-
23
block/qcow2.c | 8 ++++----
24
block/qed.c | 2 +-
25
block/raw-format.c | 4 ++--
26
block/rbd.c | 2 +-
27
block/sheepdog.c | 14 ++++++--------
28
include/block/block_int.h | 2 +-
29
14 files changed, 31 insertions(+), 31 deletions(-)
30
31
diff --git a/block.c b/block.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/block.c
34
+++ b/block.c
35
@@ -XXX,XX +XXX,XX @@ int bdrv_truncate(BdrvChild *child, int64_t offset, Error **errp)
36
return -EACCES;
37
}
38
39
- ret = drv->bdrv_truncate(bs, offset);
40
+ ret = drv->bdrv_truncate(bs, offset, errp);
41
if (ret == 0) {
42
ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
43
bdrv_dirty_bitmap_truncate(bs);
44
bdrv_parent_cb_resize(bs);
45
++bs->write_gen;
46
- } else {
47
+ } else if (errp && !*errp) {
48
error_setg_errno(errp, -ret, "Failed to resize image");
49
}
50
return ret;
51
diff --git a/block/blkdebug.c b/block/blkdebug.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/block/blkdebug.c
54
+++ b/block/blkdebug.c
55
@@ -XXX,XX +XXX,XX @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
56
return bdrv_getlength(bs->file->bs);
57
}
58
59
-static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
60
+static int blkdebug_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
61
{
62
- return bdrv_truncate(bs->file, offset, NULL);
63
+ return bdrv_truncate(bs->file, offset, errp);
64
}
65
66
static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
67
diff --git a/block/crypto.c b/block/crypto.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/block/crypto.c
70
+++ b/block/crypto.c
71
@@ -XXX,XX +XXX,XX @@ static int block_crypto_create_generic(QCryptoBlockFormat format,
72
return ret;
73
}
74
75
-static int block_crypto_truncate(BlockDriverState *bs, int64_t offset)
76
+static int block_crypto_truncate(BlockDriverState *bs, int64_t offset,
77
+ Error **errp)
78
{
79
BlockCrypto *crypto = bs->opaque;
80
size_t payload_offset =
81
@@ -XXX,XX +XXX,XX @@ static int block_crypto_truncate(BlockDriverState *bs, int64_t offset)
82
83
offset += payload_offset;
84
85
- return bdrv_truncate(bs->file, offset, NULL);
86
+ return bdrv_truncate(bs->file, offset, errp);
87
}
88
89
static void block_crypto_close(BlockDriverState *bs)
90
diff --git a/block/file-posix.c b/block/file-posix.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/block/file-posix.c
93
+++ b/block/file-posix.c
94
@@ -XXX,XX +XXX,XX @@ static void raw_close(BlockDriverState *bs)
95
}
96
}
97
98
-static int raw_truncate(BlockDriverState *bs, int64_t offset)
99
+static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
100
{
101
BDRVRawState *s = bs->opaque;
102
struct stat st;
103
diff --git a/block/file-win32.c b/block/file-win32.c
104
index XXXXXXX..XXXXXXX 100644
105
--- a/block/file-win32.c
106
+++ b/block/file-win32.c
107
@@ -XXX,XX +XXX,XX @@ static void raw_close(BlockDriverState *bs)
108
}
109
}
110
111
-static int raw_truncate(BlockDriverState *bs, int64_t offset)
112
+static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
113
{
114
BDRVRawState *s = bs->opaque;
115
LONG low, high;
116
@@ -XXX,XX +XXX,XX @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
117
*/
118
dwPtrLow = SetFilePointer(s->hfile, low, &high, FILE_BEGIN);
119
if (dwPtrLow == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
120
- fprintf(stderr, "SetFilePointer error: %lu\n", GetLastError());
121
+ error_setg_win32(errp, GetLastError(), "SetFilePointer error");
122
return -EIO;
123
}
124
if (SetEndOfFile(s->hfile) == 0) {
125
- fprintf(stderr, "SetEndOfFile error: %lu\n", GetLastError());
126
+ error_setg_win32(errp, GetLastError(), "SetEndOfFile error");
127
return -EIO;
128
}
129
return 0;
130
diff --git a/block/gluster.c b/block/gluster.c
131
index XXXXXXX..XXXXXXX 100644
132
--- a/block/gluster.c
133
+++ b/block/gluster.c
134
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
135
return acb.ret;
136
}
137
138
-static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset)
139
+static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset,
140
+ Error **errp)
141
{
142
int ret;
143
BDRVGlusterState *s = bs->opaque;
144
diff --git a/block/iscsi.c b/block/iscsi.c
145
index XXXXXXX..XXXXXXX 100644
146
--- a/block/iscsi.c
147
+++ b/block/iscsi.c
148
@@ -XXX,XX +XXX,XX @@ static void iscsi_reopen_commit(BDRVReopenState *reopen_state)
149
}
150
}
151
152
-static int iscsi_truncate(BlockDriverState *bs, int64_t offset)
153
+static int iscsi_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
154
{
155
IscsiLun *iscsilun = bs->opaque;
156
Error *local_err = NULL;
157
@@ -XXX,XX +XXX,XX @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset)
158
159
iscsi_readcapacity_sync(iscsilun, &local_err);
160
if (local_err != NULL) {
161
- error_free(local_err);
162
+ error_propagate(errp, local_err);
163
return -EIO;
164
}
165
166
diff --git a/block/nfs.c b/block/nfs.c
167
index XXXXXXX..XXXXXXX 100644
168
--- a/block/nfs.c
169
+++ b/block/nfs.c
170
@@ -XXX,XX +XXX,XX @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
171
return (task.ret < 0 ? task.ret : st.st_blocks * 512);
172
}
173
174
-static int nfs_file_truncate(BlockDriverState *bs, int64_t offset)
175
+static int nfs_file_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
176
{
177
NFSClient *client = bs->opaque;
178
return nfs_ftruncate(client->context, client->fh, offset);
179
diff --git a/block/qcow2.c b/block/qcow2.c
180
index XXXXXXX..XXXXXXX 100644
181
--- a/block/qcow2.c
182
+++ b/block/qcow2.c
183
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs,
184
return ret;
185
}
186
187
-static int qcow2_truncate(BlockDriverState *bs, int64_t offset)
188
+static int qcow2_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
189
{
190
BDRVQcow2State *s = bs->opaque;
191
int64_t new_l1_size;
192
int ret;
193
194
if (offset & 511) {
195
- error_report("The new size must be a multiple of 512");
196
+ error_setg(errp, "The new size must be a multiple of 512");
197
return -EINVAL;
198
}
199
200
/* cannot proceed if image has snapshots */
201
if (s->nb_snapshots) {
202
- error_report("Can't resize an image which has snapshots");
203
+ error_setg(errp, "Can't resize an image which has snapshots");
204
return -ENOTSUP;
205
}
206
207
/* shrinking is currently not supported */
208
if (offset < bs->total_sectors * 512) {
209
- error_report("qcow2 doesn't support shrinking images yet");
210
+ error_setg(errp, "qcow2 doesn't support shrinking images yet");
211
return -ENOTSUP;
212
}
213
214
diff --git a/block/qed.c b/block/qed.c
215
index XXXXXXX..XXXXXXX 100644
216
--- a/block/qed.c
217
+++ b/block/qed.c
218
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_qed_co_pwrite_zeroes(BlockDriverState *bs,
219
return cb.ret;
220
}
221
222
-static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset)
223
+static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
224
{
225
BDRVQEDState *s = bs->opaque;
226
uint64_t old_image_size;
227
diff --git a/block/raw-format.c b/block/raw-format.c
228
index XXXXXXX..XXXXXXX 100644
229
--- a/block/raw-format.c
230
+++ b/block/raw-format.c
231
@@ -XXX,XX +XXX,XX @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
232
}
233
}
234
235
-static int raw_truncate(BlockDriverState *bs, int64_t offset)
236
+static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
237
{
238
BDRVRawState *s = bs->opaque;
239
240
@@ -XXX,XX +XXX,XX @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
241
242
s->size = offset;
243
offset += s->offset;
244
- return bdrv_truncate(bs->file, offset, NULL);
245
+ return bdrv_truncate(bs->file, offset, errp);
246
}
247
248
static int raw_media_changed(BlockDriverState *bs)
249
diff --git a/block/rbd.c b/block/rbd.c
250
index XXXXXXX..XXXXXXX 100644
251
--- a/block/rbd.c
252
+++ b/block/rbd.c
253
@@ -XXX,XX +XXX,XX @@ static int64_t qemu_rbd_getlength(BlockDriverState *bs)
254
return info.size;
255
}
256
257
-static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset)
258
+static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
259
{
260
BDRVRBDState *s = bs->opaque;
261
int r;
262
diff --git a/block/sheepdog.c b/block/sheepdog.c
263
index XXXXXXX..XXXXXXX 100644
264
--- a/block/sheepdog.c
265
+++ b/block/sheepdog.c
266
@@ -XXX,XX +XXX,XX @@ static int64_t sd_getlength(BlockDriverState *bs)
267
return s->inode.vdi_size;
268
}
269
270
-static int sd_truncate(BlockDriverState *bs, int64_t offset)
271
+static int sd_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
272
{
273
- Error *local_err = NULL;
274
BDRVSheepdogState *s = bs->opaque;
275
int ret, fd;
276
unsigned int datalen;
277
@@ -XXX,XX +XXX,XX @@ static int sd_truncate(BlockDriverState *bs, int64_t offset)
278
279
max_vdi_size = (UINT64_C(1) << s->inode.block_size_shift) * MAX_DATA_OBJS;
280
if (offset < s->inode.vdi_size) {
281
- error_report("shrinking is not supported");
282
+ error_setg(errp, "shrinking is not supported");
283
return -EINVAL;
284
} else if (offset > max_vdi_size) {
285
- error_report("too big image size");
286
+ error_setg(errp, "too big image size");
287
return -EINVAL;
288
}
289
290
- fd = connect_to_sdog(s, &local_err);
291
+ fd = connect_to_sdog(s, errp);
292
if (fd < 0) {
293
- error_report_err(local_err);
294
return fd;
295
}
296
297
@@ -XXX,XX +XXX,XX @@ static int sd_truncate(BlockDriverState *bs, int64_t offset)
298
close(fd);
299
300
if (ret < 0) {
301
- error_report("failed to update an inode.");
302
+ error_setg_errno(errp, -ret, "failed to update an inode");
303
}
304
305
return ret;
306
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int sd_co_writev(BlockDriverState *bs, int64_t sector_num,
307
BDRVSheepdogState *s = bs->opaque;
308
309
if (offset > s->inode.vdi_size) {
310
- ret = sd_truncate(bs, offset);
311
+ ret = sd_truncate(bs, offset, NULL);
312
if (ret < 0) {
313
return ret;
314
}
315
diff --git a/include/block/block_int.h b/include/block/block_int.h
316
index XXXXXXX..XXXXXXX 100644
317
--- a/include/block/block_int.h
318
+++ b/include/block/block_int.h
319
@@ -XXX,XX +XXX,XX @@ struct BlockDriver {
320
int coroutine_fn (*bdrv_co_flush_to_os)(BlockDriverState *bs);
321
322
const char *protocol_name;
323
- int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset);
324
+ int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset, Error **errp);
325
326
int64_t (*bdrv_getlength)(BlockDriverState *bs);
327
bool has_variable_length;
328
--
329
1.8.3.1
330
331
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Add missing error messages for the block driver implementations of
4
.bdrv_truncate(); drop the generic one from block.c's bdrv_truncate().
5
6
Since one of these changes touches a mis-indented block in
7
block/file-posix.c, this patch fixes that coding style issue along the
8
way.
9
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
Message-id: 20170328205129.15138-5-mreitz@redhat.com
12
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
13
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
---
15
block.c | 2 --
16
block/file-posix.c | 17 ++++++++++++-----
17
block/gluster.c | 4 +++-
18
block/iscsi.c | 2 ++
19
block/nfs.c | 10 +++++++++-
20
block/qcow2.c | 2 ++
21
block/qed.c | 4 +++-
22
block/raw-format.c | 2 ++
23
block/rbd.c | 1 +
24
9 files changed, 34 insertions(+), 10 deletions(-)
25
26
diff --git a/block.c b/block.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/block.c
29
+++ b/block.c
30
@@ -XXX,XX +XXX,XX @@ int bdrv_truncate(BdrvChild *child, int64_t offset, Error **errp)
31
bdrv_dirty_bitmap_truncate(bs);
32
bdrv_parent_cb_resize(bs);
33
++bs->write_gen;
34
- } else if (errp && !*errp) {
35
- error_setg_errno(errp, -ret, "Failed to resize image");
36
}
37
return ret;
38
}
39
diff --git a/block/file-posix.c b/block/file-posix.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/block/file-posix.c
42
+++ b/block/file-posix.c
43
@@ -XXX,XX +XXX,XX @@ static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
44
{
45
BDRVRawState *s = bs->opaque;
46
struct stat st;
47
+ int ret;
48
49
if (fstat(s->fd, &st)) {
50
- return -errno;
51
+ ret = -errno;
52
+ error_setg_errno(errp, -ret, "Failed to fstat() the file");
53
+ return ret;
54
}
55
56
if (S_ISREG(st.st_mode)) {
57
if (ftruncate(s->fd, offset) < 0) {
58
- return -errno;
59
+ ret = -errno;
60
+ error_setg_errno(errp, -ret, "Failed to resize the file");
61
+ return ret;
62
}
63
} else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) {
64
- if (offset > raw_getlength(bs)) {
65
- return -EINVAL;
66
- }
67
+ if (offset > raw_getlength(bs)) {
68
+ error_setg(errp, "Cannot grow device files");
69
+ return -EINVAL;
70
+ }
71
} else {
72
+ error_setg(errp, "Resizing this file is not supported");
73
return -ENOTSUP;
74
}
75
76
diff --git a/block/gluster.c b/block/gluster.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/block/gluster.c
79
+++ b/block/gluster.c
80
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset,
81
82
ret = glfs_ftruncate(s->fd, offset);
83
if (ret < 0) {
84
- return -errno;
85
+ ret = -errno;
86
+ error_setg_errno(errp, -ret, "Failed to truncate file");
87
+ return ret;
88
}
89
90
return 0;
91
diff --git a/block/iscsi.c b/block/iscsi.c
92
index XXXXXXX..XXXXXXX 100644
93
--- a/block/iscsi.c
94
+++ b/block/iscsi.c
95
@@ -XXX,XX +XXX,XX @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
96
Error *local_err = NULL;
97
98
if (iscsilun->type != TYPE_DISK) {
99
+ error_setg(errp, "Cannot resize non-disk iSCSI devices");
100
return -ENOTSUP;
101
}
102
103
@@ -XXX,XX +XXX,XX @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
104
}
105
106
if (offset > iscsi_getlength(bs)) {
107
+ error_setg(errp, "Cannot grow iSCSI devices");
108
return -EINVAL;
109
}
110
111
diff --git a/block/nfs.c b/block/nfs.c
112
index XXXXXXX..XXXXXXX 100644
113
--- a/block/nfs.c
114
+++ b/block/nfs.c
115
@@ -XXX,XX +XXX,XX @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
116
static int nfs_file_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
117
{
118
NFSClient *client = bs->opaque;
119
- return nfs_ftruncate(client->context, client->fh, offset);
120
+ int ret;
121
+
122
+ ret = nfs_ftruncate(client->context, client->fh, offset);
123
+ if (ret < 0) {
124
+ error_setg_errno(errp, -ret, "Failed to truncate file");
125
+ return ret;
126
+ }
127
+
128
+ return 0;
129
}
130
131
/* Note that this will not re-establish a connection with the NFS server
132
diff --git a/block/qcow2.c b/block/qcow2.c
133
index XXXXXXX..XXXXXXX 100644
134
--- a/block/qcow2.c
135
+++ b/block/qcow2.c
136
@@ -XXX,XX +XXX,XX @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
137
new_l1_size = size_to_l1(s, offset);
138
ret = qcow2_grow_l1_table(bs, new_l1_size, true);
139
if (ret < 0) {
140
+ error_setg_errno(errp, -ret, "Failed to grow the L1 table");
141
return ret;
142
}
143
144
@@ -XXX,XX +XXX,XX @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
145
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size),
146
&offset, sizeof(uint64_t));
147
if (ret < 0) {
148
+ error_setg_errno(errp, -ret, "Failed to update the image size");
149
return ret;
150
}
151
152
diff --git a/block/qed.c b/block/qed.c
153
index XXXXXXX..XXXXXXX 100644
154
--- a/block/qed.c
155
+++ b/block/qed.c
156
@@ -XXX,XX +XXX,XX @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
157
158
if (!qed_is_image_size_valid(offset, s->header.cluster_size,
159
s->header.table_size)) {
160
+ error_setg(errp, "Invalid image size specified");
161
return -EINVAL;
162
}
163
164
- /* Shrinking is currently not supported */
165
if ((uint64_t)offset < s->header.image_size) {
166
+ error_setg(errp, "Shrinking images is currently not supported");
167
return -ENOTSUP;
168
}
169
170
@@ -XXX,XX +XXX,XX @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
171
ret = qed_write_header_sync(s);
172
if (ret < 0) {
173
s->header.image_size = old_image_size;
174
+ error_setg_errno(errp, -ret, "Failed to update the image size");
175
}
176
return ret;
177
}
178
diff --git a/block/raw-format.c b/block/raw-format.c
179
index XXXXXXX..XXXXXXX 100644
180
--- a/block/raw-format.c
181
+++ b/block/raw-format.c
182
@@ -XXX,XX +XXX,XX @@ static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
183
BDRVRawState *s = bs->opaque;
184
185
if (s->has_size) {
186
+ error_setg(errp, "Cannot resize fixed-size raw disks");
187
return -ENOTSUP;
188
}
189
190
if (INT64_MAX - offset < s->offset) {
191
+ error_setg(errp, "Disk size too large for the chosen offset");
192
return -EINVAL;
193
}
194
195
diff --git a/block/rbd.c b/block/rbd.c
196
index XXXXXXX..XXXXXXX 100644
197
--- a/block/rbd.c
198
+++ b/block/rbd.c
199
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
200
201
r = rbd_resize(s->image, offset);
202
if (r < 0) {
203
+ error_setg_errno(errp, -r, "Failed to resize file");
204
return r;
205
}
206
207
--
208
1.8.3.1
209
210
diff view generated by jsdifflib
Deleted patch
1
From: Eric Blake <eblake@redhat.com>
2
1
3
As mentioned in commit 0c1bd46, we ignored requests to
4
discard the trailing cluster of an unaligned image. While
5
discard is an advisory operation from the guest standpoint,
6
(and we are therefore free to ignore any request), our
7
qcow2 implementation exploits the fact that a discarded
8
cluster reads back as 0. As long as we discard on cluster
9
boundaries, we are fine; but that means we could observe
10
non-zero data leaked at the tail of an unaligned image.
11
12
Enhance iotest 66 to cover this case, and fix the implementation
13
to honor a discard request on the final partial cluster.
14
15
Signed-off-by: Eric Blake <eblake@redhat.com>
16
Message-id: 20170407013709.18440-1-eblake@redhat.com
17
Signed-off-by: Max Reitz <mreitz@redhat.com>
18
---
19
block/qcow2.c | 7 ++++++-
20
tests/qemu-iotests/066 | 12 +++++++-----
21
tests/qemu-iotests/066.out | 12 ++++++++----
22
3 files changed, 21 insertions(+), 10 deletions(-)
23
24
diff --git a/block/qcow2.c b/block/qcow2.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/block/qcow2.c
27
+++ b/block/qcow2.c
28
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs,
29
30
if (!QEMU_IS_ALIGNED(offset | count, s->cluster_size)) {
31
assert(count < s->cluster_size);
32
- return -ENOTSUP;
33
+ /* Ignore partial clusters, except for the special case of the
34
+ * complete partial cluster at the end of an unaligned file */
35
+ if (!QEMU_IS_ALIGNED(offset, s->cluster_size) ||
36
+ offset + count != bs->total_sectors * BDRV_SECTOR_SIZE) {
37
+ return -ENOTSUP;
38
+ }
39
}
40
41
qemu_co_mutex_lock(&s->lock);
42
diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
43
index XXXXXXX..XXXXXXX 100755
44
--- a/tests/qemu-iotests/066
45
+++ b/tests/qemu-iotests/066
46
@@ -XXX,XX +XXX,XX @@ _supported_fmt qcow2
47
_supported_proto generic
48
_supported_os Linux
49
50
+# Intentionally create an unaligned image
51
IMGOPTS="compat=1.1"
52
-IMG_SIZE=64M
53
+IMG_SIZE=$((64 * 1024 * 1024 + 512))
54
55
echo
56
-echo "=== Testing snapshotting an image with zero clusters ==="
57
+echo "=== Testing cluster discards ==="
58
echo
59
_make_test_img $IMG_SIZE
60
-# Write some normal clusters, zero them (creating preallocated zero clusters)
61
-# and discard those
62
-$QEMU_IO -c "write 0 256k" -c "write -z 0 256k" -c "discard 0 256k" "$TEST_IMG" \
63
+# Write some normal clusters, zero some of them (creating preallocated
64
+# zero clusters) and discard everything. Everything should now read as 0.
65
+$QEMU_IO -c "write 0 256k" -c "write -z 0 256k" -c "write 64M 512" \
66
+     -c "discard 0 $IMG_SIZE" -c "read -P 0 0 $IMG_SIZE" "$TEST_IMG" \
67
| _filter_qemu_io
68
# Check the image (there shouldn't be any leaks)
69
_check_test_img
70
diff --git a/tests/qemu-iotests/066.out b/tests/qemu-iotests/066.out
71
index XXXXXXX..XXXXXXX 100644
72
--- a/tests/qemu-iotests/066.out
73
+++ b/tests/qemu-iotests/066.out
74
@@ -XXX,XX +XXX,XX @@
75
QA output created by 066
76
77
-=== Testing snapshotting an image with zero clusters ===
78
+=== Testing cluster discards ===
79
80
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
81
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67109376
82
wrote 262144/262144 bytes at offset 0
83
256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
84
wrote 262144/262144 bytes at offset 0
85
256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
86
-discard 262144/262144 bytes at offset 0
87
-256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
88
+wrote 512/512 bytes at offset 67108864
89
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
90
+discard 67109376/67109376 bytes at offset 0
91
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
92
+read 67109376/67109376 bytes at offset 0
93
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
94
No errors were found on the image.
95
*** done
96
--
97
1.8.3.1
98
99
diff view generated by jsdifflib
Deleted patch
1
From: Klim Kireev <proffk@virtuozzo.mipt.ru>
2
1
3
Signed-off-by: Klim Kireev <proffk@virtuozzo.mipt.ru>
4
Signed-off-by: Denis V. Lunev <den@openvz.org>
5
CC: Kevin Wolf <kwolf@redhat.com>
6
CC: Max Reitz <mreitz@redhat.com>
7
Message-id: 1491405505-31620-2-git-send-email-den@openvz.org
8
Reviewed-by: Eric Blake <eblake@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
11
include/block/block_int.h | 6 +++---
12
1 file changed, 3 insertions(+), 3 deletions(-)
13
14
diff --git a/include/block/block_int.h b/include/block/block_int.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/include/block/block_int.h
17
+++ b/include/block/block_int.h
18
@@ -XXX,XX +XXX,XX @@ struct BlockDriver {
19
* Returns 0 for completed check, -errno for internal errors.
20
* The check results are stored in result.
21
*/
22
- int (*bdrv_check)(BlockDriverState* bs, BdrvCheckResult *result,
23
+ int (*bdrv_check)(BlockDriverState *bs, BdrvCheckResult *result,
24
BdrvCheckMode fix);
25
26
int (*bdrv_amend_options)(BlockDriverState *bs, QemuOpts *opts,
27
@@ -XXX,XX +XXX,XX @@ struct BdrvChildRole {
28
/* Returns a name that is supposedly more useful for human users than the
29
* node name for identifying the node in question (in particular, a BB
30
* name), or NULL if the parent can't provide a better name. */
31
- const char* (*get_name)(BdrvChild *child);
32
+ const char *(*get_name)(BdrvChild *child);
33
34
/* Returns a malloced string that describes the parent of the child for a
35
* human reader. This could be a node-name, BlockBackend name, qdev ID or
36
* QOM path of the device owning the BlockBackend, job type and ID etc. The
37
* caller is responsible for freeing the memory. */
38
- char* (*get_parent_desc)(BdrvChild *child);
39
+ char *(*get_parent_desc)(BdrvChild *child);
40
41
/*
42
* If this pair of functions is implemented, the parent doesn't issue new
43
--
44
1.8.3.1
45
46
diff view generated by jsdifflib
Deleted patch
1
From: "Denis V. Lunev" <den@openvz.org>
2
1
3
As long as BDRV_O_INACTIVE is set, the image file is only opened so we
4
have a file descriptor for it. We're definitely not supposed to modify
5
the image, it's still owned by the migration source.
6
7
This commit is an addition to 09e0c771 but the assert() is added to
8
bdrv_truncate().
9
10
Signed-off-by: Denis V. Lunev <den@openvz.org>
11
CC: Kevin Wolf <kwolf@redhat.com>
12
CC: Max Reitz <mreitz@redhat.com>
13
Message-id: 1491405505-31620-3-git-send-email-den@openvz.org
14
Reviewed-by: Eric Blake <eblake@redhat.com>
15
Signed-off-by: Max Reitz <mreitz@redhat.com>
16
---
17
block.c | 2 ++
18
1 file changed, 2 insertions(+)
19
20
diff --git a/block.c b/block.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/block.c
23
+++ b/block.c
24
@@ -XXX,XX +XXX,XX @@ int bdrv_truncate(BdrvChild *child, int64_t offset, Error **errp)
25
return -EACCES;
26
}
27
28
+ assert(!(bs->open_flags & BDRV_O_INACTIVE));
29
+
30
ret = drv->bdrv_truncate(bs, offset, errp);
31
if (ret == 0) {
32
ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
33
--
34
1.8.3.1
35
36
diff view generated by jsdifflib
Deleted patch
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2
1
3
Do not do extra call to _get_block_status()
4
5
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
6
Message-id: 20170407113404.9351-1-vsementsov@virtuozzo.com
7
Reviewed-by: John Snow <jsnow@redhat.com>
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
---
10
qemu-img.c | 32 ++++++++++----------------------
11
1 file changed, 10 insertions(+), 22 deletions(-)
12
13
diff --git a/qemu-img.c b/qemu-img.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/qemu-img.c
16
+++ b/qemu-img.c
17
@@ -XXX,XX +XXX,XX @@ static int convert_iteration_sectors(ImgConvertState *s, int64_t sector_num)
18
19
if (s->sector_next_status <= sector_num) {
20
BlockDriverState *file;
21
- ret = bdrv_get_block_status(blk_bs(s->src[src_cur]),
22
- sector_num - src_cur_offset,
23
- n, &n, &file);
24
+ if (s->target_has_backing) {
25
+ ret = bdrv_get_block_status(blk_bs(s->src[src_cur]),
26
+ sector_num - src_cur_offset,
27
+ n, &n, &file);
28
+ } else {
29
+ ret = bdrv_get_block_status_above(blk_bs(s->src[src_cur]), NULL,
30
+ sector_num - src_cur_offset,
31
+ n, &n, &file);
32
+ }
33
if (ret < 0) {
34
return ret;
35
}
36
@@ -XXX,XX +XXX,XX @@ static int convert_iteration_sectors(ImgConvertState *s, int64_t sector_num)
37
s->status = BLK_ZERO;
38
} else if (ret & BDRV_BLOCK_DATA) {
39
s->status = BLK_DATA;
40
- } else if (!s->target_has_backing) {
41
- /* Without a target backing file we must copy over the contents of
42
- * the backing file as well. */
43
- /* Check block status of the backing file chain to avoid
44
- * needlessly reading zeroes and limiting the iteration to the
45
- * buffer size */
46
- ret = bdrv_get_block_status_above(blk_bs(s->src[src_cur]), NULL,
47
- sector_num - src_cur_offset,
48
- n, &n, &file);
49
- if (ret < 0) {
50
- return ret;
51
- }
52
-
53
- if (ret & BDRV_BLOCK_ZERO) {
54
- s->status = BLK_ZERO;
55
- } else {
56
- s->status = BLK_DATA;
57
- }
58
} else {
59
- s->status = BLK_BACKING_FILE;
60
+ s->status = s->target_has_backing ? BLK_BACKING_FILE : BLK_DATA;
61
}
62
63
s->sector_next_status = sector_num + n;
64
--
65
1.8.3.1
66
67
diff view generated by jsdifflib
Deleted patch
1
From: Lidong Chen <lidongchen@tencent.com>
2
1
3
When the buffer is zero, blk_co_pwrite_zeroes is more effective than
4
blk_co_pwritev with BDRV_REQ_WRITE_COMPRESSED. This patch can reduce
5
the time for converting qcow2 images with lots of zero data.
6
7
Signed-off-by: Lidong Chen <lidongchen@tencent.com>
8
Message-id: 1493261907-18734-1-git-send-email-lidongchen@tencent.com
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
11
qemu-img.c | 44 ++++++++++++++------------------------------
12
1 file changed, 14 insertions(+), 30 deletions(-)
13
14
diff --git a/qemu-img.c b/qemu-img.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/qemu-img.c
17
+++ b/qemu-img.c
18
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num,
19
20
while (nb_sectors > 0) {
21
int n = nb_sectors;
22
+ BdrvRequestFlags flags = s->compressed ? BDRV_REQ_WRITE_COMPRESSED : 0;
23
+
24
switch (status) {
25
case BLK_BACKING_FILE:
26
/* If we have a backing file, leave clusters unallocated that are
27
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num,
28
break;
29
30
case BLK_DATA:
31
- /* We must always write compressed clusters as a whole, so don't
32
- * try to find zeroed parts in the buffer. We can only save the
33
- * write if the buffer is completely zeroed and we're allowed to
34
- * keep the target sparse. */
35
- if (s->compressed) {
36
- if (s->has_zero_init && s->min_sparse &&
37
- buffer_is_zero(buf, n * BDRV_SECTOR_SIZE))
38
- {
39
- assert(!s->target_has_backing);
40
- break;
41
- }
42
-
43
- iov.iov_base = buf;
44
- iov.iov_len = n << BDRV_SECTOR_BITS;
45
- qemu_iovec_init_external(&qiov, &iov, 1);
46
-
47
- ret = blk_co_pwritev(s->target, sector_num << BDRV_SECTOR_BITS,
48
- n << BDRV_SECTOR_BITS, &qiov,
49
- BDRV_REQ_WRITE_COMPRESSED);
50
- if (ret < 0) {
51
- return ret;
52
- }
53
- break;
54
- }
55
-
56
- /* If there is real non-zero data or we're told to keep the target
57
- * fully allocated (-S 0), we must write it. Otherwise we can treat
58
- * it as zero sectors. */
59
+ /* If we're told to keep the target fully allocated (-S 0) or there
60
+ * is real non-zero data, we must write it. Otherwise we can treat
61
+ * it as zero sectors.
62
+ * Compressed clusters need to be written as a whole, so in that
63
+ * case we can only save the write if the buffer is completely
64
+ * zeroed. */
65
if (!s->min_sparse ||
66
- is_allocated_sectors_min(buf, n, &n, s->min_sparse))
67
+ (!s->compressed &&
68
+ is_allocated_sectors_min(buf, n, &n, s->min_sparse)) ||
69
+ (s->compressed &&
70
+ !buffer_is_zero(buf, n * BDRV_SECTOR_SIZE)))
71
{
72
iov.iov_base = buf;
73
iov.iov_len = n << BDRV_SECTOR_BITS;
74
qemu_iovec_init_external(&qiov, &iov, 1);
75
76
ret = blk_co_pwritev(s->target, sector_num << BDRV_SECTOR_BITS,
77
- n << BDRV_SECTOR_BITS, &qiov, 0);
78
+ n << BDRV_SECTOR_BITS, &qiov, flags);
79
if (ret < 0) {
80
return ret;
81
}
82
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num,
83
84
case BLK_ZERO:
85
if (s->has_zero_init) {
86
+ assert(!s->target_has_backing);
87
break;
88
}
89
ret = blk_co_pwrite_zeroes(s->target,
90
--
91
1.8.3.1
92
93
diff view generated by jsdifflib
Deleted patch
1
From: John Snow <jsnow@redhat.com>
2
1
3
Split the help text to highlight the groups of options
4
a little better, carving out a clear "format" and
5
"protocols" section.
6
7
Signed-off-by: John Snow <jsnow@redhat.com>
8
Message-id: 20170427205100.9505-2-jsnow@redhat.com
9
Reviewed-by: Eric Blake <eblake@redhat.com>
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
---
12
tests/qemu-iotests/common | 8 ++++++--
13
1 file changed, 6 insertions(+), 2 deletions(-)
14
15
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
16
index XXXXXXX..XXXXXXX 100644
17
--- a/tests/qemu-iotests/common
18
+++ b/tests/qemu-iotests/common
19
@@ -XXX,XX +XXX,XX @@ common options
20
-v verbose
21
-d debug
22
23
-check options
24
+image format options
25
-raw test raw (default)
26
-bochs test bochs
27
-cloop test cloop
28
@@ -XXX,XX +XXX,XX @@ check options
29
-vpc test vpc
30
-vhdx test vhdx
31
-vmdk test vmdk
32
+ -luks test luks
33
+
34
+image protocol options
35
-file test file (default)
36
-rbd test rbd
37
-sheepdog test sheepdog
38
-nbd test nbd
39
-ssh test ssh
40
-nfs test nfs
41
- -luks test luks
42
-vxhs test vxhs
43
+
44
+other options
45
-xdiff graphical mode diff
46
-nocache use O_DIRECT on backing file
47
-misalign misalign memory allocations
48
--
49
1.8.3.1
50
51
diff view generated by jsdifflib
Deleted patch
1
From: John Snow <jsnow@redhat.com>
2
1
3
If you are running out-of-tree, the -x option to exclude
4
a certain iotest is broken.
5
6
Replace porcelain usage of ls with a sturdier awk command.
7
8
Reviewed-by: Fam Zheng <famz@redhat.com>
9
Signed-off-by: John Snow <jsnow@redhat.com>
10
Message-id: 20170427205100.9505-3-jsnow@redhat.com
11
Reviewed-by: Eric Blake <eblake@redhat.com>
12
Signed-off-by: Max Reitz <mreitz@redhat.com>
13
---
14
tests/qemu-iotests/common | 3 ++-
15
1 file changed, 2 insertions(+), 1 deletion(-)
16
17
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
18
index XXXXXXX..XXXXXXX 100644
19
--- a/tests/qemu-iotests/common
20
+++ b/tests/qemu-iotests/common
21
@@ -XXX,XX +XXX,XX @@ s/ .*//p
22
elif $xgroup
23
then
24
# arg after -x
25
- [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
26
+ # Populate $tmp.list with all tests
27
+ awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null
28
group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
29
s/ .*//p
30
}'`
31
--
32
1.8.3.1
33
34
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Currently we only print progress information on retrieval of SIGUSR1.
4
Some systems have a dedicated SIGINFO for this, however, so it should be
5
handled appropriately if it is available.
6
7
Buglink: https://bugs.launchpad.net/qemu/+bug/1662468
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
Message-id: 20170207235757.2026-1-mreitz@redhat.com
10
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
qemu-img.texi | 3 ++-
14
util/qemu-progress.c | 3 +++
15
2 files changed, 5 insertions(+), 1 deletion(-)
16
17
diff --git a/qemu-img.texi b/qemu-img.texi
18
index XXXXXXX..XXXXXXX 100644
19
--- a/qemu-img.texi
20
+++ b/qemu-img.texi
21
@@ -XXX,XX +XXX,XX @@ with or without a command shows help and lists the supported formats
22
@item -p
23
display progress bar (compare, convert and rebase commands only).
24
If the @var{-p} option is not used for a command that supports it, the
25
-progress is reported when the process receives a @code{SIGUSR1} signal.
26
+progress is reported when the process receives a @code{SIGUSR1} or
27
+@code{SIGINFO} signal.
28
@item -q
29
Quiet mode - do not print any output (except errors). There's no progress bar
30
in case both @var{-q} and @var{-p} options are used.
31
diff --git a/util/qemu-progress.c b/util/qemu-progress.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/util/qemu-progress.c
34
+++ b/util/qemu-progress.c
35
@@ -XXX,XX +XXX,XX @@ static void progress_dummy_init(void)
36
action.sa_handler = sigusr_print;
37
action.sa_flags = 0;
38
sigaction(SIGUSR1, &action, NULL);
39
+#ifdef SIGINFO
40
+ sigaction(SIGINFO, &action, NULL);
41
+#endif
42
43
/*
44
* SIGUSR1 is SIG_IPI and gets blocked in qemu_init_main_loop(). In the
45
--
46
1.8.3.1
47
48
diff view generated by jsdifflib