From abb3d4989a63c8882e468572ed8aa4498fa4ed66 Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 26 Apr 2012 08:56:24 +0000 Subject: [PATCH] add support of lsslp -i (specify the nic to do lsslp) and fix a bug. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12346 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/SLP.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/SLP.pm b/perl-xCAT/xCAT/SLP.pm index 78efc1efb..13bb6ee97 100644 --- a/perl-xCAT/xCAT/SLP.pm +++ b/perl-xCAT/xCAT/SLP.pm @@ -61,6 +61,16 @@ sub dodiscover { @srvtypes = split /,/,$args{SrvTypes}; } my $interfaces = get_interfaces(%args); + if ($args{Ip}) { + my @ips = split /,/, $args{Ip}; + foreach my $ip (@ips) { + foreach my $nic (keys %$interfaces) { + unless (${${$interfaces->{$nic}}{ipv4addrs}}[0] =~ $ip) { + delete $interfaces->{$nic}; + } + } + } + } foreach my $srvtype (@srvtypes) { send_service_request_single(%args,ifacemap=>$interfaces,SrvType=>$srvtype); } @@ -170,8 +180,8 @@ sub parse_attribute_list { $attrib =~ s/\),?$//; $attrib =~ s/=(.*)$//; $attribs{$attrib}=[]; - if ($1) { - my $valstring = $1; + my $valstring = $1; + if (defined $valstring) { foreach(split /,/,$valstring) { push @{$attribs{$attrib}},$_; }