Skip to content

Commit 4ab1528

Browse files
committed
incusd/instance/lxc: Pass log file to forknet dhcp
Signed-off-by: Gwendolyn <[email protected]>
1 parent 2773110 commit 4ab1528

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/server/instance/drivers/driver_lxc.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,23 @@ ff02::2 ip6-allrouters
24992499
return "", nil, err
25002500
}
25012501

2502-
err = lxcSetConfigItem(cc, "lxc.hook.start-host", fmt.Sprintf("/proc/%d/exe forknet dhcp %s", os.Getpid(), filepath.Join(d.Path(), "network")))
2502+
forknetDhcpLogfilePath := filepath.Join(d.LogPath(), "forknet-dhcp.log")
2503+
forknetDhcpLogfile, err := os.Create(forknetDhcpLogfilePath)
2504+
if err != nil {
2505+
return "", nil, err
2506+
}
2507+
2508+
err = forknetDhcpLogfile.Close()
2509+
if err != nil {
2510+
return "", nil, err
2511+
}
2512+
2513+
err = lxcSetConfigItem(cc, "lxc.hook.start-host", fmt.Sprintf(
2514+
"/proc/%d/exe forknet dhcp %s %s",
2515+
os.Getpid(),
2516+
filepath.Join(d.Path(), "network"),
2517+
forknetDhcpLogfilePath,
2518+
))
25032519
if err != nil {
25042520
return "", nil, err
25052521
}

0 commit comments

Comments
 (0)