Commit e1fb5ac8 authored by Dietmar Maurer's avatar Dietmar Maurer

spiceproxy: always restart unsing HUP

To keep existing spice connections alive.
parent 024514ee
...@@ -45,11 +45,6 @@ case "$1" in ...@@ -45,11 +45,6 @@ case "$1" in
$DAEMON stop $DAEMON stop
log_end_msg $? log_end_msg $?
;; ;;
reload)
log_daemon_msg "Reloading $DESC" "$NAME"
$DAEMON reload
log_end_msg $?
;;
restart|force-reload) restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME" log_daemon_msg "Restarting $DESC" "$NAME"
$DAEMON restart $DAEMON restart
......
#!/usr/bin/perl -T #!/usr/bin/perl -T
# Note: In theory, all this can be done by 'pveproxy' daemon. But som API call # Note: In theory, all this can be done by 'pveproxy' daemon. But some
# still have blocking code, so we use a separate daemon to avoid that the console # API call still have blocking code, so we use a separate daemon to avoid
# get blocked. # that the console gets blocked.
$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin'; $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
...@@ -64,7 +64,9 @@ sub init { ...@@ -64,7 +64,9 @@ sub init {
my ($socket, $sockfd); my ($socket, $sockfd);
if (defined($sockfd = $ENV{PVE_DAEMON_SOCKET_3128}) && my $port = 3128;
if (defined($sockfd = $ENV{"PVE_DAEMON_SOCKET_$port"}) &&
$self->{env_restart_pve_daemon}) { $self->{env_restart_pve_daemon}) {
die "unable to parse socket fd '$sockfd'\n" die "unable to parse socket fd '$sockfd'\n"
...@@ -78,7 +80,7 @@ sub init { ...@@ -78,7 +80,7 @@ sub init {
} else { } else {
$socket = IO::Socket::INET->new( $socket = IO::Socket::INET->new(
LocalAddr => undef, # all interfaces LocalAddr => undef, # all interfaces
LocalPort => 3128, LocalPort => $port,
Listen => SOMAXCONN, Listen => SOMAXCONN,
Proto => 'tcp', Proto => 'tcp',
ReuseAddr => 1) || ReuseAddr => 1) ||
...@@ -88,7 +90,7 @@ sub init { ...@@ -88,7 +90,7 @@ sub init {
# so we disable that to maximize performance # so we disable that to maximize performance
setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1); setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1);
$ENV{PVE_DAEMON_SOCKET_3128} = $socket->fileno; $ENV{"PVE_DAEMON_SOCKET_$port"} = $socket->fileno;
} }
# remove FD_CLOEXEC bit to reuse on exec # remove FD_CLOEXEC bit to reuse on exec
...@@ -119,15 +121,13 @@ sub run { ...@@ -119,15 +121,13 @@ sub run {
} }
$daemon->register_start_command(); $daemon->register_start_command();
$daemon->register_restart_command(0); $daemon->register_restart_command(1);
$daemon->register_reload_command();
$daemon->register_stop_command(); $daemon->register_stop_command();
$daemon->register_status_command(); $daemon->register_status_command();
my $cmddef = { my $cmddef = {
start => [ __PACKAGE__, 'start', []], start => [ __PACKAGE__, 'start', []],
restart => [ __PACKAGE__, 'restart', []], restart => [ __PACKAGE__, 'restart', []],
reload => [ __PACKAGE__, 'reload', []],
stop => [ __PACKAGE__, 'stop', []], stop => [ __PACKAGE__, 'stop', []],
status => [ __PACKAGE__, 'status', [], undef, sub { print shift . "\n";} ], status => [ __PACKAGE__, 'status', [], undef, sub { print shift . "\n";} ],
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment