From 8c41fc1a00613e19b6695a5f3bf72813b8f4f58f Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 4 Mar 2009 21:17:59 +0000 Subject: [PATCH] -Handle error messages in a redundant case a bit less obtrusively git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2839 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatd | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index a4bd47f15..93899a229 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -960,6 +960,8 @@ sub dispatch_request { } } my $xcatdest; + my $numdests=scalar(@xcatdests); + my $request_satisfied=0; foreach $xcatdest (@xcatdests) { if ($xcatdest and thishostisnot($xcatdest)) { $ENV{XCATHOST} = ($xcatdest =~ /:/ ? $xcatdest : $xcatdest.":3001" ); @@ -970,10 +972,15 @@ sub dispatch_request { }; if ($@) { my $errstr=$@; - dispatch_callback({error=>["Unable to dispatch command to ".$ENV{XCATHOST}.", command will not make changes to that server ($errstr)"],errorcode=>[1]}); - xCAT::MsgUtils->message("S","Error dispatching request: ".$errstr); + if ($numdests == 1) { + dispatch_callback({error=>["Unable to dispatch command to ".$ENV{XCATHOST}.", command will not make changes to that server ($errstr)"],errorcode=>[1]}); + xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.": ".$errstr); + } else { + xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.", trying other service nodes: ".$errstr); + } next; } else { + $request_satisfied=1; last; } } else { @@ -983,6 +990,11 @@ sub dispatch_request { last; } } + if ($numdests > 1 and not $request_satisfied) { + xCAT::MsgUtils->message("S","Error dispatching a request to all possible service nodes for request"); + dispatch_callback({error=>["Failed to dispatch command to any of the following service nodes: ".join(",",@xcatdests)],errorcode=>[1]}); + } + xexit; } while (($dispatch_children > 0) and ($child_fdset->count > 0)) { relay_dispatch($child_fdset) }