xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <juergen.gross@ts.fujitsu.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH] xl cpupool-list: add option to list domains
Date: Tue, 11 Mar 2014 08:33:33 +0100	[thread overview]
Message-ID: <531EBC4D.7020306@ts.fujitsu.com> (raw)
In-Reply-To: <21277.43260.538618.696040@mariner.uk.xensource.com>

On 10.03.2014 12:58, Ian Jackson wrote:
> Juergen Gross writes ("[Xen-devel] [PATCH] xl cpupool-list: add option to list domains"):
>> It is rather complicated to obtain the cpupool a domain lives in. Add an
>> option -d (or --domains) to list all domains running in a cpupool.
>
> Thanks for this.  I have some comments:
>
>>   List CPU pools on the host.
>>   If I<-c> is specified, B<xl> prints a list of CPUs used by I<cpu-pool>.
>> +If I<-d> is specified, B<xl> prints a list of domains in I<cpu-pool> instead
>> +of the domain count.
>> +I<-c> and I<-d> are mutually exclusive.
>
> Couldn't we come up with an (unambiguous) output syntax that made them
> nonexclusive ?

I have no idea how to print this information in a table without producing
unaligned columns.

It would be possible, however, to add something like "xl cpupool-list --long"
to avoid this problem completely. We wouldn't need the --domains option then.
At the same time your comment regarding the comma-separated list could be
addressed.

What do you think?


Juergen

>
>> @@ -6808,15 +6826,30 @@ int main_cpupoollist(int argc, char **argv)
>>                           n++;
>>                       }
>>                   if (!opt_cpus) {
>> -                    printf("%3d %9s       y       %4d", n,
>> -                           libxl_scheduler_to_string(poolinfo[p].sched),
>> -                           poolinfo[p].n_dom);
>> +                    printf("%3d %9s       y     ", n,
>> +                           libxl_scheduler_to_string(poolinfo[p].sched));
>> +                    if (opt_domains) {
>> +                        c = 0;
>> +                        for (n = 0; n < n_domains; n++) {
>> +                            if (poolinfo[p].poolid == dominfo[n].cpupool) {
>> +                                name = libxl_domid_to_name(ctx, dominfo[n].domid);
>
> This long source line needs wrapping.
>
>> +                                printf("%s%s", c ? ", " : "", name);
>
> I'm not a huge fan of this comma-separated list.  If the list were
> space separated it could be cut-and-pasted into
>    for f in dom1 dom2; do xl somethingorother; done
> etc.
>
> Also, I think domain names aren't guaranteed not to contain commas.
> So I think you need to quote and/or escape them somehow.  I suggest
> using "-quotes iff the domain name contains whitespace.
>
> (People who put " in their domain names can send patches to \-escape
> them or something.)
>
>> +                                free(name);
>> +                                c++;
>
> And if you are going to do this delimiter checking, calling the
> variable for "what delimiter to use" "c" is a bit odd.  Presumably you
> mean count, but it's actually used as a boolean.
>
>> +                            }
>> +                        }
>> +                    }
>> +                    else
>
> } and else should be on the same line.  (Also I'm not a huge fan of
> "} else" and "else {" but we have other examples in the tree...)
>
> Thanks,
> Ian.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
>


-- 
Juergen Gross                 Principal Developer Operating Systems
PBG PDG ES&S SWE OS6                   Telephone: +49 (0) 89 62060 2932
Fujitsu                                   e-mail: juergen.gross@ts.fujitsu.com
Mies-van-der-Rohe-Str. 8                Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

  reply	other threads:[~2014-03-11  7:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18  7:38 [PATCH] xl cpupool-list: add option to list domains Juergen Gross
2014-02-19 15:07 ` Nate Studer
2014-03-04 12:19 ` Juergen Gross
2014-03-10 11:58 ` Ian Jackson
2014-03-11  7:33   ` Juergen Gross [this message]
2014-03-13 16:39     ` Ian Jackson
2014-03-17  7:52       ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531EBC4D.7020306@ts.fujitsu.com \
    --to=juergen.gross@ts.fujitsu.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).