Skip to content

Commit

Permalink
lxc/storage_volume: Don't show Usage if it wasn't retrievable
Browse files Browse the repository at this point in the history
Now Usage is shown as 0 when retrieving it is unsupported.

Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Jan 29, 2025
1 parent 2a18b2b commit 54dae7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lxc/storage_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,10 @@ func (c *cmdStorageVolumeInfo) run(cmd *cobra.Command, args []string) error {
}

if volState != nil && volState.Usage != nil {
fmt.Printf(i18n.G("Usage: %s")+"\n", units.GetByteSizeStringIEC(int64(volState.Usage.Used), 2))
if volState.Usage.Used > 0 {
fmt.Printf(i18n.G("Usage: %s")+"\n", units.GetByteSizeStringIEC(int64(volState.Usage.Used), 2))
}

if volState.Usage.Total > 0 {
fmt.Printf(i18n.G("Total: %s")+"\n", units.GetByteSizeStringIEC(int64(volState.Usage.Total), 2))
}
Expand Down

0 comments on commit 54dae7d

Please sign in to comment.