Skip to content

Commit aec6bc6

Browse files
committed
review: flagOr already carries the fallback; docs name the rm recovery flags
1 parent 4a00db4 commit aec6bc6

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

cmd/vm/clone.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package vm
22

33
import (
4-
"cmp"
54
"errors"
65
"fmt"
76
"path/filepath"
@@ -139,8 +138,8 @@ func (h *Handler) clone(cmd *cobra.Command, srcRec *record, name string) (retErr
139138
}
140139
tapFlag, _ := cmd.Flags().GetString("tap")
141140
r.Tap = tapFlag
142-
r.CNIConfDir = cmp.Or(flagOr(cmd, "cni-conf-dir", ""), srcRec.CNIConfDir)
143-
r.CNIBinDir = cmp.Or(flagOr(cmd, "cni-bin-dir", ""), srcRec.CNIBinDir)
141+
r.CNIConfDir = flagOr(cmd, "cni-conf-dir", srcRec.CNIConfDir)
142+
r.CNIBinDir = flagOr(cmd, "cni-bin-dir", srcRec.CNIBinDir)
144143
if err = applyNet(cmd, r); err != nil {
145144
return err
146145
}

cmd/vm/net_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
// netScope keys cocoon-macos's host TAP/netns families apart from a co-hosted cocoon's, so neither GC reclaims the other's live guests.
2828
const netScope = "cm"
2929

30-
// netConf is the cocoon network config: bridge/CNI provisioning shares cocoon's forwarding plane, keyed under our own device family; the CNI dirs resolve flag, then record, then default.
30+
// netConf is the cocoon network config: bridge/CNI provisioning shares cocoon's forwarding plane, keyed under our own device family.
3131
func netConf(cmd *cobra.Command, r *record) *config.Config {
3232
return &config.Config{
3333
RootDir: home.Dir(cmd),

docs/networking.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ goes straight to that IP (no port-forward).
3232
`--cni-conf-dir` (default `/etc/cni/net.d`) and `--cni-bin-dir` (default
3333
`/opt/cni/bin`) point at a non-standard CNI installation; both are ignored by
3434
the other net modes and are remembered in the VM record, so `rm` tears the
35-
NIC down without repeating them.
35+
NIC down without repeating them; a clone inherits them from its source. A VM
36+
created before the record carried them takes `rm --cni-conf-dir` and
37+
`rm --cni-bin-dir` once.
3638

3739
## Clones
3840

0 commit comments

Comments
 (0)