[PATCH 0/2] Fix the generic image creation code

Maxim Levitsky posted 2 patches 4 years, 1 month ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200326011218.29230-1-mlevitsk@redhat.com
Maintainers: "Richard W.M. Jones" <rjones@redhat.com>, Jason Dillaman <dillaman@redhat.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Jeff Cody <codyprime@gmail.com>, Peter Lieven <pl@kamp.de>, Liu Yuan <namei.unix@gmail.com>, Stefan Hajnoczi <stefanha@redhat.com>, "Denis V. Lunev" <den@openvz.org>, Fam Zheng <fam@euphon.net>, Ronnie Sahlberg <ronniesahlberg@gmail.com>, Stefan Weil <sw@weilnetz.de>, Paolo Bonzini <pbonzini@redhat.com>, Eric Blake <eblake@redhat.com>
block.c                   | 38 ++++++++++++++++++++++----------------
block/crypto.c            |  3 ++-
block/file-posix.c        | 11 +++++++++--
block/file-win32.c        |  4 +++-
block/gluster.c           |  3 ++-
block/iscsi.c             | 16 ++++------------
block/nbd.c               |  6 ++++++
block/nfs.c               |  4 +++-
block/nvme.c              |  3 +++
block/parallels.c         |  3 ++-
block/qcow.c              |  3 ++-
block/qcow2.c             |  4 +++-
block/qed.c               |  3 ++-
block/raw-format.c        |  4 +++-
block/rbd.c               |  3 ++-
block/sheepdog.c          |  4 +++-
block/ssh.c               |  4 +++-
block/vdi.c               |  4 +++-
block/vhdx.c              |  3 ++-
block/vmdk.c              |  4 +++-
block/vpc.c               |  6 ++++--
include/block/block.h     |  7 +++++++
include/block/block_int.h |  3 ++-
23 files changed, 95 insertions(+), 48 deletions(-)
[PATCH 0/2] Fix the generic image creation code
Posted by Maxim Levitsky 4 years, 1 month ago
The recent patches from Max Reitz allowed some block drivers to not
provide the .bdrv_co_create_opts and still allow qemu-img to
create/format images as long as the image is already existing
(that is the case with various block storage drivers like nbd/iscsi/nvme, etc)

However it was found out that some places in the code depend on the
.bdrv_co_create_opts/.create_opts to be != NULL to decide if to allow
image creation.

To avoid adding failback code to all these places, just make generic failback
code be used by the drivers that need it, so that for outside user, there
is no diffirence if failback was used or not.

Best regards,
	Maxim Levitsky

Maxim Levitsky (2):
  block: pass BlockDriver reference to the .bdrv_co_create
  block: trickle down the fallback image creation function use to the
    block drivers

 block.c                   | 38 ++++++++++++++++++++++----------------
 block/crypto.c            |  3 ++-
 block/file-posix.c        | 11 +++++++++--
 block/file-win32.c        |  4 +++-
 block/gluster.c           |  3 ++-
 block/iscsi.c             | 16 ++++------------
 block/nbd.c               |  6 ++++++
 block/nfs.c               |  4 +++-
 block/nvme.c              |  3 +++
 block/parallels.c         |  3 ++-
 block/qcow.c              |  3 ++-
 block/qcow2.c             |  4 +++-
 block/qed.c               |  3 ++-
 block/raw-format.c        |  4 +++-
 block/rbd.c               |  3 ++-
 block/sheepdog.c          |  4 +++-
 block/ssh.c               |  4 +++-
 block/vdi.c               |  4 +++-
 block/vhdx.c              |  3 ++-
 block/vmdk.c              |  4 +++-
 block/vpc.c               |  6 ++++--
 include/block/block.h     |  7 +++++++
 include/block/block_int.h |  3 ++-
 23 files changed, 95 insertions(+), 48 deletions(-)

-- 
2.17.2


Re: [PATCH 0/2] Fix the generic image creation code
Posted by Denis V. Lunev 4 years, 1 month ago
On 3/26/20 4:12 AM, Maxim Levitsky wrote:
> The recent patches from Max Reitz allowed some block drivers to not
> provide the .bdrv_co_create_opts and still allow qemu-img to
> create/format images as long as the image is already existing
> (that is the case with various block storage drivers like nbd/iscsi/nvme, etc)
>
> However it was found out that some places in the code depend on the
> .bdrv_co_create_opts/.create_opts to be != NULL to decide if to allow
> image creation.
>
> To avoid adding failback code to all these places, just make generic failback
> code be used by the drivers that need it, so that for outside user, there
> is no diffirence if failback was used or not.
>
> Best regards,
> 	Maxim Levitsky
>
> Maxim Levitsky (2):
>   block: pass BlockDriver reference to the .bdrv_co_create
>   block: trickle down the fallback image creation function use to the
>     block drivers
>
>  block.c                   | 38 ++++++++++++++++++++++----------------
>  block/crypto.c            |  3 ++-
>  block/file-posix.c        | 11 +++++++++--
>  block/file-win32.c        |  4 +++-
>  block/gluster.c           |  3 ++-
>  block/iscsi.c             | 16 ++++------------
>  block/nbd.c               |  6 ++++++
>  block/nfs.c               |  4 +++-
>  block/nvme.c              |  3 +++
>  block/parallels.c         |  3 ++-
>  block/qcow.c              |  3 ++-
>  block/qcow2.c             |  4 +++-
>  block/qed.c               |  3 ++-
>  block/raw-format.c        |  4 +++-
>  block/rbd.c               |  3 ++-
>  block/sheepdog.c          |  4 +++-
>  block/ssh.c               |  4 +++-
>  block/vdi.c               |  4 +++-
>  block/vhdx.c              |  3 ++-
>  block/vmdk.c              |  4 +++-
>  block/vpc.c               |  6 ++++--
>  include/block/block.h     |  7 +++++++
>  include/block/block_int.h |  3 ++-
>  23 files changed, 95 insertions(+), 48 deletions(-)
>
Reviewed-by: Denis V. Lunev <den@openvz.org>

Re: [PATCH 0/2] Fix the generic image creation code
Posted by Max Reitz 4 years, 1 month ago
On 26.03.20 02:12, Maxim Levitsky wrote:
> The recent patches from Max Reitz allowed some block drivers to not
> provide the .bdrv_co_create_opts and still allow qemu-img to
> create/format images as long as the image is already existing
> (that is the case with various block storage drivers like nbd/iscsi/nvme, etc)
> 
> However it was found out that some places in the code depend on the
> .bdrv_co_create_opts/.create_opts to be != NULL to decide if to allow
> image creation.
> 
> To avoid adding failback code to all these places, just make generic failback
> code be used by the drivers that need it, so that for outside user, there
> is no diffirence if failback was used or not.
> 
> Best regards,
> 	Maxim Levitsky
> 
> Maxim Levitsky (2):
>   block: pass BlockDriver reference to the .bdrv_co_create
>   block: trickle down the fallback image creation function use to the
>     block drivers

Thanks, fixed the function parameter alignment, moved the declarations
from block.h into block_int.h, and applied the series to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max

Re: [PATCH 0/2] Fix the generic image creation code
Posted by Max Reitz 4 years, 1 month ago
On 26.03.20 13:23, Max Reitz wrote:
> On 26.03.20 02:12, Maxim Levitsky wrote:
>> The recent patches from Max Reitz allowed some block drivers to not
>> provide the .bdrv_co_create_opts and still allow qemu-img to
>> create/format images as long as the image is already existing
>> (that is the case with various block storage drivers like nbd/iscsi/nvme, etc)
>>
>> However it was found out that some places in the code depend on the
>> .bdrv_co_create_opts/.create_opts to be != NULL to decide if to allow
>> image creation.
>>
>> To avoid adding failback code to all these places, just make generic failback
>> code be used by the drivers that need it, so that for outside user, there
>> is no diffirence if failback was used or not.
>>
>> Best regards,
>> 	Maxim Levitsky
>>
>> Maxim Levitsky (2):
>>   block: pass BlockDriver reference to the .bdrv_co_create
>>   block: trickle down the fallback image creation function use to the
>>     block drivers
> 
> Thanks, fixed the function parameter alignment, moved the declarations
> from block.h into block_int.h, and applied the series to my block branch:

(And the spelling fixes suggested by Eric)

> https://git.xanclic.moe/XanClic/qemu/commits/branch/block
> 
> Max
>