[pve-devel] r5157 - in pve-manager/pve2: bin lib/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Sep 15 11:19:48 CEST 2010


Author: dietmar
Date: 2010-09-15 09:19:48 +0000 (Wed, 15 Sep 2010)
New Revision: 5157

Modified:
   pve-manager/pve2/bin/pvedaemon
   pve-manager/pve2/lib/PVE/APIDaemon.pm
Log:
use new PVE::RPCEnvironment features


Modified: pve-manager/pve2/bin/pvedaemon
===================================================================
--- pve-manager/pve2/bin/pvedaemon	2010-09-15 09:18:55 UTC (rev 5156)
+++ pve-manager/pve2/bin/pvedaemon	2010-09-15 09:19:48 UTC (rev 5157)
@@ -66,8 +66,6 @@
 	exit (0);
     };
 
-    $SIG{CHLD} = \&PVE::Utils::worker_reaper;
-
     syslog ('info' , "starting server");
 
     if (!$opt_debug) {

Modified: pve-manager/pve2/lib/PVE/APIDaemon.pm
===================================================================
--- pve-manager/pve2/lib/PVE/APIDaemon.pm	2010-09-15 09:18:55 UTC (rev 5156)
+++ pve-manager/pve2/lib/PVE/APIDaemon.pm	2010-09-15 09:19:48 UTC (rev 5157)
@@ -62,7 +62,7 @@
 }
 
 sub start_workers {
-    my $self = shift;
+    my ($self, $rpcenv) = @_;
 
     my $count = 0;
     foreach my $cpid (keys %$workers) {
@@ -98,7 +98,6 @@
 	    eval {
 		# try to init inotify
 		PVE::INotify::inotify_init();
-		my $rpcenv = PVE::RPCEnvironment->init('priv');
 
 	        $self->handle_requests($rpcenv);
 	    };
@@ -155,6 +154,9 @@
 sub start_server {
     my $self = shift;
 
+    my $atfork = sub { close($self); };
+    my $rpcenv = PVE::RPCEnvironment->init('priv', atfork => $atfork);
+
     eval {
 	my $old_sig_chld = $SIG{CHLD};
 	local $SIG{CHLD} = sub {
@@ -182,7 +184,7 @@
 	};
 
 	for (;;) { # forever
-	    $self->start_workers ();
+	    $self->start_workers ($rpcenv);
 	    sleep (5); 
 	    $self->test_workers ();
 	}



More information about the pve-devel mailing list