summaryrefslogtreecommitdiff
path: root/cmd/podman/machine
diff options
context:
space:
mode:
authorAnders F Björklund <anders.f.bjorklund@gmail.com>2021-09-22 12:29:28 +0200
committerAnders F Björklund <anders.f.bjorklund@gmail.com>2021-09-22 17:14:16 +0200
commit0baee2cc33000aa8d311d987308849cb2e8420d9 (patch)
tree339061aff9814738970f16accd194b0150a89090 /cmd/podman/machine
parent911298252ad38b040c261a0055931795f19b222b (diff)
downloadpodman-0baee2cc33000aa8d311d987308849cb2e8420d9.tar.gz
podman-0baee2cc33000aa8d311d987308849cb2e8420d9.tar.bz2
podman-0baee2cc33000aa8d311d987308849cb2e8420d9.zip
Also show the (initial) disk size
[NO TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Diffstat (limited to 'cmd/podman/machine')
-rw-r--r--cmd/podman/machine/list.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index b9dc62d6d..fe9d712e3 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -40,12 +40,13 @@ type listFlagType struct {
}
type machineReporter struct {
- Name string
- Created string
- LastUp string
- VMType string
- CPUs uint64
- Memory string
+ Name string
+ Created string
+ LastUp string
+ VMType string
+ CPUs uint64
+ Memory string
+ DiskSize string
}
func init() {
@@ -56,7 +57,7 @@ func init() {
flags := lsCmd.Flags()
formatFlagName := "format"
- flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\n", "Format volume output using Go template")
+ flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n", "Format volume output using Go template")
_ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, completion.AutocompleteNone)
flags.BoolVar(&listFlag.noHeading, "noheading", false, "Do not print headers")
}
@@ -87,10 +88,11 @@ func list(cmd *cobra.Command, args []string) error {
func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error {
headers := report.Headers(machineReporter{}, map[string]string{
- "LastUp": "LAST UP",
- "VmType": "VM TYPE",
- "CPUs": "CPUS",
- "Memory": "MEMORY",
+ "LastUp": "LAST UP",
+ "VmType": "VM TYPE",
+ "CPUs": "CPUS",
+ "Memory": "MEMORY",
+ "DiskSize": "DISK SIZE",
})
row := report.NormalizeFormat(listFlag.format)
@@ -142,6 +144,7 @@ func toHumanFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
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)
humanResponses = append(humanResponses, response)
}