Skip to content

Commit a75cc7e

Browse files
anjannathpraveenkumar
authored andcommitted
cleanup: delete VM before deleting the machine's dir
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
1 parent f97ac08 commit a75cc7e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/crc/preflight/preflight_windows.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ var hypervPreflightChecks = []Check{
7070

7171
labels: labels{Os: Windows, NetworkMode: System},
7272
},
73-
{
74-
cleanupDescription: "Removing crc's virtual machine",
75-
cleanup: removeCrcVM,
76-
flags: CleanUpOnly,
73+
}
7774

78-
labels: labels{Os: Windows},
79-
},
75+
var cleanupCheckRemoveCrcVM = Check{
76+
cleanupDescription: "Removing crc's virtual machine",
77+
cleanup: removeCrcVM,
78+
flags: CleanUpOnly,
79+
80+
labels: labels{Os: Windows},
8081
}
8182

8283
var vsockChecks = []Check{
@@ -200,6 +201,7 @@ func getChecks(bundlePath string, preset crcpreset.Preset) []Check {
200201
checks = append(checks, vsockChecks...)
201202
checks = append(checks, bundleCheck(bundlePath, preset))
202203
checks = append(checks, genericCleanupChecks...)
204+
checks = append(checks, cleanupCheckRemoveCrcVM)
203205
checks = append(checks, daemonTaskChecks...)
204206
checks = append(checks, adminHelperServiceCheks...)
205207
return checks

0 commit comments

Comments
 (0)