diff --git a/xCAT-server/lib/xcat/plugins/xcat2nim.pm b/xCAT-server/lib/xcat/plugins/xcat2nim.pm index 84bcb5331..e53665b35 100644 --- a/xCAT-server/lib/xcat/plugins/xcat2nim.pm +++ b/xCAT-server/lib/xcat/plugins/xcat2nim.pm @@ -723,6 +723,15 @@ sub x2n if ($::objtype{$obj} eq 'node') { push(@nodes, $obj); } elsif ($::objtype{$obj} eq 'network') { + if ($::objhash{$obj}{'gateway'} eq '') { + $::objhash{$obj}{'gateway'} = xCAT::NetworkUtils->my_ip_in_subnet($::objhash{$obj}{'net'}, $::objhash{$obj}{'mask'}); + if(!$::objhash{$obj}{'gateway'}) { + my $rsp; + $rsp->{data}->[0] = "Could not get gateway for network $obj, ...skipping\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + next; + } + } push(@networks, $obj); } elsif ($::objtype{$obj} eq 'group') { push(@groups, $obj);