From 9e2b2500626fe8dc371c1a056a7583a91c3d512e Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 16 Mar 2012 10:31:33 +0000 Subject: [PATCH] fixed the issue that xnba,pxe,vsmppex,yaboot failed for service node when no valid nodes in the handled network git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11882 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/pxe.pm | 11 ++++++++--- xCAT-server/lib/xcat/plugins/vsmppxe.pm | 11 ++++++++--- xCAT-server/lib/xcat/plugins/xnba.pm | 11 ++++++++--- xCAT-server/lib/xcat/plugins/yaboot.pm | 12 ++++++++---- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index b22450354..10c082164 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -3,6 +3,7 @@ package xCAT_plugin::pxe; use Data::Dumper; use Sys::Syslog; use xCAT::Scope; +use xCAT::MsgUtils; use Socket; use File::Copy; use File::Path; @@ -392,15 +393,19 @@ sub process_request { if (xCAT::Utils->nodeonmynet($_)) { push @nodes,$_; } else { - my $rsp; - $rsp->{data}->[0]="$_: stop configuration because of none sharedtftp and not on same network with its xcatmaster"; - $callback->($rsp); + xCAT::MsgUtils->message("S", "$_: pxe netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); } } } else { @nodes = @rnodes; } + # return directly if no nodes in the same network + unless (@nodes) { + xCAT::MsgUtils->message("S", "xCAT: pxe netboot: no valid nodes. Stop the operation on this server."); + return; + } + if (ref($request->{arg})) { @args=@{$request->{arg}}; } else { diff --git a/xCAT-server/lib/xcat/plugins/vsmppxe.pm b/xCAT-server/lib/xcat/plugins/vsmppxe.pm index 2e884717b..479e37ac7 100644 --- a/xCAT-server/lib/xcat/plugins/vsmppxe.pm +++ b/xCAT-server/lib/xcat/plugins/vsmppxe.pm @@ -5,6 +5,7 @@ use Sys::Syslog; use Socket; use File::Copy; use Getopt::Long; +use xCAT::MsgUtils; my $addkcmdlinehandled; my $request; @@ -292,15 +293,19 @@ sub process_request { if (xCAT::Utils->nodeonmynet($_)) { push @nodes,$_; } else { - my $rsp; - $rsp->{data}->[0]="$_: stop configuration because of none sharedtftp and not on same network with its xcatmaster"; - $callback->($rsp); + xCAT::MsgUtils->message("S", "$_: vsmppxe netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); } } } else { @nodes = @rnodes; } + # return directly if no nodes in the same network + unless (@nodes) { + xCAT::MsgUtils->message("S", "xCAT: vsmppxe netboot: no valid nodes. Stop the operation on this server."); + return; + } + if (ref($request->{arg})) { @args=@{$request->{arg}}; } else { diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index e8123e6fb..6aefdf37e 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -6,6 +6,7 @@ use Socket; use File::Copy; use File::Path; use xCAT::Scope; +use xCAT::MsgUtils; use Getopt::Long; my $addkcmdlinehandled; @@ -416,15 +417,19 @@ sub process_request { if (xCAT::Utils->nodeonmynet($_)) { push @nodes,$_; } else { - my $rsp; - $rsp->{data}->[0]="$_: stop configuration because of none sharedtftp and not on same network with its xcatmaster"; - $callback->($rsp); + xCAT::MsgUtils->message("S", "$_: xnba netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); } } } else { @nodes = @rnodes; } + # return directly if no nodes in the same network + unless (@nodes) { + xCAT::MsgUtils->message("S", "xCAT: xnba netboot: no valid nodes. Stop the operation on this server."); + return; + } + if (ref($request->{arg})) { @args=@{$request->{arg}}; } else { diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 8bca4f90b..734ad917d 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -4,6 +4,7 @@ use Data::Dumper; use Sys::Syslog; use xCAT::Scope; use xCAT::NetworkUtils; +use xCAT::MsgUtils; use File::Path; use Socket; use Getopt::Long; @@ -421,15 +422,18 @@ sub process_request { if (xCAT::Utils->nodeonmynet($_)) { push @nodes,$_; } else { - my $rsp; - $rsp->{data}->[0]="$_: stop configuration because of none sharedtftp and not on same network with its xcatmaster"; - $callback->($rsp); + xCAT::MsgUtils->message("S", "$_: yaboot netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); } } } else { @nodes = @rnodes; } - #print "nodes=@nodes\nrnodes=@rnodes\n"; + + # return directly if no nodes in the same network + unless (@nodes) { + xCAT::MsgUtils->message("S", "xCAT: yaboot netboot: no valid nodes. Stop the operation on this server."); + return; + } if (ref($request->{arg})) { @args=@{$request->{arg}};