From: Dietmar Maurer Date: Thu, 26 Jan 2012 12:46:31 +0000 (+0100) Subject: fix return format X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=commitdiff_plain;h=9a53427a8e076e8cf22d032908e5b539ea0fcb6c;hp=cab28ea50b815419dc4a4dc15ac220c2ca170f38 fix return format --- diff --git a/PVE/API2/Pool.pm b/PVE/API2/Pool.pm index f95df28..08823f6 100644 --- a/PVE/API2/Pool.pm +++ b/PVE/API2/Pool.pm @@ -184,7 +184,6 @@ __PACKAGE__->register_method ({ return undef; }}); -# fixme: return format! __PACKAGE__->register_method ({ name => 'read_pool', path => '{poolid}', @@ -200,15 +199,22 @@ __PACKAGE__->register_method ({ }, }, 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 }, + type => "object", + additionalProperties => 0, + properties => { + comment => { type => 'string', optional => 1 }, + members => { + 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 }, + }, + }, }, }, }, @@ -224,10 +230,10 @@ __PACKAGE__->register_method ({ die "pool '$pool' does not exist\n" if !$data; - my $res = []; + my $members = []; foreach my $vmid (keys %{$data->{vms}}) { - push @$res, { + push @$members, { id => "vm/$vmid", vmid => $vmid + 0, type => 'vm', @@ -235,13 +241,16 @@ __PACKAGE__->register_method ({ } foreach my $storage (keys %{$data->{storage}}) { - push @$res, { + push @$members, { id => "storage/$storage", storage => $storage, type => 'storage', }; } + my $res = { members => $members }; + $res->{comment} = $data->{comment} if defined($data->{comment}); + return $res; }});