diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index 01c24af7b..d4db7d8a4 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -507,7 +507,6 @@ sub donets # check if this netname is already defined if ( $netname eq $netn ) { $netnamematch = 1; - $callback->({ warning => "The network entry \'$netname\' already exists in xCAT networks table. Cannot create a definition for \'$netname\'" }); last; } # split definition mask @@ -524,10 +523,6 @@ sub donets } } - # if this net entry exists, go to next line in networks table - if ($netnamematch) { - last; - } # get mtu value my $mtu; my @rowm; @@ -553,6 +548,11 @@ sub donets push @{ $rsp->{data} }, " mtu=$mtu"; } } else { + # if this net entry exists, go to next line in networks table + if ($netnamematch) { + $callback->({ warning => "The network entry \'$netname\' already exists in xCAT networks table. Cannot create a definition for \'$netname\'" }); + last; + } if (!$foundmatch) { $nettab->setAttribs({ 'net' => $net, 'mask' => $mask }, { 'netname' => $netname, 'mgtifname' => $mgtifname, 'gateway' => $gw, 'mtu' => $mtu }); }