Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@ func setFlagDefaults(cmd *cobra.Command) {
}
}
}

// always enable network address for incus, if supported and not explicitly disabled
if util.MacOS13OrNewer() {
if !cmd.Flag("network-address").Changed {
if startCmdArgs.Runtime == incus.Name && startCmdArgs.VMType == "vz" {
startCmdArgs.Network.Address = true
}
}
}
}

func setConfigDefaults(conf *config.Config) {
Expand Down
28 changes: 0 additions & 28 deletions environment/container/incus/incus.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,6 @@ func (c *incusRuntime) Start(ctx context.Context) error {
return nil
})

a.Add(func() error {
if err := c.registerNetworks(); err != nil {
return cli.ErrNonFatal(err)
}
return nil
})

a.Add(func() error {
if err := c.addContainerRoute(); err != nil {
return cli.ErrNonFatal(err)
Expand Down Expand Up @@ -321,27 +314,6 @@ func (c incusRuntime) addDockerRemote() error {
return c.host.RunQuiet("incus", "remote", "add", "docker", "https://docker.io", "--protocol=oci")
}

func (c incusRuntime) registerNetworks() error {
name := limautil.NetInterface

found, network, err := c.findNetwork(name)
if err != nil {
return err
}

// must be an unmanaged physical network
if !found || network.Managed || network.Type != "physical" {
return nil
}

err = c.guest.RunQuiet("sudo", "incus", "network", "create", name, "--type", "macvlan", "parent="+name)
if err != nil {
return fmt.Errorf("error creating managed network '%s': %w", name, err)
}

return nil
}

func (c incusRuntime) findNetwork(interfaceName string) (found bool, info networkInfo, err error) {
b, err := c.guest.RunOutput("sudo", "incus", "network", "list", "--format", "json")
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion environment/container/incus/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func (c *incusRuntime) addContainerRoute() error {
}

// removeContainerRoute removes the macOS route for the Incus container subnet.
// This is best-effort and errors are silently ignored.
func (c *incusRuntime) removeContainerRoute() error {
if !util.MacOS() {
return nil
Expand Down
2 changes: 1 addition & 1 deletion util/macos.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func MacOS15OrNewer() bool { return minMacOSVersion("15.0.0") }

// MacOSNestedVirtualizationSupported returns if the current device supports nested virtualization.
func MacOSNestedVirtualizationSupported() bool {
return (IsMx(3) || IsMx(4)) && MacOS15OrNewer()
return (IsMx(3) || IsMx(4) || IsMx(5)) && MacOS15OrNewer()
}

func minMacOSVersion(version string) bool {
Expand Down