On 07/10/2012 02:46 PM, Guido Günther wrote:
---
tools/virsh.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 591a1ce..2c0446c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1292,6 +1292,7 @@ static const vshCmdOptDef opts_list[] = {
{"managed-save", VSH_OT_BOOL, 0,
N_("mark inactive domains with managed save state")},
{"title", VSH_OT_BOOL, 0, N_("show short domain description")},
+ {"hostname", VSH_OT_BOOL, 0, N_("show domain hostname")},
{NULL, 0, 0, NULL}
I'm worried that we're trying to cram too much into 'list'. Would
'dominfo' be a better fit for this type of information, without needing
a command line flag?
@@ -1366,6 +1368,11 @@ cmdList(vshControl *ctl, const vshCmd *cmd
ATTRIBUTE_UNUSED)
_("Id"), _("Name"), _("State"),
_("Title"),
"-----------------------------------------"
"-----------------------------------------");
+ else if (optHostname)
+ vshPrintExtra(ctl, " %-5s %-30s %-10s %-20s\n%s\n",
+ _("Id"), _("Name"), _("State"),
_("Hostname"),
+ "-----------------------------------------"
+ "-----------------------------------------");
If we're going to support this in 'list', then we really need to
implement a more generic way to format data into columns, with as many
columns as needed per row.
else
vshPrintExtra(ctl, " %-5s %-30s %s\n%s\n",
_("Id"), _("Name"), _("State"),
@@ -1397,6 +1404,15 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
title);
VIR_FREE(title);
+ } else if (optHostname) {
+ if (!(hostname = virDomainGetHostname (dom, 0)))
No space before () in function calls.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org