From 8082aca8fe6d9c603fc51256bfdff2b9928db9cc Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 30 Dec 2010 02:05:31 +0000 Subject: [PATCH] make gateway as an optional attribute for getmacs -D and rnetboot git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8527 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCboot.pm | 6 +++++- xCAT-server/lib/perl/xCAT/PPC.pm | 18 ++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/perl-xCAT/xCAT/PPCboot.pm b/perl-xCAT/xCAT/PPCboot.pm index 13f976bc3..b5651eed9 100644 --- a/perl-xCAT/xCAT/PPCboot.pm +++ b/perl-xCAT/xCAT/PPCboot.pm @@ -187,7 +187,11 @@ sub do_rnetboot { ####################################### # Network specified ####################################### - $cmd.= " -s auto -d auto -m $mac -S $opt->{S} -G $opt->{G} -C $opt->{C} -N $opt->{N}"; + $cmd.= " -s auto -d auto -m $mac -S $opt->{S} -C $opt->{C} -N $opt->{N}"; + if (defined($opt->{G})) + { + $cmd.= " -G $opt->{G}"; + } ####################################### diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 921b64c5e..5ce27a91e 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -888,17 +888,15 @@ sub resolve_netwk { next; } my $gateway = $nethash{$_}{gateway}; - if ( !defined( $gateway )) { - my $msg = sprintf("$_: $errmsg{NO_ATTR}","gateway","networks"); - send_msg( $request, 1, $msg ); - next; + my $gateway_ip; + if ( defined( $gateway )) { + $ip = xCAT::Utils::toIP( $gateway ); + if ( @$ip[0] != 0 ) { + send_msg( $request, 1, "$_: Cannot resolve '$gateway'" ); + next; + } + $gateway_ip = @$ip[1]; } - $ip = xCAT::Utils::toIP( $gateway ); - if ( @$ip[0] != 0 ) { - send_msg( $request, 1, "$_: Cannot resolve '$gateway'" ); - next; - } - my $gateway_ip = @$ip[1]; my $netmask = $nethash{$_}{mask}; if ( !defined( $netmask )) {