diff --git a/pkg/hostman/hostinfo/hostinfo.go b/pkg/hostman/hostinfo/hostinfo.go index 73606f29ca..6683dccb41 100644 --- a/pkg/hostman/hostinfo/hostinfo.go +++ b/pkg/hostman/hostinfo/hostinfo.go @@ -139,11 +139,6 @@ func (h *SHostInfo) parseConfig() error { if h.GetMemory() < 64 { // MB return fmt.Errorf("Not enough memory!") } - if len(options.HostOptions.ListenInterface) > 0 { - h.MasterNic = netutils2.NewNetInterface(options.HostOptions.ListenInterface) - } else { - h.MasterNic = nil - } for _, n := range options.HostOptions.Networks { nic, err := NewNIC(n) if err != nil { @@ -156,6 +151,14 @@ func (h *SHostInfo) parseConfig() error { return err } } + if len(options.HostOptions.ListenInterface) > 0 { + h.MasterNic = netutils2.NewNetInterface(options.HostOptions.ListenInterface) + if len(h.MasterNic.Addr) == 0 { + return fmt.Errorf("Listen interface %s master not have IP", options.HostOptions.ListenInterface) + } + } else { + h.MasterNic = nil + } if man, err := isolated_device.NewManager(h); err != nil { return fmt.Errorf("NewIsolatedManager: %v", err)