qcow2 and rbd driver question
Hi Kevin,
I'm working on an issue where I'm not able to create a qcow2 image with the rbd driver (https://bugzilla.redhat.com/show_bug.cgi?id=1171007).
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 write operation exceeds the maximum size and then I'll resize the file. It works, but I'm not sure it is the right way.
I also checked the RBD API, but I didn't find any useful function or flags that allow writes to increase file size.
Any suggestions?
Thank you very much,
Stefano