[libvirt-users] Shouldn't vol-upload / virStorageVolUpload() be doing some format conversion?

Guido Winkelmann guido-libvi at unknownsite.de
Fri Apr 12 18:06:57 UTC 2013


Hi,

I just tried using vol-update to copy an image file to a storage pool, and I 
noticed that, at least in my configuration (qemu backend, storage pool of type 
"dir"), this command does not appear to be doing any kind of format 
conversion. It simply copied the source file as-is over the file in which the 
target volume was stored with no checks whether that even makes sense.

The help text to this command says it supports offset and length, which - 
kinda, sorta - implies that I can write a block of bytes at offset n to a 
volume, attach that volume to a domain, and then the OS in the guest domain 
will find exactly the bytes I just wrote at exactly offset n in its newly 
attached harddisk/CDROM/whatever. Instead, trying to this with anything but 
raw images would probably just break the image file.

AFAICS, in its current form, this command and this API-call are only useful in 
exactly two scenarios:

- Both the source and target image are in raw format

- Source and target image are in the same non-raw format (like qcow2 or vmdk) 
AND you are copying the entire volume at once.

In all other cases - source and target are in different formats, source and 
target are in non-raw and you are trying to write only parts of a volume - 
this can only lead to a broken image file.

As far as I see it, at the layer of abstraction libvirt offers, "volume" 
should not be synonymous with "the file the file the volume is stored in on 
disk", but rather with "the volume as a guest machine will get to see it".

Regards,

	Guido




More information about the libvirt-users mailing list