[pve-devel] r5514 - in qemu-server/pve2: . PVE/API2 PVE/API2/Qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Feb 11 13:32:25 CET 2011


Author: dietmar
Date: 2011-02-11 13:32:25 +0100 (Fri, 11 Feb 2011)
New Revision: 5514

Removed:
   qemu-server/pve2/PVE/API2/Qemu.pm
   qemu-server/pve2/PVE/API2/Qemu/Status.pm
   qemu-server/pve2/PVE/API2/Qemu/VNC.pm
Modified:
   qemu-server/pve2/ChangeLog
   qemu-server/pve2/PVE/API2/Makefile
   qemu-server/pve2/PVE/API2/Qemu/Config.pm
   qemu-server/pve2/PVE/API2/Qemu/Makefile
   qemu-server/pve2/qm
Log:
cleanup API Object hierarchiy


Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/ChangeLog	2011-02-11 12:32:25 UTC (rev 5514)
@@ -1,3 +1,13 @@
+2011-02-11  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/API2/Qemu/VNC.pm: moved code to Config.pm
+
+	* PVE/API2/Qemu/Status.pm: moved code to Config.pm
+
+	* PVE/API2/*: cleanup API Object hierarchiy
+
+	* PVE/API2/Qemu.pm: remove (no longer needed)
+
 2011-01-28  Proxmox Support Team  <support at proxmox.com>
 
 	* qm (vncticket): removed - we don't need that anymore 

Modified: qemu-server/pve2/PVE/API2/Makefile
===================================================================
--- qemu-server/pve2/PVE/API2/Makefile	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/PVE/API2/Makefile	2011-02-11 12:32:25 UTC (rev 5514)
@@ -1,5 +1,4 @@
 
 .PHONY: install
 install:
-	install -D -m 0644 Qemu.pm ${DESTDIR}${PERLDIR}/PVE/API2/Qemu.pm
 	make -C Qemu install

Modified: qemu-server/pve2/PVE/API2/Qemu/Config.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/Config.pm	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/PVE/API2/Qemu/Config.pm	2011-02-11 12:32:25 UTC (rev 5514)
@@ -12,26 +12,11 @@
 use PVE::RESTHandler;
 use PVE::QemuServer;
 use PVE::RPCEnvironment;
+use PVE::AccessControl;
+use PVE::INotify;
 
 use Data::Dumper; # fixme: remove
 
-# API URLs
-#
-## GET    /vms/
-## GET    /vms/index  status of all VMs (cluster wide)
-
-# GET    /vms/qemu/config/{node}/  list of all Qemu VMs (per node)
-# POST   /vms/qemu/config/{node}/  create VM
-# GET    /vms/qemu/config/{node}/{vmid}  get VM config
-# PUT    /vms/qemu/config/{node}/{vmid}  set VM config
-# DELETE /vms/qemu/config/{node}/{vmid}  destroy VM
-
-# GET    /vms/qemu/status/{node}/  status of all Qemu VMs (per node)
-# GET    /vms/qemu/status/{node}/{vmid}  get VM status
-# PUT    /vms/qemu/status/{node}/{vmid}  set VM status
-
-# POST    /vms/qemu/vncproxy  create vnc proxy
-
 use base qw(PVE::RESTHandler);
 
 my $opt_force_description = "Force physical removal. Without this, we simple remove the disk from the config file and create an additional configuration entry called 'unused[n]', which contains the volume ID. Unlink of unused[n] always cause physical removal.";
@@ -48,35 +33,12 @@
 
 __PACKAGE__->register_method ({
     name => 'index', 
-    path => '',  
+    path => '', 
     method => 'GET',
-    description => "List cluster nodes.",
+    description => "Virtual machine index (per node).",
+    proxyto => 'node',
     parameters => {
     	additionalProperties => 0,
-	properties => {},
-    },
-    returns => {
-	type => 'array',
-	items => {
-	    type => "object",
-	    properties => { node => { type => 'string' } },
-	},
-	links => [ { rel => 'child', href => "{node}" } ],
-    },
-    code => sub {
-	my ($param) = @_;
-
-	my $rpcenv = PVE::RPCEnvironment::get();
-	return PVE::Cluster::get_nodelist();
-    }});
-
-__PACKAGE__->register_method ({
-    name => 'vmlist', 
-    path => '{node}', 
-    method => 'GET',
-    description => "Virtual machine index.",
-    parameters => {
-    	additionalProperties => 0,
 	properties => {
 	    node => get_standard_option('pve-node'),
 	},
@@ -100,9 +62,11 @@
 
 __PACKAGE__->register_method ({
     name => 'create_vm', 
-    path => '{node}', 
+    path => '', 
     method => 'POST',
     description => "Create new virtual machine.",
+    protected => 1,
+    proxyto => 'node',
     parameters => {
     	additionalProperties => 0,
 	properties => PVE::QemuServer::json_config_properties(
@@ -117,7 +81,6 @@
 
 	my $node = extract_param($param, 'node');
 
-	# fixme: proxy to correct node
 	# fixme: fork worker?
 
 	my $vmid = extract_param($param, 'vmid');
@@ -188,9 +151,69 @@
     }});
 
 __PACKAGE__->register_method ({
+    name => 'vmdiridx',
+    path => '{vmid}', 
+    method => 'GET',
+    proxyto => 'node',
+    description => "Directory index",
+    parameters => {
+    	additionalProperties => 0,
+	properties => {
+	    node => get_standard_option('pve-node'),
+	    vmid => get_standard_option('pve-vmid'),
+	},
+    },
+    returns => {
+	type => 'array',
+	items => {
+	    type => "object",
+	    properties => {
+		subdir => { type => 'string' },
+	    },
+	},
+	links => [ { rel => 'child', href => "{subdir}" } ],
+    },
+    code => sub {
+	my ($param) = @_;
+
+	my $res = [
+	    { subdir => 'config' },
+	    { subdir => 'status' },
+	    { subdir => 'unlink' },
+	    { subdir => 'vncproxy' },
+	    ];
+	
+	return $res;
+    }});
+
+__PACKAGE__->register_method ({
+    name => 'vm_config', 
+    path => '{vmid}/config', 
+    method => 'GET',
+    proxyto => 'node',
+    description => "Get virtual machine configuration.",
+    parameters => {
+    	additionalProperties => 0,
+	properties => {
+	    node => get_standard_option('pve-node'),
+	    vmid => get_standard_option('pve-vmid'),
+	},
+    },
+    returns => {},
+    code => sub {
+	my ($param) = @_;
+
+	my $conf = PVE::QemuServer::load_config ($param->{vmid});
+
+	return $conf;
+    }});
+
+__PACKAGE__->register_method ({
     name => 'update_vm', 
-    path => '{node}/{vmid}', 
+    path => '{vmid}/config', 
     method => 'PUT',
+    protected => 1,
+    proxyto => 'node',
     description => "Set virtual machine options.",
     parameters => {
     	additionalProperties => 0,
@@ -226,7 +249,6 @@
 
 	my $node = extract_param($param, 'node');
 
-	# fixme: proxy to correct node
 	# fixme: fork worker?
 
 	my $vmid = extract_param($param, 'vmid');
@@ -345,30 +367,11 @@
 
 
 __PACKAGE__->register_method ({
-    name => 'vm_config', 
-    path => '{node}/{vmid}', 
-    method => 'GET',
-    description => "Get virtual machine configuration.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    node => get_standard_option('pve-node'),
-	    vmid => get_standard_option('pve-vmid'),
-	},
-    },
-    returns => {},
-    code => sub {
-	my ($param) = @_;
-
-	my $conf = PVE::QemuServer::load_config ($param->{vmid});
-
-	return $conf;
-    }});
-
-__PACKAGE__->register_method ({
     name => 'destroy_vm', 
-    path => '{node}/{vmid}', 
+    path => '{vmid}', 
     method => 'DELETE',
+    protected => 1,
+    proxyto => 'node',
     description => "Destroy the vm (also delete all used/owned volumes).",
     parameters => {
     	additionalProperties => 0,
@@ -400,8 +403,10 @@
 
 __PACKAGE__->register_method ({
     name => 'unlink', 
-    path => '{node}/{vmid}/{idlist}', 
-    method => 'DELETE',
+    path => '{vmid}/unlink', 
+    method => 'PUT',
+    protected => 1,
+    proxyto => 'node',
     description => "Unlink/delete disk images.",
     parameters => {
     	additionalProperties => 0,
@@ -430,4 +435,191 @@
 	return undef;
     }});
 
+my $sslcert;
+
+__PACKAGE__->register_method ({
+    name => 'vncproxy', 
+    path => '{vmid}/vncproxy', 
+    method => 'POST',
+    protected => 1,
+    description => "Creates a TCP VNC proxy connections.",
+    parameters => {
+    	additionalProperties => 0,
+	properties => {
+	    node => get_standard_option('pve-node'),
+	    vmid => get_standard_option('pve-vmid'),
+	},
+    },
+    returns => { 
+    	additionalProperties => 0,
+	properties => {
+	    user => { type => 'string' },
+	    ticket => { type => 'string' },
+	    cert => { type => 'string' },
+	    port => { type => 'integer' },
+	    upid => { type => 'string' },
+	},
+    },
+    code => sub {
+	my ($param) = @_;
+
+	my $rpcenv = PVE::RPCEnvironment::get();
+
+	my $user = $rpcenv->get_user();
+	my $ticket = PVE::AccessControl::assemble_ticket($user);
+
+	my ($vmid) = $param->{vmid} =~ m/^(\d+)$/; #untaint
+	my $node = $param->{node};
+
+	$sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 8192)
+	    if !$sslcert;
+
+	my $port = PVE::Tools::next_vnc_port();
+
+	my $remip;
+	
+	if ($node ne PVE::INotify::nodename()) {
+	    $remip = PVE::Cluster::remote_node_ip($node);
+	}
+
+	# NOTE: kvm VNC traffic is already TLS encrypted,
+	# so we select the fastest chipher here (or 'none'?)
+	my $remcmd = $remip ? ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes',
+			       '-c', 'blowfish-cbc', $remip] : [];
+
+	my $timeout = 10; 
+
+	my $realcmd = sub {
+	    my $upid = shift;
+
+	    syslog ('info', "starting vnc proxy $upid\n");
+
+	    my $qmcmd = [@$remcmd, "/usr/sbin/qm", 'vncproxy', $vmid];
+
+	    my $qmstr = join (' ', @$qmcmd);
+
+	    # also redirect stderr (else we get RFB protocol errors)
+	    my @cmd = ('/bin/nc', '-l', '-p', $port, '-w', $timeout, '-c', "$qmstr 2>/dev/null");
+
+	    my $cmdstr = join (' ', @cmd);
+	    syslog ('info', "CMD3: $cmdstr");
+
+	    if (system (@cmd) != 0) {
+		my $msg = "VM $vmid vnc proxy failed - $?";
+		syslog ('err', $msg);
+		return;
+	    }
+
+	    return;
+	};
+
+	my $upid = $rpcenv->fork_worker('vncproxy', "", $realcmd);
+
+	return {
+	    user => $user,
+	    ticket => $ticket,
+	    port => $port, 
+	    upid => $upid, 
+	    cert => $sslcert, 
+	};
+    }});
+
+__PACKAGE__->register_method ({
+    name => 'vm_status', 
+    path => '{vmid}/status',
+    method => 'GET',
+    proxyto => 'node',
+    description => "Get virtual machine status.",
+    parameters => {
+    	additionalProperties => 0,
+	properties => {
+	    node => get_standard_option('pve-node'),
+	    vmid => get_standard_option('pve-vmid'),
+	},
+    },
+    returns => {},
+    code => sub {
+	my ($param) = @_;
+
+	my $conf = PVE::QemuServer::load_config ($param->{vmid});
+
+	# fixme: that should not be added to the config
+	delete $conf->{disksize};
+	delete $conf->{disktype};
+	delete $conf->{diskinfo};
+
+	# fixme:
+
+	return $conf;
+    }});
+
+__PACKAGE__->register_method ({
+    name => 'vm_command', 
+    path => '{vmid}/status',
+    method => 'PUT',
+    protected => 1,
+    proxyto => 'node',
+    description => "Set virtual machine status.",
+    parameters => {
+    	additionalProperties => 0,
+	properties => {
+	    node => get_standard_option('pve-node'),
+	    vmid => get_standard_option('pve-vmid'),
+	    skiplock => { 
+		description => "Ignore locks - only root is allowed to use this option.",
+		type => 'boolean', 
+		optional => 1,
+	    },
+	    command => { 
+		type => 'string',
+		enum => [qw(start stop reset shutdown cad suspend resume) ],
+	    },
+	},
+    },
+    returns => { type => 'null'},
+    code => sub {
+	my ($param) = @_;
+
+	my $rpcenv = PVE::RPCEnvironment::get();
+
+	my $user = $rpcenv->get_user();
+
+	my $node = extract_param($param, 'node');
+
+	# fixme: proxy to correct node
+	# fixme: fork worker?
+
+	my $vmid = extract_param($param, 'vmid');
+
+	my $skiplock = extract_param($param, 'skiplock');
+	raise_param_exc({ skiplock => "Only root may use this option." }) 
+	    if $user ne 'root';
+
+	my $command = $param->{command};
+
+	my $storecfg = PVE::Storage::config(); 
+	
+	if ($command eq 'start') {
+	    my $statefile = undef; # fixme: --incoming parameter
+	    PVE::QemuServer::vm_start($storecfg, $vmid, $statefile, $skiplock);
+	} elsif ($command eq 'stop') {
+	    PVE::QemuServer::vm_stop($vmid, $skiplock);
+	} elsif ($command eq 'reset') {
+	    PVE::QemuServer::vm_reset($vmid, $skiplock);
+	} elsif ($command eq 'shutdown') {
+	    PVE::QemuServer::vm_shutdown($vmid, $skiplock);
+	} elsif ($command eq 'suspend') {
+	    PVE::QemuServer::vm_suspend($vmid, $skiplock);
+	} elsif ($command eq 'resume') {
+	    PVE::QemuServer::vm_resume($vmid, $skiplock);
+	} elsif ($command eq 'cad') {
+	    PVE::QemuServer::vm_cad($vmid, $skiplock);
+	} else {
+	    raise_param_exc({ command => "unknown command '$command'" }) 
+	}
+
+	return undef;
+    }});
+
+
 1;

Modified: qemu-server/pve2/PVE/API2/Qemu/Makefile
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/Makefile	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/PVE/API2/Qemu/Makefile	2011-02-11 12:32:25 UTC (rev 5514)
@@ -1,7 +1,5 @@
 SOURCES=           \
-	Config.pm  \
-	Status.pm \
-	VNC.pm
+	Config.pm 
 
 .PHONY: install
 install:

Deleted: qemu-server/pve2/PVE/API2/Qemu/Status.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/Status.pm	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/PVE/API2/Qemu/Status.pm	2011-02-11 12:32:25 UTC (rev 5514)
@@ -1,166 +0,0 @@
-package PVE::API2::Qemu::Status;
-
-use strict;
-use warnings;
-
-use PVE::Cluster;
-use PVE::SafeSyslog;
-use PVE::Tools qw(extract_param);
-use PVE::Exception qw(raise raise_param_exc);
-use PVE::JSONSchema qw(get_standard_option);
-use PVE::RESTHandler;
-use PVE::QemuServer;
-use PVE::Storage;
-use PVE::RPCEnvironment;
-
-use Data::Dumper; # fixme: remove
-
-use base qw(PVE::RESTHandler);
-
-__PACKAGE__->register_method ({
-    name => 'index', 
-    path => '',  
-    method => 'GET',
-    description => "List cluster nodes.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {},
-    },
-    returns => {
-	type => 'array',
-	items => {
-	    type => "object",
-	    properties => { node => { type => 'string' } },
-	},
-	links => [ { rel => 'child', href => "{node}" } ],
-    },
-    code => sub {
-	my ($param) = @_;
-
-	my $rpcenv = PVE::RPCEnvironment::get();
-	return PVE::Cluster::get_nodelist();
-    }});
-
-__PACKAGE__->register_method ({
-    name => 'vmlist', 
-    path => '{node}', 
-    method => 'GET',
-    description => "Virtual machine index.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    node => get_standard_option('pve-node'),
-	},
-    },
-    returns => {
-	type => 'array',
-	items => {
-	    type => "object",
-	    properties => {},
-	},
-	links => [ { rel => 'child', href => "{vmid}" } ],
-    },
-    code => sub {
-	my ($param) = @_;
-
-	my $vmstatus =  PVE::QemuServer::vmstatus();
-
-	return PVE::RESTHandler::hash_to_array($vmstatus, 'vmid');
-
-    }});
-
-__PACKAGE__->register_method ({
-    name => 'vm_command', 
-    path => '{node}/{vmid}', 
-    method => 'PUT',
-    protected => 1,
-    description => "Set virtual machine status.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    node => get_standard_option('pve-node'),
-	    vmid => get_standard_option('pve-vmid'),
-	    skiplock => { 
-		description => "Ignore locks - only root is allowed to use this option.",
-		type => 'boolean', 
-		optional => 1,
-	    },
-	    command => { 
-		type => 'string',
-		enum => [qw(start stop reset shutdown cad suspend resume) ],
-	    },
-	},
-    },
-    returns => { type => 'null'},
-    code => sub {
-	my ($param) = @_;
-
-	my $rpcenv = PVE::RPCEnvironment::get();
-
-	my $user = $rpcenv->get_user();
-
-	my $node = extract_param($param, 'node');
-
-	# fixme: proxy to correct node
-	# fixme: fork worker?
-
-	my $vmid = extract_param($param, 'vmid');
-
-	my $skiplock = extract_param($param, 'skiplock');
-	raise_param_exc({ skiplock => "Only root may use this option." }) 
-	    if $user ne 'root';
-
-	my $command = $param->{command};
-
-	my $storecfg = PVE::Storage::config(); 
-	
-	if ($command eq 'start') {
-	    my $statefile = undef; # fixme: --incoming parameter
-	    PVE::QemuServer::vm_start($storecfg, $vmid, $statefile, $skiplock);
-	} elsif ($command eq 'stop') {
-	    PVE::QemuServer::vm_stop($vmid, $skiplock);
-	} elsif ($command eq 'reset') {
-	    PVE::QemuServer::vm_reset($vmid, $skiplock);
-	} elsif ($command eq 'shutdown') {
-	    PVE::QemuServer::vm_shutdown($vmid, $skiplock);
-	} elsif ($command eq 'suspend') {
-	    PVE::QemuServer::vm_suspend($vmid, $skiplock);
-	} elsif ($command eq 'resume') {
-	    PVE::QemuServer::vm_resume($vmid, $skiplock);
-	} elsif ($command eq 'cad') {
-	    PVE::QemuServer::vm_cad($vmid, $skiplock);
-	} else {
-	    raise_param_exc({ command => "unknown command '$command'" }) 
-	}
-
-	return undef;
-    }});
-
-
-__PACKAGE__->register_method ({
-    name => 'vm_status', 
-    path => '{node}/{vmid}', 
-    method => 'GET',
-    description => "Get virtual machine status.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    node => get_standard_option('pve-node'),
-	    vmid => get_standard_option('pve-vmid'),
-	},
-    },
-    returns => {},
-    code => sub {
-	my ($param) = @_;
-
-	my $conf = PVE::QemuServer::load_config ($param->{vmid});
-
-	# fixme: that should not be added to the config
-	delete $conf->{disksize};
-	delete $conf->{disktype};
-	delete $conf->{diskinfo};
-
-	return $conf;
-    }});
-
-1;

Deleted: qemu-server/pve2/PVE/API2/Qemu/VNC.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/VNC.pm	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/PVE/API2/Qemu/VNC.pm	2011-02-11 12:32:25 UTC (rev 5514)
@@ -1,108 +0,0 @@
-package PVE::API2::Qemu::VNC;
-
-use strict;
-use warnings;
-
-use PVE::SafeSyslog;
-use PVE::Tools qw(extract_param);
-use PVE::Exception qw(raise raise_param_exc);
-use PVE::Cluster;
-use PVE::INotify;
-use PVE::JSONSchema qw(get_standard_option);
-use PVE::RESTHandler;
-use PVE::QemuServer;
-use PVE::RPCEnvironment;
-use PVE::AccessControl;
-
-use base qw(PVE::RESTHandler);
-
-my $sslcert;
-
-__PACKAGE__->register_method ({
-    name => 'vncproxy', 
-    path => '',  
-    method => 'POST',
-    protected => 1,
-    description => "Creates a TCP VNC proxy connections.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    node => get_standard_option('pve-node'),
-	    vmid => get_standard_option('pve-vmid'),
-	},
-    },
-    returns => { 
-    	additionalProperties => 0,
-	properties => {
-	    user => { type => 'string' },
-	    ticket => { type => 'string' },
-	    cert => { type => 'string' },
-	    port => { type => 'integer' },
-	    upid => { type => 'string' },
-	},
-    },
-    code => sub {
-	my ($param) = @_;
-
-	my $rpcenv = PVE::RPCEnvironment::get();
-
-	my $user = $rpcenv->get_user();
-	my $ticket = PVE::AccessControl::assemble_ticket($user);
-
-	my ($vmid) = $param->{vmid} =~ m/^(\d+)$/; #untaint
-	my $node = $param->{node};
-
-	$sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 8192)
-	    if !$sslcert;
-
-	my $port = PVE::Tools::next_vnc_port();
-
-	my $remip;
-	
-	if ($node ne PVE::INotify::nodename()) {
-	    $remip = PVE::Cluster::remote_node_ip($node);
-	}
-
-	# NOTE: kvm VNC traffic is already TLS encrypted,
-	# so we select the fastest chipher here (or 'none'?)
-	my $remcmd = $remip ? ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes',
-			       '-c', 'blowfish-cbc', $remip] : [];
-
-	my $timeout = 10; 
-
-	my $realcmd = sub {
-	    my $upid = shift;
-
-	    syslog ('info', "starting vnc proxy $upid\n");
-
-	    my $qmcmd = [@$remcmd, "/usr/sbin/qm", 'vncproxy', $vmid];
-
-	    my $qmstr = join (' ', @$qmcmd);
-
-	    # also redirect stderr (else we get RFB protocol errors)
-	    my @cmd = ('/bin/nc', '-l', '-p', $port, '-w', $timeout, '-c', "$qmstr 2>/dev/null");
-
-	    my $cmdstr = join (' ', @cmd);
-	    syslog ('info', "CMD3: $cmdstr");
-
-	    if (system (@cmd) != 0) {
-		my $msg = "VM $vmid vnc proxy failed - $?";
-		syslog ('err', $msg);
-		return;
-	    }
-
-	    return;
-	};
-
-	my $upid = $rpcenv->fork_worker('vncproxy', "", $realcmd);
-
-	return {
-	    user => $user,
-	    ticket => $ticket,
-	    port => $port, 
-	    upid => $upid, 
-	    cert => $sslcert, 
-	};
-    }});
-
-1;

Deleted: qemu-server/pve2/PVE/API2/Qemu.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu.pm	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/PVE/API2/Qemu.pm	2011-02-11 12:32:25 UTC (rev 5514)
@@ -1,65 +0,0 @@
-package PVE::API2::Qemu;
-
-use strict;
-use warnings;
-
-use PVE::RESTHandler;
-use PVE::API2::Qemu::Config;
-use PVE::API2::Qemu::Status;
-use PVE::API2::Qemu::VNC;
-
-use base qw(PVE::RESTHandler);
-
-__PACKAGE__->register_method ({
-    subclass => "PVE::API2::Qemu::Config",  
-    path => 'config',
-});
-
-__PACKAGE__->register_method ({
-    subclass => "PVE::API2::Qemu::Status",  
-    path => 'status',
-});
-
-__PACKAGE__->register_method ({
-    subclass => "PVE::API2::Qemu::VNC",  
-    path => 'vncproxy',
-});
-
-__PACKAGE__->register_method ({
-    name => 'index', 
-    path => '', 
-    method => 'GET',
-    description => "Directory index.",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {},
-    },
-    returns => {
-	type => 'array',
-	items => {
-	    type => "object",
-	    properties => {
-		subdir => { type => 'string' },
-	    },
-	},
-	links => [ { rel => 'child', href => "{subdir}" } ],
-    },
-    code => sub {
-	my ($param) = @_;
-    
-	my $res = [];
-
-	my $ma = __PACKAGE__->method_attributes();
-
-	foreach my $info (@$ma) {
-	    next if !$info->{subclass};
-
-	    my $subpath = $info->{match_re}->[0];
-
-	    push @$res, { subdir => $subpath };
-	}
-
-	return $res;
-    }});
-
-1;

Modified: qemu-server/pve2/qm
===================================================================
--- qemu-server/pve2/qm	2011-02-11 11:06:07 UTC (rev 5513)
+++ qemu-server/pve2/qm	2011-02-11 12:32:25 UTC (rev 5514)
@@ -14,7 +14,6 @@
 use PVE::RPCEnvironment;
 use PVE::QemuServer;
 use PVE::API2::Qemu::Config;
-use PVE::API2::Qemu::Status;
 use PVE::JSONSchema qw(get_standard_option);
 use Term::ReadLine;
 
@@ -395,17 +394,17 @@
     mtunnel => [ __PACKAGE__, 'mtunnel', []],
 
 
-    start => [ "PVE::API2::Qemu::Status", 'vm_command', ['vmid'], 
+    start => [ "PVE::API2::Qemu::Config", 'vm_command', ['vmid'], 
 	       { node => $nodename, command => 'start' } ],
-    stop => [ "PVE::API2::Qemu::Status", 'vm_command', ['vmid'], 
+    stop => [ "PVE::API2::Qemu::Config", 'vm_command', ['vmid'], 
 	      { node => $nodename, command => 'stop' } ],
-    reset => [ "PVE::API2::Qemu::Status", 'vm_command', ['vmid'], 
+    reset => [ "PVE::API2::Qemu::Config", 'vm_command', ['vmid'], 
 	       { node => $nodename, command => 'reset' } ],
-    suspend => [ "PVE::API2::Qemu::Status", 'vm_command', ['vmid'], 
+    suspend => [ "PVE::API2::Qemu::Config", 'vm_command', ['vmid'], 
 		 { node => $nodename, command => 'suspend' } ],
-    resume => [ "PVE::API2::Qemu::Status", 'vm_command', ['vmid'], 
+    resume => [ "PVE::API2::Qemu::Config", 'vm_command', ['vmid'], 
 		{ node => $nodename, command => 'resume' } ],
-    cad => [ "PVE::API2::Qemu::Status", 'vm_command', ['vmid'], 
+    cad => [ "PVE::API2::Qemu::Config", 'vm_command', ['vmid'], 
 	     { node => $nodename, command => 'cad' } ],
 	
 };




More information about the pve-devel mailing list