Skip to content

Commit

Permalink
cleanup: delete VM before deleting the machine's dir
Browse files Browse the repository at this point in the history
trying to delete the machine's dir without first deleting the hyper-v VM
causes error, since the existing VM will still be using the files inside
the machine's dir

this separates out the check deleting the VM from the list of hyperv
checks, and adds it to the list of all checks after the generic cleanup
checks to make it run before deleting the machine's dir

this fixes #3503
  • Loading branch information
anjannath authored and praveenkumar committed Jun 23, 2023
1 parent f97ac08 commit a75cc7e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/crc/preflight/preflight_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ var hypervPreflightChecks = []Check{

labels: labels{Os: Windows, NetworkMode: System},
},
{
cleanupDescription: "Removing crc's virtual machine",
cleanup: removeCrcVM,
flags: CleanUpOnly,
}

labels: labels{Os: Windows},
},
var cleanupCheckRemoveCrcVM = Check{
cleanupDescription: "Removing crc's virtual machine",
cleanup: removeCrcVM,
flags: CleanUpOnly,

labels: labels{Os: Windows},
}

var vsockChecks = []Check{
Expand Down Expand Up @@ -200,6 +201,7 @@ func getChecks(bundlePath string, preset crcpreset.Preset) []Check {
checks = append(checks, vsockChecks...)
checks = append(checks, bundleCheck(bundlePath, preset))
checks = append(checks, genericCleanupChecks...)
checks = append(checks, cleanupCheckRemoveCrcVM)
checks = append(checks, daemonTaskChecks...)
checks = append(checks, adminHelperServiceCheks...)
return checks
Expand Down

0 comments on commit a75cc7e

Please sign in to comment.