mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
virsh: volume: Add --bytes to 'vol-info'
This commit is contained in:
parent
784b9cc821
commit
f4bdf2e3ab
@ -992,6 +992,10 @@ static const vshCmdInfo info_vol_info[] = {
|
|||||||
static const vshCmdOptDef opts_vol_info[] = {
|
static const vshCmdOptDef opts_vol_info[] = {
|
||||||
VIRSH_COMMON_OPT_VOLUME_VOL,
|
VIRSH_COMMON_OPT_VOLUME_VOL,
|
||||||
VIRSH_COMMON_OPT_POOL_OPTIONAL,
|
VIRSH_COMMON_OPT_POOL_OPTIONAL,
|
||||||
|
{.name = "bytes",
|
||||||
|
.type = VSH_OT_BOOL,
|
||||||
|
.help = N_("sizes are represented in bytes rather than pretty units")
|
||||||
|
},
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1000,6 +1004,7 @@ cmdVolInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
{
|
{
|
||||||
virStorageVolInfo info;
|
virStorageVolInfo info;
|
||||||
virStorageVolPtr vol;
|
virStorageVolPtr vol;
|
||||||
|
bool bytes = vshCommandOptBool(cmd, "bytes");
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
|
if (!(vol = virshCommandOptVol(ctl, cmd, "vol", "pool", NULL)))
|
||||||
@ -1014,11 +1019,21 @@ cmdVolInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshPrint(ctl, "%-15s %s\n", _("Type:"),
|
vshPrint(ctl, "%-15s %s\n", _("Type:"),
|
||||||
virshVolumeTypeToString(info.type));
|
virshVolumeTypeToString(info.type));
|
||||||
|
|
||||||
|
if (bytes) {
|
||||||
|
vshPrint(ctl, "%-15s %llu %s\n", _("Capacity:"),
|
||||||
|
info.capacity, _("bytes"));
|
||||||
|
} else {
|
||||||
val = vshPrettyCapacity(info.capacity, &unit);
|
val = vshPrettyCapacity(info.capacity, &unit);
|
||||||
vshPrint(ctl, "%-15s %2.2lf %s\n", _("Capacity:"), val, unit);
|
vshPrint(ctl, "%-15s %2.2lf %s\n", _("Capacity:"), val, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytes) {
|
||||||
|
vshPrint(ctl, "%-15s %llu %s\n", _("Allocation:"),
|
||||||
|
info.allocation, _("bytes"));
|
||||||
|
} else {
|
||||||
val = vshPrettyCapacity(info.allocation, &unit);
|
val = vshPrettyCapacity(info.allocation, &unit);
|
||||||
vshPrint(ctl, "%-15s %2.2lf %s\n", _("Allocation:"), val, unit);
|
vshPrint(ctl, "%-15s %2.2lf %s\n", _("Allocation:"), val, unit);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
@ -3639,11 +3639,13 @@ is in. I<vol-name-or-key-or-path> is the name or key or path of the volume
|
|||||||
to output the XML of.
|
to output the XML of.
|
||||||
|
|
||||||
=item B<vol-info> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
|
=item B<vol-info> [I<--pool> I<pool-or-uuid>] I<vol-name-or-key-or-path>
|
||||||
|
[I<--bytes>]
|
||||||
|
|
||||||
Returns basic information about the given storage volume.
|
Returns basic information about the given storage volume.
|
||||||
I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
|
I<--pool> I<pool-or-uuid> is the name or UUID of the storage pool the volume
|
||||||
is in. I<vol-name-or-key-or-path> is the name or key or path of the volume
|
is in. I<vol-name-or-key-or-path> is the name or key or path of the volume
|
||||||
to return information for.
|
to return information for. If I<--bytes> is specified the sizes are not
|
||||||
|
converted to human friendly units.
|
||||||
|
|
||||||
=item B<vol-list> [I<--pool> I<pool-or-uuid>] [I<--details>]
|
=item B<vol-list> [I<--pool> I<pool-or-uuid>] [I<--details>]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user