mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-30 19:02:27 +00:00 
			
		
		
		
	Fix bug 2884407 lsslp -i -w FSP should not reset previously defined hcp
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4449 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -44,6 +44,7 @@ sub add_ppc { | ||||
|  | ||||
|     my $hwtype   = shift; | ||||
|     my $values   = shift; | ||||
|     my $not_overwrite = shift; | ||||
|     my @tabs     = qw(ppc vpd nodehm nodelist nodetype);  | ||||
|     my %db       = (); | ||||
|     my %nodetype = ( | ||||
| @@ -84,6 +85,41 @@ sub add_ppc { | ||||
|             $db{nodetype}->setNodeAttribs( $name,{nodetype=>$nodetype{$type}} ); | ||||
|             $db{nodetype}{commit} = 1; | ||||
|         } | ||||
|         ############################### | ||||
|         # If cannot be overwroten, get | ||||
|         # old data firstly | ||||
|         ############################### | ||||
|         my $mgt; | ||||
|         my $cons; | ||||
|         if ( $not_overwrite) | ||||
|         { | ||||
|             my $enthash = $db{ppc}->getNodeAttribs( $name, [qw(hcp id pprofile parent)]); | ||||
|             if ( $enthash ) | ||||
|             { | ||||
|                 $server   = $enthash->{hcp} if ($enthash->{hcp}); | ||||
|                 $id       = $enthash->{id}  if ( $enthash->{id}); | ||||
|                 $pprofile = $enthash->{pprofile} if ( $enthash->{pprofile}); | ||||
|                 $parent   = $enthash->{parent} if ( $enthash->{parent}); | ||||
|             } | ||||
|             $enthash = $db{nodehm}->getNodeAttribs( $name, [qw(mgt)]); | ||||
|             if ( $enthash ) | ||||
|             { | ||||
|                 $mgt= $enthash->{mgt} if ( $enthash->{mgt}); | ||||
|                 $cons= $enthash->{cons} if ( $enthash->{cons}); | ||||
|             } | ||||
|             $enthash = $db{vpd}->getNodeAttribs( $name, [qw(mtm serial)]); | ||||
|             if ( $enthash ) | ||||
|             { | ||||
|                 $model = $enthash->{mtm} if ( $enthash->{mtm}); | ||||
|                 $serial= $enthash->{serial} if ( $enthash->{serial}); | ||||
|             } | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             $mgt = $hwtype; | ||||
|             $cons = $hwtype; | ||||
|         } | ||||
|  | ||||
|         ############################### | ||||
|         # Update ppc table | ||||
|         ############################### | ||||
| @@ -106,9 +142,9 @@ sub add_ppc { | ||||
|             # Update nodehm table | ||||
|             ########################### | ||||
|             if($type =~ /^lpar$/){ | ||||
|                 $db{nodehm}->setNodeAttribs( $name, {mgt=>$hwtype,cons=>$hwtype} ); | ||||
|                 $db{nodehm}->setNodeAttribs( $name, {mgt=>$mgt,cons=>$cons} ); | ||||
|             } else { | ||||
|                 $db{nodehm}->setNodeAttribs( $name, {mgt=>$hwtype} ); | ||||
|                 $db{nodehm}->setNodeAttribs( $name, {mgt=>$mgt} ); | ||||
|             } | ||||
|             $db{nodehm}{commit} = 1; | ||||
|         } | ||||
|   | ||||
| @@ -1584,10 +1584,10 @@ sub xCATdB { | ||||
|  | ||||
|             my $values = join( ",", | ||||
|                lc($type),$name,$id,$model,$serial,$name,$prof,$frame,$ips ); | ||||
|             xCAT::PPCdb::add_ppc( lc($type), [$values] ); | ||||
|             xCAT::PPCdb::add_ppc( lc($type), [$values],1 ); | ||||
|         } | ||||
|         elsif ( $type =~ /^(HMC|IVM)$/ ) { | ||||
|             xCAT::PPCdb::add_ppchcp( lc($type), $name ); | ||||
|             xCAT::PPCdb::add_ppchcp( lc($type), $name,1 ); | ||||
|         } | ||||
|         elsif ( $type =~ /^FSP$/ ) { | ||||
|             ######################################## | ||||
| @@ -1666,7 +1666,7 @@ sub xCATdB { | ||||
|  | ||||
|             my $values = join( ",", | ||||
|                lc($type),$name,$cageid,$model,$serial,$name,$prof,$frame,$ips ); | ||||
|             xCAT::PPCdb::add_ppc( "fsp", [$values] ); | ||||
|             xCAT::PPCdb::add_ppc( "fsp", [$values],1 ); | ||||
|         } | ||||
|         elsif ( $type =~ /^(RSA|MM)$/ ) { | ||||
|             xCAT::PPCdb::add_systemX( $type, $data ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user