[pve-devel] r5063 - in pve-storage/pve2: . PVE/API2/Storage

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Aug 26 12:32:29 CEST 2010


Author: dietmar
Date: 2010-08-26 10:32:29 +0000 (Thu, 26 Aug 2010)
New Revision: 5063

Modified:
   pve-storage/pve2/ChangeLog
   pve-storage/pve2/PVE/API2/Storage/Content.pm
   pve-storage/pve2/Storage.pm
   pve-storage/pve2/pvesm
Log:
	* Storage.pm (vdisk_list): return full volid instead of volume name.
	(template_list): return full volid instead of volume name.


Modified: pve-storage/pve2/ChangeLog
===================================================================
--- pve-storage/pve2/ChangeLog	2010-08-26 10:31:53 UTC (rev 5062)
+++ pve-storage/pve2/ChangeLog	2010-08-26 10:32:29 UTC (rev 5063)
@@ -1,3 +1,8 @@
+2010-08-26  Proxmox Support Team  <support at proxmox.com>
+
+	* Storage.pm (vdisk_list): return full volid instead of volume name.
+	(template_list): return full volid instead of volume name.
+
 2010-08-25  Proxmox Support Team  <support at proxmox.com>
 
 	* pvesm: use new PVE::CLIHandler

Modified: pve-storage/pve2/PVE/API2/Storage/Content.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Content.pm	2010-08-26 10:31:53 UTC (rev 5062)
+++ pve-storage/pve2/PVE/API2/Storage/Content.pm	2010-08-26 10:32:29 UTC (rev 5063)
@@ -42,12 +42,12 @@
 	items => {
 	    type => "object",
 	    properties => { 
-		volname => { 
+		volid => { 
 		    type => 'string' 
 		} 
 	    },
 	},
-	links => [ { rel => 'child', href => "{volname}" } ],
+	links => [ { rel => 'child', href => "{volid}" } ],
     },
     code => sub {
 	my ($param) = @_;

Modified: pve-storage/pve2/Storage.pm
===================================================================
--- pve-storage/pve2/Storage.pm	2010-08-26 10:31:53 UTC (rev 5062)
+++ pve-storage/pve2/Storage.pm	2010-08-26 10:32:29 UTC (rev 5063)
@@ -1860,17 +1860,17 @@
 		if ($tt eq 'iso') {
 		    next if $fn !~ m!/([^/]+\.[Ii][Ss][Oo])$!;
 
-		    $info = { volname => "iso/$1", format => 'iso' };
+		    $info = { volid => "$sid:iso/$1", format => 'iso' };
 
 		} elsif ($tt eq 'vztmpl') {
 		    next if $fn !~ m!/([^/]+\.tar\.gz)$!;
 
-		    $info = { volname => "vztmpl/$1", format => 'tgz' };
+		    $info = { volid => "$sid:vztmpl/$1", format => 'tgz' };
 
 		} elsif ($tt eq 'backup') {
 		    next if $fn !~ m!/([^/]+\.(tar|tgz))$!;
 		    
-		    $info = { volname => "backup/$1", format => $2 };
+		    $info = { volid => "$sid:backup/$1", format => $2 };
 		}
 
 		$info->{size} = -s $fn;
@@ -1880,7 +1880,7 @@
 
 	}
 
-	@{$res->{$sid}} = sort {lc($a->{volname}) cmp lc ($b->{volname}) } @{$res->{$sid}} if $res->{$sid};
+	@{$res->{$sid}} = sort {lc($a->{volid}) cmp lc ($b->{volid}) } @{$res->{$sid}} if $res->{$sid};
     }
 
     return $res;
@@ -1979,10 +1979,10 @@
 
 		my $owner = $2;
 		my $name = $3;
-		my $volname = "$owner/$name";
+		my $volid = "$sid:$owner/$name";
 
 		if ($vollist) {
-		    my $found = grep { $_ eq "$sid:$volname" } @$vollist;
+		    my $found = grep { $_ eq $volid } @$vollist;
 		    next if !$found;
 		} else {
 		    next if defined ($vmid) && ($owner ne $vmid);
@@ -1992,7 +1992,7 @@
 
 		if ($format && $size) {
 		    push @{$res->{$sid}}, { 
-			volname => $volname, format => $format,
+			volid => $volid, format => $format,
 			size => $size, vmid => $owner, used => $used };
 		}
 
@@ -2008,15 +2008,17 @@
 
 		    my $owner = $dat->{$volname}->{vmid};
 
+		    my $volid = "$sid:$volname";
+
 		    if ($vollist) {
-			my $found = grep { $_ eq "$sid:$volname" } @$vollist;
+			my $found = grep { $_ eq $volid } @$vollist;
 			next if !$found;
 		    } else {
 			next if defined ($vmid) && ($owner ne $vmid);
 		    }
 
 		    my $info = $dat->{$volname};
-		    $info->{volname} = $volname;
+		    $info->{volid} = $volid;
 
 		    push @{$res->{$sid}}, $info;
 		}
@@ -2032,15 +2034,17 @@
 
 		foreach my $volname (keys %$dat) {
 
+		    my $volid = "$sid:$volname";
+
 		    if ($vollist) {
-			my $found = grep { $_ eq "$sid:$volname" } @$vollist;
+			my $found = grep { $_ eq $volid } @$vollist;
 			next if !$found;
 		    } else {
 			next if !($storeid && ($storeid eq $sid));
 		    }
 
 		    my $info = $dat->{$volname};
-		    $info->{volname} = $volname;
+		    $info->{volid} = $volid;
 
 		    push @{$res->{$sid}}, $info;
 		}
@@ -2050,7 +2054,7 @@
 	    die "implement me";
 	}
 
-	@{$res->{$sid}} = sort {lc($a->{volname}) cmp lc ($b->{volname}) } @{$res->{$sid}} if $res->{$sid};
+	@{$res->{$sid}} = sort {lc($a->{volid}) cmp lc ($b->{volid}) } @{$res->{$sid}} if $res->{$sid};
     }
 
     return $res;

Modified: pve-storage/pve2/pvesm
===================================================================
--- pve-storage/pve2/pvesm	2010-08-26 10:31:53 UTC (rev 5062)
+++ pve-storage/pve2/pvesm	2010-08-26 10:32:29 UTC (rev 5063)
@@ -144,21 +144,17 @@
 my $print_content = sub {
     my ($list) = @_;
 
-    # fixme: my $volid = "$sid:$volname"; ?
-
     my $maxlenname = 0;
     foreach my $info (@$list) {
 
-	my $volname = $info->{volname};
-	my $volid = "$volname";
+	my $volid = $info->{volid};
 	my $sidlen =  length ($volid);
 	$maxlenname = $sidlen if $sidlen > $maxlenname;
     }
 
     foreach my $info (@$list) {
-	my $volname = $info->{volname};
-	my $volid = "$volname";
 	next if !$info->{vmid};
+	my $volid = $info->{volid};
 
 	printf "%-${maxlenname}s %5s %10d %d\n", $volid, 
 	$info->{format}, $info->{size}, $info->{vmid}; 
@@ -166,8 +162,7 @@
 
     foreach my $info (sort { $a->{format} cmp $b->{format} } @$list) {
 	next if $info->{vmid};
-	my $volname = $info->{volname};
-	my $volid = "$volname";
+	my $volid = $info->{volid};
 
 	printf "%-${maxlenname}s %5s %10d\n", $volid, 
 	$info->{format}, $info->{size}; 



More information about the pve-devel mailing list