mirror of
https://github.com/containers/podman.git
synced 2025-10-17 11:14:40 +08:00
Move detection of libkrun and intel
A review comment post merge suggested I move the detection of libkrun and intel into the provider.Get() Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -8,7 +8,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -16,7 +15,6 @@ import (
|
|||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/cmd/podman/validate"
|
"github.com/containers/podman/v5/cmd/podman/validate"
|
||||||
"github.com/containers/podman/v5/libpod/events"
|
"github.com/containers/podman/v5/libpod/events"
|
||||||
"github.com/containers/podman/v5/pkg/machine/define"
|
|
||||||
"github.com/containers/podman/v5/pkg/machine/env"
|
"github.com/containers/podman/v5/pkg/machine/env"
|
||||||
provider2 "github.com/containers/podman/v5/pkg/machine/provider"
|
provider2 "github.com/containers/podman/v5/pkg/machine/provider"
|
||||||
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
|
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
|
||||||
@ -59,9 +57,6 @@ func machinePreRunE(c *cobra.Command, args []string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if provider.VMType() == define.LibKrun && runtime.GOARCH == "amd64" {
|
|
||||||
return errors.New("libkrun is not supported on Intel based machines. Please revert to the applehv provider")
|
|
||||||
}
|
|
||||||
return rootlessOnly(c, args)
|
return rootlessOnly(c, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package provider
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -36,6 +37,9 @@ func Get() (vmconfigs.VMProvider, error) {
|
|||||||
case define.AppleHvVirt:
|
case define.AppleHvVirt:
|
||||||
return new(applehv.AppleHVStubber), nil
|
return new(applehv.AppleHVStubber), nil
|
||||||
case define.LibKrun:
|
case define.LibKrun:
|
||||||
|
if runtime.GOARCH == "amd64" {
|
||||||
|
return nil, errors.New("libkrun is not supported on Intel based machines. Please revert to the applehv provider")
|
||||||
|
}
|
||||||
return new(libkrun.LibKrunStubber), nil
|
return new(libkrun.LibKrunStubber), nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
||||||
|
Reference in New Issue
Block a user