Skip to content

Commit

Permalink
preflight: Add dispatcher file *before* creating libvirt network
Browse files Browse the repository at this point in the history
The dispatcher file is only triggered upon interface creation, so it
must be present
- at boot time
- or before the crc network is created
in order to get triggered and configure crc networking as expected.

TODO: check if restarting NetworkManager triggers dispatcher files
  • Loading branch information
cfergeau authored and praveenkumar committed Dec 3, 2020
1 parent 8fa1e02 commit 8f072a5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions pkg/crc/preflight/preflight_linux.go
Expand Up @@ -64,6 +64,14 @@ var libvirtPreflightChecks = [...]Check{
fixDescription: "Installing crc-driver-libvirt",
fix: fixMachineDriverLibvirtInstalled,
},
{
cleanupDescription: "Removing the crc VM if exists",
cleanup: removeCrcVM,
flags: CleanUpOnly,
},
}

var libvirtNetworkPreflightChecks = [...]Check{
{
configKeySuffix: "check-crc-network",
checkDescription: "Checking if libvirt 'crc' network is available",
Expand All @@ -80,11 +88,6 @@ var libvirtPreflightChecks = [...]Check{
fixDescription: "Starting libvirt 'crc' network",
fix: fixLibvirtCrcNetworkActive,
},
{
cleanupDescription: "Removing the crc VM if exists",
cleanup: removeCrcVM,
flags: CleanUpOnly,
},
}

var vsockPreflightChecks = Check{
Expand Down Expand Up @@ -162,8 +165,8 @@ func getPreflightChecks(_ bool, networkMode network.Mode) []Check {
return getPreflightChecksForDistro(distro(), networkMode)
}

func getPreflightChecksForDistro(distro *linux.OsRelease, networkMode network.Mode) []Check {
checks := commonChecks()
func getNetworkChecksForDistro(distro *linux.OsRelease, networkMode network.Mode) []Check {
var checks []Check

if networkMode == network.VSockMode {
return append(checks, vsockPreflightChecks)
Expand All @@ -187,11 +190,14 @@ func getPreflightChecksForDistro(distro *linux.OsRelease, networkMode network.Mo
return checks
}

func commonChecks() []Check {
func getPreflightChecksForDistro(distro *linux.OsRelease, networkMode network.Mode) []Check {
var checks []Check
checks = append(checks, genericPreflightChecks[:]...)
checks = append(checks, nonWinPreflightChecks[:]...)
checks = append(checks, libvirtPreflightChecks[:]...)
networkChecks := getNetworkChecksForDistro(distro, networkMode)
checks = append(checks, networkChecks...)
checks = append(checks, libvirtNetworkPreflightChecks[:]...)
return checks
}

Expand Down

0 comments on commit 8f072a5

Please sign in to comment.