From 6bec9dd95a729d466a9bc08207f6e851ec8bcbc5 Mon Sep 17 00:00:00 2001 From: zhanx Date: Mon, 27 Jul 2009 16:59:24 +0000 Subject: [PATCH] Additional code change for bug 2824599 lsslp should add more attribute in DB for FSP/HMC git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3882 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCdb.pm | 2 +- xCAT-server/lib/xcat/plugins/lsslp.pm | 50 ++++++++++----------------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index e47e3f2e1..25ecdf1c1 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -206,7 +206,7 @@ sub add_ppchcp { ################################### # Update nodetype table ################################### - $db{nodetype}->setNodeAttrbs( $name, {nodetype=>lc($hwtype)}); + $db{nodetype}->setNodeAttribs( $name, {nodetype=>lc($hwtype)}); ################################### # Update nodelist table diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index be678ce94..e52360fee 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -1106,7 +1106,7 @@ sub getip_from_url { sub gethost_from_url { my $request = shift; - my $url = shift; + my $rsp = shift; my $type = shift; my $mtm = shift; my $sn = shift; @@ -1159,7 +1159,7 @@ sub gethost_from_url { if ( !$host or $! ) { #Tentative solution return undef if ($opt{H}); - $host = getFactoryHostname($type,$mtm,$sn); + $host = getFactoryHostname($type,$mtm,$sn,$rsp); #return( $ip ); } @@ -1189,15 +1189,25 @@ sub getFactoryHostname my $type = shift; my $mtm = shift; my $sn = shift; + my $rsp = shift; + my $host = undef; + + if ( $rsp =~ /\(name=([^\)]+)/ ) { + $host = $1; + + ################################### + # Convert to short-hostname + ################################### + if ( $host =~ /([^\.]+)\./ ) { + $host = $1; + } + } if ( $type eq SERVICE_FSP or $type eq SERVICE_BPA) { - return "Server-$mtm-SN$sn"; - } - else - { - return "$mtm*$sn"; + $host = "Server-$mtm-SN$sn"; } + return $host; } ########################################################################## @@ -1381,34 +1391,12 @@ sub parse_responses { ########################################### if ( $type eq SERVICE_HMC or $type eq SERVICE_BPA or $type eq SERVICE_FSP) { - $host = gethost_from_url( $request, $1, @result); + $host = gethost_from_url( $request, $rsp, @result); if ( !defined( $host )) { next; } } ########################################### - # Use the IP/Hostname contained in the URL - # not the (ip-address) field since for FSPs - # it may contain default IPs which could - # all be the same. If the response contains - # a "name" attribute as the HMC does, use - # that instead of the URL. - # - ########################################### - if (!$host and (( $type eq SERVICE_HMC ) or ( $type eq SERVICE_IVM ) - or ( $type eq SERVICE_BPA) )) { - if ( $rsp =~ /\(name=([^\)]+)/ ) { - $host = $1; - - ################################### - # Convert to short-hostname - ################################### - if ( $host =~ /([^\.]+)\./ ) { - $host = $1; - } - } - } - ########################################### # Seperate ATTR and URL portions: # URL: service:management-software.IBM... # ATTR: (type=hardware-management-cons... @@ -1562,7 +1550,7 @@ sub xCATdB { xCAT::PPCdb::add_ppc( lc($type), [$values] ); } elsif ( $type =~ /^(HMC|IVM)$/ ) { - xCAT::PPCdb::add_ppchcp( $type, $data ); + xCAT::PPCdb::add_ppchcp( lc($type), $data ); } elsif ( $type =~ /^FSP$/ ) { ########################################