[pve-devel] r6066 - in pve-manager/pve2: bin lib/PVE/API2
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue May 31 12:20:49 CEST 2011
Author: dietmar
Date: 2011-05-31 12:20:48 +0200 (Tue, 31 May 2011)
New Revision: 6066
Modified:
pve-manager/pve2/bin/pvesh
pve-manager/pve2/lib/PVE/API2/Cluster.pm
Log:
remove unused code
Modified: pve-manager/pve2/bin/pvesh
===================================================================
--- pve-manager/pve2/bin/pvesh 2011-05-31 09:49:32 UTC (rev 6065)
+++ pve-manager/pve2/bin/pvesh 2011-05-31 10:20:48 UTC (rev 6066)
@@ -1,9 +1,6 @@
#!/usr/bin/perl -w
-# NOTE: this is just an experimental prototype
-
# TODO:
-# implement auto-completion
# implement persistent history ?
use strict;
Modified: pve-manager/pve2/lib/PVE/API2/Cluster.pm
===================================================================
--- pve-manager/pve2/lib/PVE/API2/Cluster.pm 2011-05-31 09:49:32 UTC (rev 6065)
+++ pve-manager/pve2/lib/PVE/API2/Cluster.pm 2011-05-31 10:20:48 UTC (rev 6066)
@@ -41,8 +41,6 @@
my $result = [
{ name => 'log' },
{ name => 'resources' },
- { name => 'vms' },
- { name => 'storage' },
{ name => 'tasks' },
];
@@ -90,135 +88,7 @@
return $res->{data};
}});
-__PACKAGE__->register_method ({
- name => 'storage',
- path => 'storage',
- method => 'GET',
- permissions => { user => 'all' },
- description => "Cluster wide storage status.",
- parameters => {
- additionalProperties => 0,
- properties => {},
- },
- returns => {
- type => 'array',
- items => {
- type => "object",
- properties => {},
- },
- },
- code => sub {
- my ($param) = @_;
-
- my $rpcenv = PVE::RPCEnvironment::get();
- my $user = $rpcenv->get_user();
-
- my $nodes = PVE::Cluster::get_nodelist();
-
- my $cfg = PVE::Storage::config();
-
- my @sids = PVE::Storage::storage_ids ($cfg);
-
- my $rrd = PVE::Cluster::rrd_dump();
-
- my $res = [];
- foreach my $storeid (@sids) {
- my $scfg = PVE::Storage::storage_config ($cfg, $storeid);
-
- next if !$rpcenv->check($user, "/storage/$storeid", [ 'Datastore.Audit' ]);
-
- # we create a entry for each node
- foreach my $node (@$nodes) {
- # fixme: check if storage is available on this node
- my $entry = {
- name => "$storeid ($node)",
- storage => $storeid,
- node => $node,
- type => $scfg->{type},
- shared => $scfg->{shared},
- };
-
- if (my $d = $rrd->{"pve2-storage/$node/$storeid"}) {
- $entry->{maxdisk} = $d->[1];
- $entry->{disk} = $d->[2];
- }
-
- push @$res, $entry;
-
- }
- }
-
- return $res;
- }});
-
__PACKAGE__->register_method({
- name => 'vms',
- path => 'vms',
- method => 'GET',
- description => "Virtual machine index (cluster wide).",
- permissions => { user => 'all' },
- parameters => {
- additionalProperties => 0,
- properties => {},
- },
- returns => {
- type => 'array',
- items => {
- type => "object",
- properties => {
- id => { type => 'integer' },
- },
- },
- },
- code => sub {
- my ($param) = @_;
-
- my $rpcenv = PVE::RPCEnvironment::get();
- my $user = $rpcenv->get_user();
-
- my $vmlist = PVE::Cluster::get_vmlist();
- my $res = [];
-
- return $res if !$vmlist;
-
- my $rrd = PVE::Cluster::rrd_dump();
-
- my $idlist = $vmlist->{ids};
- return $res if !$idlist;
-
- foreach my $vmid (keys %$idlist) {
- my $data = $idlist->{$vmid};
-
- next if !$rpcenv->check($user, "/vms/$vmid", [ 'VM.Audit' ]);
-
- my $entry = {
- id => $vmid,
- name => "VM $vmid",
- node => $data->{node},
- type => $data->{type},
- };
-
- if (my $d = $rrd->{"pve2-vm/$vmid"}) {
-
- $entry->{uptime} = $d->[0];
- $entry->{name} = $d->[1];
-
- $entry->{maxcpu} = $d->[3];
- $entry->{cpu} = $d->[4];
- $entry->{maxmem} = $d->[5];
- $entry->{mem} = $d->[6];
- $entry->{maxdisk} = $d->[7];
- $entry->{disk} = $d->[8];
- }
-
- push @$res, $entry;
-
- }
-
- return $res;
- }});
-
-__PACKAGE__->register_method({
name => 'resources',
path => 'resources',
method => 'GET',
More information about the pve-devel
mailing list