mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
machine: Add -all-providers flag to machine list
Podman machine list now supports a new option, --all-providers, which lists all machines from all providers. Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
@@ -42,11 +42,11 @@ func Get() (vmconfigs.VMProvider, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func GetAll(_ bool) ([]vmconfigs.VMProvider, error) {
|
||||
func GetAll() []vmconfigs.VMProvider {
|
||||
return []vmconfigs.VMProvider{
|
||||
new(applehv.AppleHVStubber),
|
||||
new(libkrun.LibKrunStubber),
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// SupportedProviders returns the providers that are supported on the host operating system
|
||||
@@ -58,27 +58,23 @@ func SupportedProviders() []define.VMType {
|
||||
return supported
|
||||
}
|
||||
|
||||
// InstalledProviders returns the supported providers that are installed on the host
|
||||
func InstalledProviders() ([]define.VMType, error) {
|
||||
installed := []define.VMType{}
|
||||
|
||||
appleHvInstalled, err := appleHvInstalled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
func IsInstalled(provider define.VMType) (bool, error) {
|
||||
switch provider {
|
||||
case define.AppleHvVirt:
|
||||
ahv, err := appleHvInstalled()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return ahv, nil
|
||||
case define.LibKrun:
|
||||
lkr, err := libKrunInstalled()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return lkr, nil
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
if appleHvInstalled {
|
||||
installed = append(installed, define.AppleHvVirt)
|
||||
}
|
||||
|
||||
libKrunInstalled, err := libKrunInstalled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if libKrunInstalled {
|
||||
installed = append(installed, define.LibKrun)
|
||||
}
|
||||
|
||||
return installed, nil
|
||||
}
|
||||
|
||||
func appleHvInstalled() (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user