[Qemu-devel] [PATCH RFC 0/1] block/rbd: increase dynamically the image size

Stefano Garzarella posted 1 patch 5 years ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190411105025.97397-1-sgarzare@redhat.com
Maintainers: Max Reitz <mreitz@redhat.com>, Josh Durgin <jdurgin@redhat.com>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
block/rbd.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
[Qemu-devel] [PATCH RFC 0/1] block/rbd: increase dynamically the image size
Posted by Stefano Garzarella 5 years ago
RBD APIs don't allow us to write more than the maximum size of the file set
with rbd_create() or rbd_resize(), so we are not able to create/use a qcow2
image with the rbd driver.

What I found is the following:
- when qcow2 uses the rbd driver, the new file is created (rbd_create)
  with the size equals to 0. (qemu_opt_get_size_del(opts,
  BLOCK_OPT_SIZE, 0) returns 0 in qemu_rbd_co_create_opts())
- the file is truncated (implemented with rbd_resize) to 0 before to
  write the qcow2 header.
- the "size" parameter passed to rbd_create() or rbd_resize() is
  interpreted as the maximum size of the file, this means that all
  writes that exceed that size, fails and returns -22.

As a workaround, I'm checking if the RW operations exceed the maximum
size and then I'll resize the file. It works, but I'm not sure it is the
right way.

Any suggestions?

Thanks,
Stefano

Stefano Garzarella (1):
  block/rbd: increase dynamically the image size

 block/rbd.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

-- 
2.20.1