Skip to content

Commit

Permalink
incus-agent: Load virtio_net before configuring NICs
Browse files Browse the repository at this point in the history
On some distros, virtio_net may not be loaded by the time the agent starts up.

This isn't really a problem normally as the agent doesn't need access to
the network, but it is a problem if the user is using agent.nic_config
to rename network interfaces.

So just attempt to load virtio_net prior to performing any reconfiguration.

Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Feb 16, 2024
1 parent 4a5dfbc commit ea14366
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/incus-agent/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/lxc/incus/internal/revert"
deviceConfig "github.com/lxc/incus/internal/server/device/config"
"github.com/lxc/incus/internal/linux"
"github.com/lxc/incus/internal/server/ip"
"github.com/lxc/incus/internal/server/util"
"github.com/lxc/incus/shared/logger"
Expand Down Expand Up @@ -72,6 +73,9 @@ func reconfigureNetworkInterfaces() {
return
}

// Attempt to load the virtio_net driver in case it's not be loaded yet.
_ = linux.LoadModule("virtio_net")

// nicData is a map of MAC address to NICConfig.
nicData := make(map[string]deviceConfig.NICConfig, len(nicDirEntries))

Expand Down

0 comments on commit ea14366

Please sign in to comment.