[libvirt] [PATCH] virsh domiflist: change output

When using "virsh domifstat" command or "virsh domiftune" command, we pass an interface name as a parameter, so interface name is important. "virsh domiflist" output should display interface names on the first row. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> --- tools/virsh.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: libvirt.capability/tools/virsh.c =================================================================== --- libvirt.capability.orig/tools/virsh.c +++ libvirt.capability/tools/virsh.c @@ -2034,8 +2034,8 @@ cmdDomiflist(vshControl *ctl, const vshC if (ninterfaces < 0) goto cleanup; - vshPrint(ctl, "%-10s %-10s %-10s %-11s %s\n", _("Type"), _("Source"), - _("Target"), _("Model"), _("MAC")); + vshPrint(ctl, "%-10s %-10s %-10s %-11s %s\n", _("Interface"), _("Type"), + _("Source"), _("Model"), _("MAC")); vshPrint(ctl, "-------------------------------------------------------\n"); for (i = 0; i < ninterfaces; i++) { @@ -2057,9 +2057,10 @@ cmdDomiflist(vshControl *ctl, const vshC model = virXPathString("string(./model/@type)", ctxt); mac = virXPathString("string(./mac/@address)", ctxt); - vshPrint(ctl, "%-10s %-10s %-10s %-11s %-10s\n", type, - source ? source : "-", + vshPrint(ctl, "%-10s %-10s %-10s %-11s %-10s\n", target ? target : "-", + type, + source ? source : "-", model ? model : "-", mac ? mac : "-");

On 01/13/2012 03:41 AM, Taku Izumi wrote:
When using "virsh domifstat" command or "virsh domiftune" command, we pass an interface name as a parameter, so interface name is important.
"virsh domiflist" output should display interface names on the first row.
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> --- tools/virsh.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Hmm - type is always guaranteed, while target might be "-". Ultimately, anyone writing a script based on this information can grab the appropriate field using a simple awk script. But I don't see any problem with re-ordering the fields now, since no released version has the original order, so I went ahead and pushed this. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Taku Izumi