Re: [Qemu-block] [PATCH] block: failed qemu-img command should return non-zero exit code

2016-10-09 Thread Reda Sallahi
On Sun, Oct 09, 2016 at 05:17:27PM +0800, Xu Tian wrote: > If backing file can not open when do qemu-img rebase, var 'ret' not > assign a no-zero value, qemu-img process go out with exit code zero. > > Signed-off-by: Xu Tian > --- > qemu-img.c | 2 ++ > 1 file changed, 2

[Qemu-block] [PATCH 2/2] qemu-img: change opening method for the output in dd

2016-10-07 Thread Reda Sallahi
The subcommand dd was creating an output image regardless of whether there was one already created. With this patch we try to check first if the output image exists and resize it if necessary. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img.c

[Qemu-block] [PATCH 1/2] qemu-img: make img_open() able to surpress file opening errors

2016-10-07 Thread Reda Sallahi
Previously img_open() always printed file opening errors even if the intended action is just to check the file existence as is sometimes the case in qemu-img dd. This adds an argument (openerror) to img_open() that specifies whether to print an opening error or not. Signed-off-by: Reda Sallahi

[Qemu-block] [PATCH 0/2] qemu-img: change img_open() and opening method in dd

2016-10-07 Thread Reda Sallahi
The patch series include the previously submitted patch: [PATCH v5] qemu-img: change opening method for the output in dd Changes from v5: * Replace access() with a modified version of img_open() in img_dd() Depends on: [PATCH v3] qemu-img: add conv=notrunc option to dd Reda Sallahi (2): qemu

[Qemu-block] [PATCH v2 1/7] qemu-img: add seek option to dd

2016-08-26 Thread Reda Sallahi
This patch adds the seek option which allows qemu-img dd to skip a number of blocks on the output before copying the input. A test case was added to test the seek option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> --- qemu

[Qemu-block] [PATCH v2 2/7] qemu-img: add iflag and oflag options to dd

2016-08-26 Thread Reda Sallahi
to their counterparts on GNU dd(1). Two tests were added to test iflag and oflag. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +- qemu-img.c | 172 +++-- qemu-img.texi | 32 +++--

[Qemu-block] [PATCH v2 6/7] qemu-img: clean up dd documentation

2016-08-26 Thread Reda Sallahi
The dd section on qemu-img --help was a bit hard to read since it was not well aligned. This patch fixes the display problem and also makes the sentences on the .texi file more consistent with one another (uppercase and conjugasion). Signed-off-by: Reda Sallahi <fullma...@gmail.com> Re

[Qemu-block] [PATCH v2 0/7] qemu-img dd

2016-08-26 Thread Reda Sallahi
the common part in img_dd_iflag(), img_dd_oflag() and img_dd_conv() into a new function img_dd_flag(). Reda Sallahi (7): qemu-img: add seek option to dd qemu-img: add iflag and oflag options to dd qemu-img: add more conv= conversions to dd qemu-img: delete not used variable and an unecessary

[Qemu-block] [PATCH v2 5/7] qemu-img: add status option to dd

2016-08-26 Thread Reda Sallahi
respectively. A test case was added to test the status option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +-- qemu-img.c | 87 ++ qemu-img.texi | 9 - tests/qemu-iotests/159

[Qemu-block] [PATCH v2 3/7] qemu-img: add more conv= conversions to dd

2016-08-26 Thread Reda Sallahi
This patch adds excl, nocreat, noerror, sync, fsync, fdatasync and sparse to the conversion list. They have the same meaning as the ones on GNU dd(1). Two tests were added to test the conv= option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +-

[Qemu-block] [PATCH v2 7/7] qemu-img: add a test suite for the count option

2016-08-26 Thread Reda Sallahi
The count option for dd lacked a test suite so this adds one with four test cases. Signed-off-by: Reda Sallahi <fullma...@gmail.com> Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> --- tests/qemu-iotests/168 | 75 ++ tests/qemu-iot

Re: [Qemu-block] [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions to dd

2016-08-22 Thread Reda Sallahi
On Mon, Aug 22, 2016 at 09:35:26AM -0400, Stefan Hajnoczi wrote: > On Mon, Aug 22, 2016 at 09:55:13AM +0200, Reda Sallahi wrote: > > @@ -4325,20 +4388,43 @@ static int img_dd(int argc, char **argv) > > > > for (out_pos = out.offset * obsz; in_pos < size; block_cou

Re: [Qemu-block] [PATCH 5/7] qemu-img: add status option to dd

2016-08-22 Thread Reda Sallahi
I should have checked the previous test suites because : Mon, Aug 22, 2016 at 09:55:15AM +0200, Reda Sallahi wrote: > > if (in.offset > INT64_MAX / ibsz || size < in.offset * ibsz) { > -/* We give a warning if the skip option is bigger than the input > -

[Qemu-block] [PATCH 4/7] qemu-img: delete not used variable and an unecessary check

2016-08-22 Thread Reda Sallahi
block_count is not used in img_dd() and the C_SKIP check is unecessary so this patch removes both of them. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index ae3828e..c

[Qemu-block] [PATCH 6/7] qemu-img: clean up dd documentation

2016-08-22 Thread Reda Sallahi
The dd section on qemu-img --help was a bit hard to read since it was not well aligned. This patch fixes the display problem and also makes the sentences on the .texi file more consistent with one another (uppercase and conjugasion). Signed-off-by: Reda Sallahi <fullma...@gmail.com> ---

[Qemu-block] [PATCH 2/7] qemu-img: add iflag and oflag options to dd

2016-08-22 Thread Reda Sallahi
to their counterparts on GNU dd(1). Two tests were added to test iflag and oflag. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +- qemu-img.c | 185 - qemu-img.texi | 32 +++- test

[Qemu-block] [PATCH 7/7] qemu-img: add a test suite for the count option

2016-08-22 Thread Reda Sallahi
The count option for dd lacked a test suite so this adds one with four test cases. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- tests/qemu-iotests/168 | 75 ++ tests/qemu-iotests/168.out | 51 +++ test

[Qemu-block] [PATCH 1/7] qemu-img: add seek option to dd

2016-08-22 Thread Reda Sallahi
This patch adds the seek option which allows qemu-img dd to skip a number of blocks on the output before copying the input. A test case was added to test the seek option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +-- qemu-img.c

[Qemu-block] [PATCH 3/7] qemu-img: add more conv= conversions to dd

2016-08-22 Thread Reda Sallahi
This patch adds excl, nocreat, noerror, sync, fsync, fdatasync and sparse to the conversion list. They have the same meaning as the ones on GNU dd(1). Two tests were added to test the conv= option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +-

[Qemu-block] [PATCH 5/7] qemu-img: add status option to dd

2016-08-22 Thread Reda Sallahi
respectively. A test case was added to test the status option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 +-- qemu-img.c | 90 ++ qemu-img.texi | 9 - tests/qemu-iotests/159

[Qemu-block] [PATCH 0/7] qemu-img dd

2016-08-22 Thread Reda Sallahi
Hi everyone, This patchset adds additional options to qemu-img dd. Depends on: [PATCH v4] qemu-img: change opening method for the output in dd Reda Sallahi (7): qemu-img: add seek option to dd qemu-img: add iflag and oflag options to dd qemu-img: add more conv= conversions to dd qemu

[Qemu-block] [PATCH v4] qemu-img: change opening method for the output in dd

2016-08-20 Thread Reda Sallahi
The subcommand dd was creating an output image regardless of whether there was one already created. With this patch we try to open first the output image and resize it if necessary. We also make it mandatory to specify conv=notrunc when the file already exists. Signed-off-by: Reda Sallahi

Re: [Qemu-block] [Qemu-devel] [PATCH v3] qemu-img: change opening method for the output in dd

2016-08-19 Thread Reda Sallahi
On Tue, Aug 16, 2016 at 12:09:06PM +0100, Stefan Hajnoczi wrote: > On Mon, Aug 15, 2016 at 02:11:49PM +0200, Reda Sallahi wrote: > > +blk2 = blk_new_open(image_opts ? NULL : out.filename, > > +NULL, qoptions, BDRV_O_RDWR, NULL); > > This cod

[Qemu-block] [PATCH v2] qemu-img: change opening method for the output in dd

2016-08-11 Thread Reda Sallahi
dd was creating an output image regardless of whether there was one already created. With this patch we try to open first the output image and resize it if necessary. We also make it mandatory to specify conv=notrunc when the file already exists. Signed-off-by: Reda Sallahi <fullma...@gmail.

[Qemu-block] [PATCH v3] qemu-img: add conv=notrunc option to dd

2016-08-11 Thread Reda Sallahi
This adds the conv=notrunc option to dd which tells dd to not truncate the output. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v5] qemu-img: add skip option to dd Changes from v2: * Delete the mandatory conv=notrunc Changes from v1: * Added comment qemu-img-c

[Qemu-block] [PATCH] qemu-img: change opening method for the output in dd

2016-08-10 Thread Reda Sallahi
dd was creating an output image regardless of whether there was one already created. With this patch we try to open first the output image and resize it if necessary. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v2] qemu-img: add conv=notrunc option to dd qemu

[Qemu-block] [PATCH v2] qemu-img: add conv=notrunc option to dd

2016-08-10 Thread Reda Sallahi
This adds the conv=notrunc option to dd which tells dd to not truncate the output. For the time being we make it mandatory to specify conv=notrunc. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v5] qemu-img: add skip option to dd Changes from v1: * Added c

[Qemu-block] [PATCH] qemu-img: add conv=notrunc option to dd

2016-08-10 Thread Reda Sallahi
This adds the conv=notrunc option to dd which tells dd to not truncate the output. For the time being we make it mandatory to specify conv=notrunc. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 4 ++-- qemu-img.c

[Qemu-block] [PATCH] qemu-img: add seek option to dd

2016-08-10 Thread Reda Sallahi
This patch adds the seek option which allows qemu-img dd to skip a number of blocks on the output before copying the input. A test case was added to test the seek option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v5] qemu-img: add skip option to dd qe

[Qemu-block] [PATCH v5] qemu-img: add skip option to dd

2016-08-10 Thread Reda Sallahi
This adds the skip option which allows qemu-img dd to skip a number of blocks before copying the input. A test case was added to test the skip option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v9] qemu-img: add the 'dd' subcommand Changes from v4: *

Re: [Qemu-block] [PATCH v4] qemu-img: add skip option to dd

2016-08-10 Thread Reda Sallahi
On 8/10/16, Stefan Hajnoczi <stefa...@redhat.com> wrote: > On Mon, Aug 08, 2016 at 01:34:21PM +0200, Reda Sallahi wrote: >> @@ -4111,6 +4139,10 @@ static int img_dd(int argc, char **argv) >> >> in.buf = g_new(uint8_t, in.bsz); >> >> +if (d

[Qemu-block] [PATCH v9] qemu-img: add the 'dd' subcommand

2016-08-09 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v8: * Add an overflow check. Changes from v7: * Remove a C99-style for loop. Changes from v6: * Remove get_size()

[Qemu-block] [PATCH v8] qemu-img: add the 'dd' subcommand

2016-08-09 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v7: * Remove a C99-style for loop. Changes from v6: * Remove get_size() to use qemu_strtosz_suffix() instead. * Type changes fo

[Qemu-block] [PATCH v7] qemu-img: add the 'dd' subcommand

2016-08-09 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v6: * Remove get_size() to use qemu_strtosz_suffix() instead. * Type changes for some fields in DdIo and DdInfo. Changes from v5:

Re: [Qemu-block] [PATCH v6] qemu-img: add the 'dd' subcommand

2016-08-09 Thread Reda Sallahi
Hi Max, Thanks for the review! On 8/8/16, Max Reitz <mre...@redhat.com> wrote: > On 25.07.2016 07:58, Reda Sallahi wrote: >> +if (in->bsz == 0) { >> +error_report("invalid number: '%s'", arg); > > It's not an invalid number, it's just an i

[Qemu-block] [PATCH v4] qemu-img: add skip option to dd

2016-08-08 Thread Reda Sallahi
This adds the skip option which allows qemu-img dd to skip a number of blocks before copying the input. A test case was added to test the skip option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v6] qemu-img: add the 'dd' subcommand Changes from v3: * Change

Re: [Qemu-block] [PATCH v3] qemu-img: add skip option to dd

2016-07-28 Thread Reda Sallahi
On 7/28/16, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Wed, Jul 27, 2016 at 3:51 PM, Reda Sallahi <fullma...@gmail.com> wrote: >> -qemu_opt_set_number(opts, BLOCK_OPT_SIZE, size, _abort); >> +if (dd.flags & C_SKIP && size < in.bsz * in.offs

[Qemu-block] [PATCH v3] qemu-img: add skip option to dd

2016-07-27 Thread Reda Sallahi
This adds the skip option which allows qemu-img dd to skip a number of blocks before copying the input. A test case was added to test the skip option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v6] qemu-img: add the 'dd' subcommand Changes from v2: * Delete

[Qemu-block] [PATCH v2] qemu-img: add skip option to dd

2016-07-27 Thread Reda Sallahi
This adds the skip option which allows qemu-img dd to skip a number of blocks before copying the input. A test case was added to test the skip option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v6] qemu-img: add the 'dd' subcommand Changes from v1: * Chang

[Qemu-block] [PATCH] qemu-img: add skip option to dd

2016-07-27 Thread Reda Sallahi
This adds the skip option which allows qemu-img dd to skip a number of blocks before copying the input. A test case was added to test the skip option. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Depends on: [PATCH v6] qemu-img: add the 'dd' subcommand qemu-img-cmds.hx

[Qemu-block] [PATCH v6] qemu-img: add the 'dd' subcommand

2016-07-25 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v5: * Add dd sections on qemu-img.texi. Changes from v4: * Fix the exit status. Changes from v3: * Delete an unused (so far)

[Qemu-block] [PATCH] qemu-img: fix error messages emitted by img_open()

2016-07-21 Thread Reda Sallahi
. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 2e40e1f..dc6652d 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -268,7 +268,7 @@ static BlockBackend *img_open_opts(const char *

[Qemu-block] [PATCH v5] qemu-img: add the 'dd' subcommand

2016-07-20 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v4: * Fix the exit status. Changes from v3: * Delete an unused (so far) field in DdIo. Changes from v2: * Add copyright h

[Qemu-block] [PATCH v4] qemu-img: add the 'dd' subcommand

2016-07-19 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v3: * Delete an unused (so far) field in DdIo. Changes from v2: * Add copyright headers to new files. Changes from v1: * R

[Qemu-block] [PATCH v3] qemu-img: add the 'dd' subcommand

2016-07-18 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v2: * Added copyright headers to new files. Changes from v1: * Removal of dead code. * Fix a memory leak. * Complete the c

[Qemu-block] [PATCH v2] qemu-img: add the 'dd' subcommand

2016-07-18 Thread Reda Sallahi
for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- Changes from v1: * Removal of dead code. * Fix a memory leak. * Complete the cleanup function in the test cases. qemu-img-cmds.hx

[Qemu-block] [PATCH] qemu-img: add the 'dd' subcommand

2016-07-13 Thread Reda Sallahi
for the output if the raw format is not the intended one. get_size() was needed for the size syntax dd(1) supports which is different from qemu_strtosz_suffix(). Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 6 +

[Qemu-block] [PATCH v2] vmdk: fix metadata write regression

2016-07-07 Thread Reda Sallahi
ew cluster which hasn't been allocated before or a zero grain. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- v2: Corrected the commit id referenced in the commit message. block/vmdk.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/block/vmdk.c b/bl

[Qemu-block] [PATCH] vmdk: fix metadata write regression

2016-07-07 Thread Reda Sallahi
ew cluster which hasn't been allocated before or a zero grain. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- block/vmdk.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index d73f431..1cbd487 100644 --- a/block/vmdk.c ++

[Qemu-block] [PATCH RFC 1/1] qemu-img: add the 'dd' subcommand

2016-06-22 Thread Reda Sallahi
for the output if the raw format is not the intended one. get_size() and get_offset() were needed for the size syntax dd(1) supports which is different from qemu_strtosz_suffix. Signed-off-by: Reda Sallahi <fullma...@gmail.com> --- qemu-img-cmds.hx | 6 + qemu-img.c

[Qemu-block] [PATCH RFC 0/1] Subcommand dd for qemu-img

2016-06-22 Thread Reda Sallahi
). There is no output with statistics for now so this acts like dd status=none. Reda Sallahi (1): qemu-img: add the 'dd' subcommand qemu-img-cmds.hx | 6 + qemu-img.c | 833 ++- 2 files changed, 838 insertions(+), 1 deletion(-) -- 2.9.0