Merge pull request #2912 from wanyaoqi/feature/wyq/fix-init-listen-interface

bugfix: fix init listen interface
This commit is contained in:
yunion-ci-robot
2019-09-17 00:14:24 +08:00
committed by GitHub
+8 -5
View File
@@ -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)