mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-03 21:02:34 +00:00 
			
		
		
		
	Fix FPC reseat behavior on multiple nodes
This commit is contained in:
		@@ -413,6 +413,11 @@ sub checksum {
 | 
			
		||||
sub subcmd {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my %args = @_;
 | 
			
		||||
    while ($self->{incommand}) {
 | 
			
		||||
        $self->waitforrsp();
 | 
			
		||||
    }
 | 
			
		||||
    $self->{incommand} = 1;
 | 
			
		||||
 | 
			
		||||
    $self->{expectedcmd}   = $args{command};
 | 
			
		||||
    $self->{expectednetfn} = $args{netfn} + 1;
 | 
			
		||||
    my $seqincrement = 7;
 | 
			
		||||
@@ -509,6 +514,7 @@ sub timedout {
 | 
			
		||||
        $self->{timeout} = $initialtimeout + (0.5 * rand());
 | 
			
		||||
        my $rsp = {};
 | 
			
		||||
        $rsp->{error} = "timeout";
 | 
			
		||||
	$self->{incommand} = 0;
 | 
			
		||||
        $self->{ipmicallback}->($rsp, $self->{ipmicallback_args});
 | 
			
		||||
        $self->{nowait} = 0;
 | 
			
		||||
        return;
 | 
			
		||||
@@ -769,6 +775,7 @@ sub init {
 | 
			
		||||
      #if we should incur 7 bumps, clear the taboo list and continue on, hoping for best (pessimistically assuming the spec means seq number or that someone could at least interpret it that way)
 | 
			
		||||
      #I'll implement this later...
 | 
			
		||||
    $self->{'logged'} = 0;
 | 
			
		||||
    $self->{'incommand'} = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub relog {
 | 
			
		||||
@@ -944,6 +951,7 @@ sub parse_ipmi_payload {
 | 
			
		||||
    $rsp->{code}     = shift @payload;
 | 
			
		||||
    $rsp->{data}     = \@payload;
 | 
			
		||||
    $self->{timeout} = $initialtimeout + (0.5 * rand());
 | 
			
		||||
    $self->{incommand} = 0;
 | 
			
		||||
    $self->{ipmicallback}->($rsp, $self->{ipmicallback_args});
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2134,6 +2134,8 @@ sub fpc_firmxfer_watch {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my %fpcsessions;
 | 
			
		||||
 | 
			
		||||
sub reseat_node {
 | 
			
		||||
    my $sessdata = shift;
 | 
			
		||||
    if (1) {    # TODO: FPC path checked for
 | 
			
		||||
@@ -2154,8 +2156,19 @@ sub reseat_node {
 | 
			
		||||
        my $nodeuser = $authdata->{$fpc}->{username};
 | 
			
		||||
        my $nodepass = $authdata->{$fpc}->{password};
 | 
			
		||||
        $sessdata->{slotnumber} = $mpent->{id};
 | 
			
		||||
        $sessdata->{fpcipmisession} = xCAT::IPMI->new(bmc => $mpent->{mpa}, userid => $nodeuser, password => $nodepass);
 | 
			
		||||
        $sessdata->{fpcipmisession}->login(callback => \&fpc_node_reseat, callback_args => $sessdata);
 | 
			
		||||
	if (exists $fpcsessions{$mpent->{mpa}}) {
 | 
			
		||||
            $sessdata->{fpcipmisession} = $fpcsessions{$mpent->{mpa}}; 
 | 
			
		||||
	    until ($sessdata->{fpcipmisession}->{logged}) {
 | 
			
		||||
                $sessdata->{fpcipmisession}->waitforrsp();
 | 
			
		||||
            }
 | 
			
		||||
	    $sessdata->{fpcipmisession}->subcmd(netfn => 0x32, command => 0xa4,
 | 
			
		||||
		    data => [ $sessdata->{slotnumber}, 2 ],
 | 
			
		||||
		    callback => \&fpc_node_reseat_complete, callback_args => $sessdata);
 | 
			
		||||
	} else {
 | 
			
		||||
            $sessdata->{fpcipmisession} = xCAT::IPMI->new(bmc => $mpent->{mpa}, userid => $nodeuser, password => $nodepass);
 | 
			
		||||
	    $fpcsessions{$mpent->{mpa}} = $sessdata->{fpcipmisession};
 | 
			
		||||
            $sessdata->{fpcipmisession}->login(callback => \&fpc_node_reseat, callback_args => $sessdata);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user