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

Re: [Xen-devel] [OSSTEST PATCH 06/24] cs-hosts-list: New utility



On Thu, May 18, 2017 at 12:01:16PM +0100, Ian Jackson wrote:
> No callers yet.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> ---
>  cs-hosts-list | 64 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
>  create mode 100755 cs-hosts-list
> 
> diff --git a/cs-hosts-list b/cs-hosts-list
> new file mode 100755
> index 0000000..1fea3cd
> --- /dev/null
> +++ b/cs-hosts-list
> @@ -0,0 +1,64 @@
> +#!/usr/bin/perl -w
> +
> +# This is part of "osstest", an automated testing framework for Xen.
> +# Copyright (C) 2009-2013 Citrix Inc.
                        ^ 2017?
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU Affero General Public License as published by
> +# the Free Software Foundation, either version 3 of the License, or
> +# (at your option) any later version.
> +# 
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU Affero General Public License for more details.
> +# 
> +# You should have received a copy of the GNU Affero General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +
> +# usage:
> +#   ./cs-hosts-list HOSTFLAG[,...]
> +# prints the names of all hosts which have all of the HOSTFLAGs set,
> +# one per line
> +
> +use strict qw(vars);
> +use DBI;
> +unshift @INC, qw(.);
> +use Osstest;
> +
> +csreadconfig();
> +
> +@ARGV == 1 or die $!;
> +my ($flags) = @ARGV;
> +$flags =~ m/^-/ and die $!;
> +
> +my @qargs;
> +my $qtxt= <<END;
> +        SELECT resname
> +          FROM resources
> +         WHERE restype='host'
> +END
> +foreach my $flag (grep { length} split /\,/, $flags) {
> +    $qtxt.= <<END;
> +        AND EXISTS (SELECT 1 FROM HOSTFLAGS f
> +                            WHERE resname=f.hostname
> +                              AND f.hostflag=?)

There seems to be a mix between hard tabs and spaces above.

> +END
> +    push @qargs, $flag;
> +}
> +
> +my $q= $dbh_tests->prepare($qtxt);
> +my $o;
> +
> +db_retry($dbh_tests,[],sub {
> +    $o='';
> +    $q->execute(@qargs);
> +    while (my ($host) = $q->fetchrow_array()) {
> +     $o .= $host;
> +     $o .= "\n";
> +    }
> +});
> +
> +print $o or die $!;
> +close STDOUT or die $!;

Don't know that much about osstest DB (or DB's in general), but I don't see
anything obviously wrong:

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.