Message ID | 20240221211622.2335170-1-mjt@tls.msk.ru |
---|---|
State | New |
Headers | show |
Series | qemu-img: refersh options and --help handling, cleanups | expand |
On Thu, Feb 22, 2024 at 12:15:42AM +0300, Michael Tokarev wrote: > Currently we have: > > ./qemu-img resize none +10 > qemu-img: Could not open 'none': Could not open 'none': No such file or directory > > stop printing the message twice, - local_err already has > all the info, no need to prepend additional text there. > > There are a few other places like this, but I'm unsure > about these. > > Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> > --- > qemu-img.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> With regards, Daniel
22.02.2024 00:15, Michael Tokarev : > Currently we have: > > ./qemu-img resize none +10 > qemu-img: Could not open 'none': Could not open 'none': No such file or directory This one needs expected-output tweaks for tests. /mjt
26.02.2024 17:14, Daniel P. Berrangé : > On Thu, Feb 22, 2024 at 12:15:42AM +0300, Michael Tokarev wrote: >> Currently we have: >> >> ./qemu-img resize none +10 >> qemu-img: Could not open 'none': Could not open 'none': No such file or directory >> >> stop printing the message twice, - local_err already has >> all the info, no need to prepend additional text there. >> >> There are a few other places like this, but I'm unsure >> about these. >> >> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> >> --- >> qemu-img.c | 8 +++----- >> 1 file changed, 3 insertions(+), 5 deletions(-) > > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Unfortunately I have to drop this one for now, - it requires much more work. For example, after this we have: -qemu-img: TEST_DIR/t.IMGFMT: Extended L2 entries are only supported with cluster sizes of at least 16384 bytes +qemu-img: Extended L2 entries are only supported with cluster sizes of at least 16384 bytes -qemu-img: Could not open 'TEST_DIR/t.IMGFMT': L1 table is too small +qemu-img: L1 table is too small -qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'foo': No such file or directory +qemu-img: Could not open 'foo': No such file or directory and a few other interesting cases. This whole thing needs a much bigger revisit. /mjt
diff --git a/qemu-img.c b/qemu-img.c index 7668f86769..5a756be600 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -404,7 +404,7 @@ static BlockBackend *img_open_file(const char *filename, } blk = blk_new_open(filename, NULL, options, flags, &local_err); if (!blk) { - error_reportf_err(local_err, "Could not open '%s': ", filename); + error_report_err(local_err); return NULL; } blk_set_enable_write_cache(blk, !writethrough); @@ -597,7 +597,7 @@ static int img_create(int argc, char **argv) bdrv_img_create(filename, fmt, base_filename, base_fmt, options, img_size, flags, quiet, &local_err); if (local_err) { - error_reportf_err(local_err, "%s: ", filename); + error_report_err(local_err); goto fail; } @@ -5253,9 +5253,7 @@ static int img_dd(int argc, char **argv) ret = bdrv_create(drv, out.filename, opts, &local_err); if (ret < 0) { - error_reportf_err(local_err, - "%s: error while creating output image: ", - out.filename); + error_report_err(local_err); ret = -1; goto out; }
Currently we have: ./qemu-img resize none +10 qemu-img: Could not open 'none': Could not open 'none': No such file or directory stop printing the message twice, - local_err already has all the info, no need to prepend additional text there. There are a few other places like this, but I'm unsure about these. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> --- qemu-img.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)