[pve-devel] [PATCH] vzdump : fix check if volid exist for "virtual" storage : rbd, sheepdog, nexenta

Alexandre DERUMIER aderumier at odiso.com
Sun Feb 17 08:01:35 CET 2013


>>Thanks. Do you think it would make sense to add: 
>>
>>sub volume_exists($volid) 
>>
>>to our storage library?

Yes, maybe, this can avoid to list all images.

Another way could be to reuse volume_size_info, if the volume don't exist, it should die



By the way, I see in VZdump/QemuServer.pm, just after the if $path exist:

my ($size, $format) = PVE::Storage::Plugin::file_size_info($path);

only use to find format of files.



So maybe can we remove the $path check, and simply replace PVE::Storage::Plugin::file_size_info by PVE::Storage::volume_size_info 
?

----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Samedi 16 Février 2013 19:38:04 
Objet: RE: [pve-devel] [PATCH] vzdump : fix check if volid exist for "virtual" storage : rbd, sheepdog, nexenta 

Thanks. Do you think it would make sense to add: 

sub volume_exists($volid) 

to our storage library? 

> -----Original Message----- 
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel- 
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier 
> Sent: Samstag, 16. Februar 2013 18:23 
> To: pve-devel at pve.proxmox.com 
> Subject: [pve-devel] [PATCH] vzdump : fix check if volid exist for "virtual" 
> storage : rbd, sheepdog, nexenta 
> 
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> --- 
> PVE/VZDump/QemuServer.pm | 14 +++++++++++++- 
> 1 file changed, 13 insertions(+), 1 deletion(-) 
> 
> diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm 
> index ad85cc2..0f2536e 100644 
> --- a/PVE/VZDump/QemuServer.pm 
> +++ b/PVE/VZDump/QemuServer.pm 
> @@ -94,7 +94,19 @@ sub prepare { 
> 
> next if !$path; 
> 
> - die "no such volume '$volid'\n" if ! -e $path; 
> + if (! -e $path){ 
> + my $dl = PVE::Storage::vdisk_list($self->{storecfg}, $storeid, undef); 
> + my $foundvolid = undef; 
> + 
> + PVE::Storage::foreach_volid($dl, sub { 
> + my ($volumeid) = @_; 
> + if($volumeid eq $volid) { 
> + $foundvolid = 1; 
> + return; 
> + } 
> + }); 
> + die "no such volume '$volid'\n" if !$foundvolid; 
> + } 
> 
> my ($size, $format) = PVE::Storage::Plugin::file_size_info($path); 
> 
> -- 
> 1.7.10.4 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 



More information about the pve-devel mailing list