On Mon, Dec 07, 2020 at 06:16:04PM +0100, Philippe Mathieu-Daudé wrote:
> On 12/4/20 11:28 PM, Philippe Mathieu-Daudé wrote:
> > On 12/4/20 5:57 PM, Philippe Mathieu-Daudé wrote:
> >> The NVMe driver does not support image creation.
> >> The full drive has to be passed to the guest.
> >>
> >> Before:
> >>
> >>   $ qemu-img create -f raw nvme://0000:04:00.0/1 20G
> >>   Formatting 'nvme://0000:04:00.0/1', fmt=raw size=21474836480
> >>
> >>   $ qemu-img info nvme://0000:04:00.0/1
> >>   image: nvme://0000:04:00.0/1
> >>   file format: raw
> >>   virtual size: 349 GiB (375083606016 bytes)
> >>   disk size: unavailable
> 
> Maybe I should not forbid all formats... But 'raw' is kinda
> dangerous, as there is no way to enforce the next layer to
> access beside the size allocated.
> 
> Safe drive partitioning can be achieved creating namespaces,
> feature which is not yet implemented.

I don't see the need for this patch. Or if there is a need then
block/file-posix.c, block/iscsi.c, and block/nbd.c should also be
changed (anything that uses bdrv_co_create_opts_simple()).

Instead I suggest adding a warning at creation time if a raw format
image is created on top of a BDS that is larger than requested. The
warning should remind the user that they need to use the raw format
drivers's size= open option to restrict the disk capacity when opening
the image.

Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to