[pve-devel] [PATCH 1/2] rbd: use rbd ls -l

Dietmar Maurer dietmar at proxmox.com
Thu Jan 3 11:48:16 CET 2013


applied.

> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier
> Sent: Donnerstag, 03. Jänner 2013 09:58
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH 1/2] rbd: use rbd ls -l
> 
> avoid to call rbd info for each volume
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/Storage/RBDPlugin.pm |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index
> bbfae7c..1a2e91c 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -44,20 +44,19 @@ my $rados_cmd = sub {  sub rbd_ls {
>      my ($scfg, $storeid) = @_;
> 
> -    my $cmd = &$rbd_cmd($scfg, $storeid, 'ls');
> +    my $cmd = &$rbd_cmd($scfg, $storeid, 'ls', '-l');
> 
>      my $list = {};
> 
>      my $parser = sub {
>  	my $line = shift;
> 
> -	if ($line =~ m/^(vm-(\d+)-\S+)$/) {
> -	    my ($image, $owner) = ($1, $2);
> +	if ($line =~  m/^(vm-(\d+)-disk-\d+)\s+(\d+)M\s((\S+)\/(vm-\d+-
> \S+@\S+))?/) {
> +	    my ($image, $owner, $size, $parent) = ($1, $2, $3, $6);
> 
> -	    my ($size, $parent) = rbd_volume_info($scfg, $storeid, $image);
>  	    $list->{$scfg->{pool}}->{$image} = {
>  		name => $image,
> -		size => $size,
> +		size => $size*1024*1024,
>  		parent => $parent,
>  		vmid => $owner
>  	    };
> --
> 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