Allow socket path used by dhcp plugin to be supplied via dhcp ipam configuration

Allow socket path to be supplied as flag when starting dhcp daemon
This commit is contained in:
Michael Cambria
2018-10-08 11:30:01 -04:00
parent 66837d6f3b
commit 6d3215a256
2 changed files with 36 additions and 5 deletions

View File

@ -127,7 +127,7 @@ func (d *DHCP) clearLease(contID, netName string) {
delete(d.leases, contID+netName)
}
func getListener() (net.Listener, error) {
func getListener(socketPath string) (net.Listener, error) {
l, err := activation.Listeners()
if err != nil {
return nil, err
@ -151,7 +151,7 @@ func getListener() (net.Listener, error) {
}
}
func runDaemon(pidfilePath string, hostPrefix string) error {
func runDaemon(pidfilePath string, hostPrefix string, socketPath string) error {
// since other goroutines (on separate threads) will change namespaces,
// ensure the RPC server does not get scheduled onto those
runtime.LockOSThread()
@ -166,7 +166,7 @@ func runDaemon(pidfilePath string, hostPrefix string) error {
}
}
l, err := getListener()
l, err := getListener(socketPath)
if err != nil {
return fmt.Errorf("Error getting listener: %v", err)
}