summaryrefslogtreecommitdiff
path: root/cmd/podman/machine/list.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-26 13:26:07 +0100
committerGitHub <noreply@github.com>2021-12-26 13:26:07 +0100
commite06631d6c22f4d5b7a62f70ccdf623379a9d5fe7 (patch)
tree54fe3a08b58b9129f87e51cd1b8fcd938f582777 /cmd/podman/machine/list.go
parent73a54ea54d0a1b4ccaa2a0e23c678e5b7c1d5c37 (diff)
parent803defbe509af1902a1fdc2ed7f41b49ebd241f6 (diff)
downloadpodman-e06631d6c22f4d5b7a62f70ccdf623379a9d5fe7.tar.gz
podman-e06631d6c22f4d5b7a62f70ccdf623379a9d5fe7.tar.bz2
podman-e06631d6c22f4d5b7a62f70ccdf623379a9d5fe7.zip
Merge pull request #12503 from n1hility/wsl-machine
Introduce Windows WSL implementation of podman machine
Diffstat (limited to 'cmd/podman/machine/list.go')
-rw-r--r--cmd/podman/machine/list.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index 774ab4fd0..858d87401 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -1,4 +1,5 @@
-// +build amd64,!windows arm64,!windows
+//go:build amd64 || arm64
+// +build amd64 arm64
package machine
@@ -16,7 +17,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/machine"
- "github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -69,9 +69,14 @@ func init() {
}
func list(cmd *cobra.Command, args []string) error {
- var opts machine.ListOptions
- // We only have qemu VM's for now
- listResponse, err := qemu.List(opts)
+ var (
+ opts machine.ListOptions
+ listResponse []*machine.ListResponse
+ err error
+ )
+
+ provider := getSystemDefaultProvider()
+ listResponse, err = provider.List(opts)
if err != nil {
return errors.Wrap(err, "error listing vms")
}
@@ -182,8 +187,8 @@ func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
response.Stream = streamName(vm.Stream)
response.VMType = vm.VMType
response.CPUs = vm.CPUs
- response.Memory = strUint(vm.Memory * units.MiB)
- response.DiskSize = strUint(vm.DiskSize * units.GiB)
+ response.Memory = strUint(vm.Memory)
+ response.DiskSize = strUint(vm.DiskSize)
machineResponses = append(machineResponses, response)
}
@@ -214,8 +219,8 @@ func toHumanFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
response.Created = units.HumanDuration(time.Since(vm.CreatedAt)) + " ago"
response.VMType = vm.VMType
response.CPUs = vm.CPUs
- response.Memory = units.HumanSize(float64(vm.Memory) * units.MiB)
- response.DiskSize = units.HumanSize(float64(vm.DiskSize) * units.GiB)
+ response.Memory = units.HumanSize(float64(vm.Memory))
+ response.DiskSize = units.HumanSize(float64(vm.DiskSize))
humanResponses = append(humanResponses, response)
}