diff options
author | Jason T. Greene <jason@stacksmash.com> | 2021-11-12 00:10:58 -0600 |
---|---|---|
committer | Jason T. Greene <jason.greene@redhat.com> | 2021-12-24 19:28:10 -0600 |
commit | 803defbe509af1902a1fdc2ed7f41b49ebd241f6 (patch) | |
tree | 54fe3a08b58b9129f87e51cd1b8fcd938f582777 /cmd/podman/machine/list.go | |
parent | 73a54ea54d0a1b4ccaa2a0e23c678e5b7c1d5c37 (diff) | |
download | podman-803defbe509af1902a1fdc2ed7f41b49ebd241f6.tar.gz podman-803defbe509af1902a1fdc2ed7f41b49ebd241f6.tar.bz2 podman-803defbe509af1902a1fdc2ed7f41b49ebd241f6.zip |
Introduce Windows WSL implementation of podman machine
[NO NEW TESTS NEEDED] for now
Signed-off-by: Jason Greene <jason.greene@redhat.com>
Diffstat (limited to 'cmd/podman/machine/list.go')
-rw-r--r-- | cmd/podman/machine/list.go | 23 |
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) } |