]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Fix vol-info's 'Type' output
authorRyota Ozaki <ozaki.ryota@gmail.com>
Sat, 22 Oct 2011 04:24:17 +0000 (13:24 +0900)
committerOsier Yang <jyang@redhat.com>
Mon, 24 Oct 2011 01:44:25 +0000 (09:44 +0800)
We have a new vol type "dir" in addition to "file" and "block", but
virsh doesn't know it. Fix it.

Additionally, the patch lets virsh output "unknown" if not matched
any of them.

tools/virsh.c

index 42f62d71345eb4173bbe9ca3100689f15f9f846b..72344f0ba25b9c101ca9ec9a41157413a49be261 100644 (file)
@@ -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);