
Hello I thought it would be cool if virsh list behaves a bit more like virt-manager or xm list because as a system-administrator i want to know with one look what VMs are active, how much memory they commit and what their runtime is. I implemented this with the following patch which give such an sample output. What is your opinion and/or have i missed something? [root@rr016 ~]# virsh list --all Id Name Status Mem(kB) VCPUs Time(s) --------------------------------------------------------------- 1 rr019v3 laufend 1572864 2 15,3 2 rr019v4 laufend 1572864 2 11,7 - OpenSolaris08.11 ausschalten - Win7b_64 ausschalten --- a/src/virsh.c 2009-04-15 21:43:26.000000000 +0200 +++ b/src/virsh.c 2009-05-15 21:35:53.000000000 +0200 @@ -658,14 +658,16 @@ qsort(&names[0], maxname, sizeof(char*), namesorter); } } - vshPrintExtra(ctl, "%3s %-20s %s\n", _("Id"), _("Name"), _("State")); - vshPrintExtra(ctl, "----------------------------------\n"); + vshPrintExtra(ctl, "%3s %-20s %-15s %-8s %-5s %-7s\n", _("Id"), _("Name"), _("State"), + _("Mem(kB)"), _("VCPUs"), _("Time(s)")); + vshPrintExtra(ctl, "---------------------------------------------------------------\n"); for (i = 0; i < maxid; i++) { virDomainInfo info; virDomainPtr dom = virDomainLookupByID(ctl->conn, ids[i]); const char *state; - + double cpuUsed = 0; + /* this kind of work with domains is not atomic operation */ if (!dom) continue; @@ -675,10 +677,19 @@ else state = N_(vshDomainStateToString(info.state)); - vshPrint(ctl, "%3d %-20s %s\n", + if (info.cpuTime != 0) { + cpuUsed = info.cpuTime; + + cpuUsed /= 1000000000.0; + } + + vshPrint(ctl, "%3d %-20s %-15s %-8d %-5d %7.1f\n", virDomainGetID(dom), virDomainGetName(dom), - state); + state, + virDomainGetMaxMemory(dom), + info.nrVirtCpu, + cpuUsed); virDomainFree(dom); } for (i = 0; i < maxname; i++) {