temp fix for bug 3792: multiple nics in the same subnet, use the first nic that in the subnet for dhcp
This commit is contained in:
		
							
								
								
									
										12
									
								
								xCAT-server/lib/xcat/plugins/dhcp.pm
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										12
									
								
								xCAT-server/lib/xcat/plugins/dhcp.pm
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -1927,6 +1927,11 @@ sub addnet
 | 
			
		||||
            if ($ent[0] eq $net and $ent[2] eq $mask)
 | 
			
		||||
            {
 | 
			
		||||
                $nic = $ent[1];
 | 
			
		||||
                # The first nic that matches the network,
 | 
			
		||||
                # what will happen if there are more than one nics in the same subnet,
 | 
			
		||||
                # and we want to use the second nic as the dhcp interfaces?
 | 
			
		||||
                # this is a TODO
 | 
			
		||||
                last;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #print " add $net $mask under $nic\n";
 | 
			
		||||
@@ -1943,6 +1948,13 @@ sub addnet
 | 
			
		||||
            }
 | 
			
		||||
            unless ($dhcpconf[$idx] =~ /\} # $nic nic_end\n/)
 | 
			
		||||
            {
 | 
			
		||||
                  $callback->(
 | 
			
		||||
                      {
 | 
			
		||||
                         error =>
 | 
			
		||||
                            ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile."],
 | 
			
		||||
                            errorcode => [1]
 | 
			
		||||
                      }
 | 
			
		||||
                  );
 | 
			
		||||
                return 1;    #TODO: this is an error condition
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user