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

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Feb 2 08:48:56 CET 2011


Author: dietmar
Date: 2011-02-02 08:48:56 +0100 (Wed, 02 Feb 2011)
New Revision: 5474

Modified:
   qemu-server/pve2/PVE/API2/Qemu/Status.pm
   qemu-server/pve2/PVE/API2/Qemu/VNC.pm
   qemu-server/pve2/PVE/QemuServer.pm
Log:
moved next_vnc_port to PVE::Tools


Modified: qemu-server/pve2/PVE/API2/Qemu/Status.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/Status.pm	2011-02-02 07:47:03 UTC (rev 5473)
+++ qemu-server/pve2/PVE/API2/Qemu/Status.pm	2011-02-02 07:48:56 UTC (rev 5474)
@@ -73,6 +73,7 @@
     name => 'vm_command', 
     path => '{node}/{vmid}', 
     method => 'PUT',
+    protected => 1,
     description => "Set virtual machine status.",
     parameters => {
     	additionalProperties => 0,

Modified: qemu-server/pve2/PVE/API2/Qemu/VNC.pm
===================================================================
--- qemu-server/pve2/PVE/API2/Qemu/VNC.pm	2011-02-02 07:47:03 UTC (rev 5473)
+++ qemu-server/pve2/PVE/API2/Qemu/VNC.pm	2011-02-02 07:48:56 UTC (rev 5474)
@@ -55,7 +55,7 @@
 	$sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 8192)
 	    if !$sslcert;
 
-	my $port = PVE::QemuServer::next_vnc_port();
+	my $port = PVE::Tools::next_vnc_port();
 
 	# fixme:
 	#my $remip = $rpcenv->get_remote_node_ip($node);

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2011-02-02 07:47:03 UTC (rev 5473)
+++ qemu-server/pve2/PVE/QemuServer.pm	2011-02-02 07:48:56 UTC (rev 5474)
@@ -510,8 +510,8 @@
 
     my $tmp = `kvm -help 2>/dev/null`;
     
-    if ($tmp =~ m/^QEMU PC emulator version (\d+\.\d+\.\d+) /) {
-	$kvm_user_version = $1;
+    if ($tmp =~ m/^QEMU( PC)? emulator version (\d+\.\d+\.\d+) /) {
+	$kvm_user_version = $2;
     }
 
     return $kvm_user_version;
@@ -1322,8 +1322,6 @@
 sub change_config_nolock {
     my ($vmid, $settings, $unset, $skiplock) = @_;
 
-    die "not implemented - fixme";
-
     my $res = {};
 
     $unset->{ide2} = $unset->{cdrom} if $unset->{cdrom};
@@ -1975,25 +1973,6 @@
     die "unable to find free migration port";
 }
 
-sub next_vnc_port {
-
-    for (my $p = 5900; $p < 6000; $p++) {
-
-	my $sock = IO::Socket::INET->new (Listen => 5,
-					  LocalAddr => 'localhost',
-					  LocalPort => $p,
-					  ReuseAddr => 1,
-					  Proto     => 0);
-
-	if ($sock) {
-	    close ($sock);
-	    return $p;
-	}
-    }
-
-    die "unable to find free vnc port";
-};
-
 sub vm_start {
     my ($storecfg, $vmid, $statefile, $skiplock) = @_;
 




More information about the pve-devel mailing list