From 75168c6d1160df5b925da791f3bdde2752f88903 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Tue, 13 Jun 2017 12:11:53 +0000 Subject: [PATCH] Swap the remove and apply IP order - seem to fix the problem Signed-off-by: Sven Dowideit --- netconf/netconf_linux.go | 12 +++++++----- tests/common_test.go | 8 ++++---- tests/installer_test.go | 17 ++++++++++------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/netconf/netconf_linux.go b/netconf/netconf_linux.go index c800c899..406f200d 100755 --- a/netconf/netconf_linux.go +++ b/netconf/netconf_linux.go @@ -402,11 +402,6 @@ func applyInterfaceConfig(link netlink.Link, netConf InterfaceConfig) error { addrMap := make(map[string]bool) for _, address := range addresses { addrMap[address] = true - log.Infof("Applying %s to %s", address, link.Attrs().Name) - err := applyAddress(address, link, netConf) - if err != nil { - log.Errorf("Failed to apply address %s to %s: %v", address, link.Attrs().Name, err) - } } for _, addr := range existingAddrs { if _, ok := addrMap[addr.IPNet.String()]; !ok { @@ -419,6 +414,13 @@ func applyInterfaceConfig(link netlink.Link, netConf InterfaceConfig) error { } } } + for _, address := range addresses { + log.Infof("Applying %s to %s", address, link.Attrs().Name) + err := applyAddress(address, link, netConf) + if err != nil { + log.Errorf("Failed to apply address %s to %s: %v", address, link.Attrs().Name, err) + } + } // TODO: can we set to default? if netConf.MTU > 0 { diff --git a/tests/common_test.go b/tests/common_test.go index 1b557290..6e34eed4 100755 --- a/tests/common_test.go +++ b/tests/common_test.go @@ -156,10 +156,10 @@ func (s *QemuSuite) NetCheckOutput(c *C, result string, check Checker, additiona func (s *QemuSuite) runQemu(c *C, args ...string) error { c.Assert(s.qemuCmd, IsNil) // can't run 2 qemu's at once (yet) s.qemuCmd = exec.Command(s.runCommand, args...) - //if os.Getenv("DEBUG") != "" { - s.qemuCmd.Stdout = os.Stdout - s.qemuCmd.Stderr = os.Stderr - //} + if os.Getenv("DEBUG") != "" { + s.qemuCmd.Stdout = os.Stdout + s.qemuCmd.Stderr = os.Stderr + } if err := s.qemuCmd.Start(); err != nil { return err } diff --git a/tests/installer_test.go b/tests/installer_test.go index fa0af65a..cd76edd7 100755 --- a/tests/installer_test.go +++ b/tests/installer_test.go @@ -165,10 +165,10 @@ func (s *QemuSuite) KillsMyServerTestInstalledDhcp(c *C) { runArgs := []string{ "--iso", "--fresh", -// "-net", "nic,vlan=0,model=virtio", -// "-net", "user,vlan=0", -// "-net", "nic,vlan=0,model=virtio", -// "-net", "user,vlan=0", + // "-net", "nic,vlan=0,model=virtio", + // "-net", "user,vlan=0", + // "-net", "nic,vlan=0,model=virtio", + // "-net", "user,vlan=0", } version := "" { @@ -260,11 +260,14 @@ sudo ros service stop network sleep 1 sudo ros service start network sleep 1 +echo "===================" +sudo system-docker logs network +echo "===================" ip a `) - s.NetCheckOutput(c, version, Equals, "sudo ros -v") - s.NetCheckOutput(c, "", Not(Equals), "sh", "-c", "ip a show eth1 2>/dev/null | grep 10.0.2.253") - s.Stop(c) + s.NetCheckOutput(c, version, Equals, "sudo ros -v") + s.NetCheckOutput(c, "", Not(Equals), "sh", "-c", "\"ip a show eth1 | grep 10.0.2.253\"") + s.Stop(c) } }