]> xenbits.xensource.com Git - libvirt.git/commitdiff
Allow 10 chars for domain IDs & 30 chars for names in virsh list
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 12 Jan 2012 11:47:28 +0000 (11:47 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 12 Jan 2012 17:13:46 +0000 (17:13 +0000)
Domain IDs are at least 16 bits for most hypervisors, theoretically
event 32-bits.  3 characters is clearly too small an alignment.
Increase alignment to 5 characters to allow 16-bit domain IDs to
display cleanly. Commonly seen with LXC where domain IDs are the
process IDs by default.  Also increase the 'name' field from 20
to 30 characters to cope with longer guest names which are quite
common

tools/virsh.c

index 734c55d8a1a1f9fb2962f9c264de5d8091bed9e2..f436cf5e5099c3c7341d070d836b5df79a7702dd 100644 (file)
@@ -944,8 +944,8 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
             qsort(&names[0], maxname, sizeof(char*), namesorter);
         }
     }
-    vshPrintExtra(ctl, "%3s %-20s %s\n", _("Id"), _("Name"), _("State"));
-    vshPrintExtra(ctl, "----------------------------------\n");
+    vshPrintExtra(ctl, " %-5s %-30s %s\n", _("Id"), _("Name"), _("State"));
+    vshPrintExtra(ctl, "----------------------------------------------------\n");
 
     for (i = 0; i < maxid; i++) {
         virDomainPtr dom = virDomainLookupByID(ctl->conn, ids[i]);
@@ -954,7 +954,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
         if (!dom)
             continue;
 
-        vshPrint(ctl, "%3d %-20s %s\n",
+        vshPrint(ctl, " %-5d %-30s %s\n",
                  virDomainGetID(dom),
                  virDomainGetName(dom),
                  _(vshDomainStateToString(vshDomainState(ctl, dom, NULL))));
@@ -974,7 +974,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
             virDomainHasManagedSaveImage(dom, 0) > 0)
             state = -2;
 
-        vshPrint(ctl, "%3s %-20s %s\n",
+        vshPrint(ctl, " %-5s %-30s %s\n",
                  "-",
                  names[i],
                  state == -2 ? _("saved") : _(vshDomainStateToString(state)));