Re: [PATCH 5/5] virsh: allow to print hostname in domain listings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 10, 2012 at 03:18:19PM -0600, Eric Blake wrote:
> 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?

This list output is useful so I'd rather go for a more generic table
formatting. Since "virsh domhostname" is there to query the hostname,
I'll drop this patch for now until I have time to work in this again. 
Cheers,
 -- Guido

> 
> > @@ -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@xxxxxxxxxx    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]