From 0390350bfe93372f9ac4a56aadb272330d113a29 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 12 Dec 2011 03:18:37 +0000 Subject: [PATCH] fix bug 3454934:The issue that Manually Creating HMC Entry with mkdef Without Specifying Userid and Password git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11208 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/PPC.pm | 49 ++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index cea37430d..156fbdf22 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -1815,25 +1815,44 @@ sub preprocess_request { # get the HCPs for the LPARs in order to figure out which service # nodes to send the requests to ################################################################### - my $hcptab_name = ($package eq "fsp" or $package eq "bpa") ? "ppcdirect" : "ppchcp"; - my $hcptab = xCAT::Table->new( $hcptab_name ); - unless ($hcptab ) { - $callback->({data=>["Cannot open $hcptab_name table"]}); - $req = {}; - return; - } + #my $hcptab_name = ($package eq "fsp" or $package eq "bpa") ? "ppcdirect" : "ppchcp"; + #my $hcptab = xCAT::Table->new( $hcptab_name ); + #unless ($hcptab ) { + # $callback->({data=>["Cannot open $hcptab_name table"]}); + # $req = {}; + # return; + #} # Check if each node is hcp my %hcp_hash=(); my @missednodes=(); - foreach ( @$noderange ) { - my ($ent) = $hcptab->getNodeAttribs( $_,"hcp" ); - if ( !defined( $ent )) { - push @missednodes, $_; - next; - } - push @{$hcp_hash{$_}{nodes}}, $_; + my $support_hcp_type; + # in the DFM model, cec/fsp/Frame/bpa can be hcp. + if ($package eq "fsp" or $package eq "bpa") { + $support_hcp_type = "(fsp|cec|bpa|frame)"; + # in the HMC model, only hmc can be hcp. + } elsif ($package eq "hmc") { + $support_hcp_type = "hmc"; + # package equal 'ivm', only ivm can be hcp. + } else { + $support_hcp_type = "ivm"; } - + foreach ( @$noderange ) { + my $nodetype = xCAT::DBobjUtils->getnodetype($_); + if ($nodetype and $nodetype =~ /$support_hcp_type/) { + push @{$hcp_hash{$_}{nodes}}, $_; + } else { + push @missednodes, $_; + } + } + #foreach ( @$noderange ) { + # my ($ent) = $hcptab->getNodeAttribs( $_,"hcp" ); + # if ( !defined( $ent )) { + # push @missednodes, $_; + # next; + # } + # push @{$hcp_hash{$_}{nodes}}, $_; + #} + #check if the left-over nodes are lpars if (@missednodes > 0) { my $ppctab = xCAT::Table->new("ppc");