From 1c508b27f4b3cf5157b81dd9b4ecea58dc667485 Mon Sep 17 00:00:00 2001 From: yinle Date: Mon, 11 Apr 2011 02:03:16 +0000 Subject: [PATCH] Fix bug 3261047: ExtTab loads user tables for every perl process git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9263 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hmc.pm | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hmc.pm b/xCAT-server/lib/xcat/plugins/hmc.pm index 775e0440e..4b117542c 100644 --- a/xCAT-server/lib/xcat/plugins/hmc.pm +++ b/xCAT-server/lib/xcat/plugins/hmc.pm @@ -59,6 +59,7 @@ sub gethmccon { my $node = shift; my $callback = shift; + my $otherhcp = shift; my @attribs = qw(id parent hcp); my %tabs = (); my $rsp; @@ -74,7 +75,7 @@ sub gethmccon { $rsp->{node}->[0]->{error}=["open table $_ error"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return ; + return $rsp; } } @@ -84,12 +85,12 @@ sub gethmccon { my $type = xCAT::DBobjUtils->getnodetype($node); #my ($type) = grep( /^(lpar|osi)$/, @types ); - if ( !defined( $type ) or !($type =~/^(lpar|osi)$/) ) { + if ( !defined( $type ) or !($type =~/lpar/) ) { #return( "Invalid node type: $ent->{nodetype}" ); $rsp->{node}->[0]->{error}=["Invalid node type: $type"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return ; + return $rsp; } ################################# # Get attributes @@ -101,7 +102,7 @@ sub gethmccon { $rsp->{node}->[0]->{error}=["node is not defined in ppc table"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return ; + return $rsp; } ################################# # Verify required attributes @@ -112,7 +113,7 @@ sub gethmccon { $rsp->{node}->[0]->{error}=["Can't find node tarribute $at in ppc table"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return ; + return $rsp; } } ################################# @@ -126,7 +127,7 @@ sub gethmccon { $rsp->{node}->[0]->{error}=["Can't find node tarribute in vpd table"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return ; + return $rsp; } ################################ # Verify both vpd attributes @@ -137,29 +138,35 @@ sub gethmccon { $rsp->{node}->[0]->{error}=["Can't find node tarribute in vpd table"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return ; + return $rsp; } } ################################ # Get username and passwd ################################ my $hwtype = "hmc"; - my $host = $att->{hcp}; + my $host; + if ($otherhcp) { + $host = $otherhcp; + } else { + $host = $att->{hcp}; + } my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); if ( !defined(@cred) ) { $rsp->{node}->[0]->{error}=["Can't username and passwd for the hmc"]; $rsp->{node}->[0]->{errorcode}=[1]; $callback->($rsp); - return; + return $rsp; } $rsp = {node=>[{name=>[$node]}]}; $rsp->{node}->[0]->{mtms}->[0] = "$vpd->{mtm}*$vpd->{serial}"; - $rsp->{node}->[0]->{host}->[0] = $att->{hcp}; + $rsp->{node}->[0]->{host}->[0] = $host; $rsp->{node}->[0]->{lparid}->[0] = $att->{id}; $rsp->{node}->[0]->{cred}->[0] = join ',', @cred; $callback->($rsp); + return $rsp; }