[pve-devel] [PATCH qemu-server 1/2] Add DiskImport module to import external disk images into a VM

Alexandre DERUMIER aderumier at odiso.com
Wed Apr 26 11:32:39 CEST 2017


Thanks wolfgang for the explain.

I didn't notice that we already use zeroinit for qemu-img convert for cloning.


----- Mail original -----
De: "Wolfgang Bumiller" <w.bumiller at proxmox.com>
À: "Alexandre Derumier" <aderumier at odiso.com>
Cc: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Mercredi 26 Avril 2017 10:57:23
Objet: Re: [pve-devel] [PATCH qemu-server 1/2] Add DiskImport module to import external disk images into a VM

On Tue, Apr 25, 2017 at 07:04:31PM +0200, Alexandre DERUMIER wrote: 
> >>> + my $convert_command = ['qemu-img', 'convert', $args->{src_path}, '-p', '-n']; 
> >>> + if ($dst->{has_sparseinit}) { 
> >> 
> >>'has_sparseinit' does not exist in $dst, i guess 'sparseinit' was meant. 
> >> 
> >>> + push @$convert_command, "zeroinit:$dst->{path}"; 
> >>> + } else { 
> >>> + push @$convert_command, $dst->{path}; 
> >>> + } 
> 
> I need to test, but I'm pretty sure that we don't need zeroinit for qemu-img. 
> (as qemu-img skip zero, and don't write them on target). 
> 
> Currently we don't use it for qemu-img convert in offline vm cloning. 
> 
> It's only needed for online qemu drive-mirror. 

It's not specific to online mirroring. The problem is that qemu doesn't 
always know whether the _target_ is zero-initialized, in which case it 
cannot skip writing zeroes one way or another. The worst case there is 
lvm-thin where none of the regular zero-out mechanisms work: BLKDISCARD 
says it doesn't zero (even though it does if you match its discard 
granularity (which you'd definitely do if you discard the entire device 
as initialization), but that's beside the point), fallocate()'s 
PUNCH_HOLE doesn't work since it's not a raw file and BLKZEROOUT will 
fall back to allocating and writing zeroes as well since it follows the 
same rules (it also checks BLKDISCARDZEROES...). 




More information about the pve-devel mailing list