system: Add more logging for networkd

This commit is contained in:
Alex Crawford 2014-07-21 11:25:22 -07:00
parent 7a06dee16f
commit 21e32e44f8

View File

@ -2,6 +2,7 @@ package system
import (
"fmt"
"log"
"net"
"os/exec"
"strings"
@ -52,6 +53,7 @@ func downNetworkInterfaces(interfaces []network.InterfaceGenerator) error {
for _, iface := range interfaces {
if systemInterface, ok := sysInterfaceMap[iface.Name()]; ok {
log.Printf("Taking down interface %q\n", systemInterface.Name)
if err := netlink.NetworkLinkDown(systemInterface); err != nil {
fmt.Printf("Error while downing interface %q (%s). Continuing...\n", systemInterface.Name, err)
}
@ -64,6 +66,7 @@ func downNetworkInterfaces(interfaces []network.InterfaceGenerator) error {
func maybeProbe8012q(interfaces []network.InterfaceGenerator) error {
for _, iface := range interfaces {
if iface.Type() == "vlan" {
log.Printf("Probing LKM %q (%q)\n", "8021q", "8021q")
return exec.Command("modprobe", "8021q").Run()
}
}
@ -78,10 +81,12 @@ func maybeProbeBonding(interfaces []network.InterfaceGenerator) error {
break
}
}
log.Printf("Probing LKM %q (%q)\n", "bonding", args)
return exec.Command("modprobe", args...).Run()
}
func restartNetworkd() error {
log.Printf("Restarting networkd.service\n")
_, err := NewUnitManager("").RunUnitCommand("restart", "systemd-networkd.service")
return err
}
@ -108,6 +113,7 @@ func writeConfig(filename string, config string) error {
if config == "" {
return nil
}
log.Printf("Writing networkd unit %q\n", filename)
_, err := WriteFile(&File{Content: config, Path: filename}, runtimeNetworkPath)
return err
}