[libvirt] [PATCH] virsh: Fix vol-info's 'Type' output

Ryota Ozaki ozaki.ryota at gmail.com
Sat Oct 22 04:23:34 UTC 2011


On Thu, Oct 20, 2011 at 8:30 PM, Osier Yang <jyang at redhat.com> wrote:
> 于 2011年10月20日 18:44, Ryota Ozaki 写道:
>>
>> We have a new type "dir" in addition to "file" and "block", but
>
> s/type/vol type/
>
>> virsh doen't know it. Fix it.
>
> s/doen't/doesn't/
>
>>
>> Additionally, the patch lets virsh output "unknown" if not matched
>> any of them.
>> ---
>>  tools/virsh.c |   19 ++++++++++++++++---
>>  1 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/virsh.c b/tools/virsh.c
>> index 42f62d7..72344f0 100644
>> --- a/tools/virsh.c
>> +++ b/tools/virsh.c
>> @@ -9540,9 +9540,22 @@ cmdVolInfo(vshControl *ctl, const vshCmd *cmd)
>>      if (virStorageVolGetInfo(vol,&info) == 0) {
>>          double val;
>>          const char *unit;
>> -        vshPrint(ctl, "%-15s %s\n", _("Type:"),
>> -                 info.type == VIR_STORAGE_VOL_FILE ?
>> -                 _("file") : _("block"));
>> +        switch(info.type) {
>> +        case VIR_STORAGE_VOL_FILE:
>> +            vshPrint(ctl, "%-15s %s\n", _("Type:"), _("file"));
>> +            break;
>> +
>> +        case VIR_STORAGE_VOL_BLOCK:
>> +            vshPrint(ctl, "%-15s %s\n", _("Type:"), _("block"));
>> +            break;
>> +
>> +        case VIR_STORAGE_VOL_DIR:
>> +            vshPrint(ctl, "%-15s %s\n", _("Type:"), _("dir"));
>> +            break;
>> +
>> +        default:
>> +            vshPrint(ctl, "%-15s %s\n", _("Type:"), _("unknown"));
>> +        }
>>
>>          val = prettyCapacity(info.capacity,&unit);
>>          vshPrint(ctl, "%-15s %2.2lf %s\n", _("Capacity:"), val, unit);
>
> ACK

Thanks! I'll send revised one soon.

  ozaki-r




More information about the libvir-list mailing list