]> git.proxmox.com Git - pve-access-control.git/commitdiff
return array instead of hash
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 26 Jan 2012 12:02:07 +0000 (13:02 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 26 Jan 2012 12:02:07 +0000 (13:02 +0100)
PVE/API2/Pool.pm

index f224777cc6fdcd837cda2312eddef0d356d95c2b..c4b1e20793b6478805986f70c707ca07e163d752 100644 (file)
@@ -214,7 +214,19 @@ __PACKAGE__->register_method ({
            poolid => {type => 'string', format => 'pve-poolid' },
        },
     },
            poolid => {type => 'string', format => 'pve-poolid' },
        },
     },
-    returns => {},
+    returns => {
+       type => 'array',
+       items => {
+           type => "object",
+           additionalProperties => 0,
+           properties => {
+               type => { type => 'string', enum => ['vm', 'storage'] },
+               id => { type => 'string' },
+               vmid => { type => 'integer', optional => 1 },
+               storage => { type => 'string', optional => 1 },
+           },
+       },
+    },
     code => sub {
        my ($param) = @_;
 
     code => sub {
        my ($param) = @_;
 
@@ -227,7 +239,25 @@ __PACKAGE__->register_method ({
        die "pool '$pool' does not exist\n" 
            if !$data;
  
        die "pool '$pool' does not exist\n" 
            if !$data;
  
-       return &$extract_pool_data($data, 1);
+       my $res = [];
+
+       foreach my $vmid (keys %{$data->{vms}}) {
+           push @$res, {
+               id => "vm/$vmid",
+               vmid => $vmid + 0, 
+               type => 'vm',
+           };
+       }
+
+       foreach my $storage (keys %{$data->{storage}}) {
+           push @$res, {
+               id => "storage/$storage",
+               storage => $storage, 
+               type => 'storage',
+           };
+       }
+
+       return $res;
     }});
 
 
     }});