2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-07-15 17:16:10 +00:00

defect 4644: change in xcatd and Client.pm to fix two issues: 1. if the plugin process run certain command like 'omshell' dhcp.pm and which hang, this will cause the plugin process cannot be finished with ctrl^c; 2. the ctrl^c cannot be passed to service node.

This commit is contained in:
WangXiaoPeng
2015-04-21 05:14:22 -04:00
parent 22cb84d357
commit 71a764ed96
2 changed files with 10 additions and 1 deletions

View File

@ -282,7 +282,9 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
$msg=$request;
print $client $msg;
}
$SIG{TERM} = $SIG{INT} = sub { send_request({abortcommand=>[1]},$client,$encode); exit 0; };
# when receive TERM or INT (ctrl^c) from user, sleep 2s before exit to make
# sure the server (xcatd) has recevied 'abortcommand' command
$SIG{TERM} = $SIG{INT} = sub { send_request({abortcommand=>[1]},$client,$encode); sleep 2; exit 0; };
my $response;
my $rsp;
my $cleanexit=0;

View File

@ -1861,6 +1861,10 @@ sub dispatch_request {
}
if ($onlyone and not ($_->{'_xcatdest'} and xCAT::NetworkUtils->thishostisnot($_->{'_xcatdest'}))) {
$SIG{CHLD}='DEFAULT';
# make the plugin process exit directly instead of wait(), this is useful
# for the plugin process to exit successfully when it opened some shell subprocesses.
$SIG{TERM} = $SIG{INT} = 'DEFAULT';
"" =~ m/()/; #clear $1 that we may have sitting around
if ($_->{'_xcatdelay'} and not ref $_->{'_xcatdelay'}) { sleep $_->{'_xcatdelay'}; }
# Call the plugin to process the command request
@ -1955,6 +1959,9 @@ sub dispatch_request {
} else {
$$progname.=": locally executing";
$SIG{CHLD}='DEFAULT';
# make the plugin process exit directly instead of wait(), this is useful
# for the plugin process to exit successfully when it opened some shell subprocesses.
$SIG{TERM} = $SIG{INT} = 'DEFAULT';
# Call the plugin to process the command request
# rescanplugins request gets handled directly here in xcatd
if ($_->{command}->[0] eq 'rescanplugins') {