Small fixes for testing libkrun

This PR is a couple of small fixes so that our CI would be capable of running the machine test suite on the libkrun provider.

RUN-2172

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude 2024-06-27 10:26:45 -05:00
parent d367d55d33
commit d2ca2058c6
2 changed files with 12 additions and 4 deletions

View File

@ -62,10 +62,16 @@ var _ = BeforeSuite(func() {
if testProvider.VMType() == define.WSLVirt {
pullError = pullWSLDisk()
} else {
pullError = pullOCITestDisk(tmpDir, testProvider.VMType())
// This is a one-off and a little messy but once WSL switches
// to use OCI disk artifacts, we can make all the conditionals cleaner.
testDiskProvider := testProvider.VMType()
if testDiskProvider == define.LibKrun {
testDiskProvider = define.AppleHvVirt // libkrun uses the applehv image for testing
}
pullError = pullOCITestDisk(tmpDir, testDiskProvider)
}
if pullError != nil {
Fail(fmt.Sprintf("failed to pull wsl disk: %q", pullError))
Fail(fmt.Sprintf("failed to pull disk: %q", pullError))
}
})

View File

@ -126,12 +126,14 @@ func Init(opts machineDefine.InitOptions, mp vmconfigs.VMProvider) error {
switch mp.VMType() {
case machineDefine.QemuVirt:
imageExtension = ".qcow2"
case machineDefine.AppleHvVirt:
case machineDefine.AppleHvVirt, machineDefine.LibKrun:
imageExtension = ".raw"
case machineDefine.HyperVVirt:
imageExtension = ".vhdx"
case machineDefine.WSLVirt:
imageExtension = ""
default:
// do nothing
return fmt.Errorf("unknown VM type: %s", mp.VMType())
}
imagePath, err = dirs.DataDir.AppendToNewVMFile(fmt.Sprintf("%s-%s%s", opts.Name, runtime.GOARCH, imageExtension), nil)