Commit 01120033 authored by Robert Ricci's avatar Robert Ricci

Add an 'includevirt' option to avail, to list virtual nodes in

addition to physcial ones.

Change the testsuite to use this option, so that 'full' mode can be
used on widearea nodes.

Also, allow the testsuite to match against node classes in addition
to types.
parent 1c2de867
......@@ -20,11 +20,13 @@ my $d = 0; #debug mode
if ($#ARGV >= 0 && $ARGV[0] =~ /^-?h/i ) {
die("Usage:\navail [help] [type[=<type>]] [OS[=<OS>]] [ver[=<OS_ver>]]\n".
" [includevirt]\n".
#" [deltas=<delta[,delta,...]>]".
# " [fixes=<fix_name[,fix_name,...]>]".
"\n".
"type \t= pc | shark\n"."OS \t= Linux | FreeBSD | NetBSD | ...\n".
"ver \t= 6.2 | 3.4 | 4.0 | 5.2 | ...\n".#"deltas \t= anetd | ...\n".
"includevirt: Include virtual nodes\n".
# "fixes \t\t= cron_off | sendmail_off | ...\n"
"A field name alone will show that field in the display of available\n".
"nodes. A field name with '=' followed by a string will match nodes\n".
......@@ -55,6 +57,9 @@ my $join= "nodes as a left join reserved as b on a.node_id=b.node_id".
" left join node_types as nt on a.type=nt.type";
my $cols= "a.node_id,a.type,nt.class";
my $cond= "b.node_id is null and a.role='testnode'";
if ($args{"includevirt"}) {
$cond .= " or a.role='virtnode' ";
}
my $os = 0;
my $delta = 0;
......
......@@ -311,14 +311,18 @@ sub step_init {
$have{$type} = [];
}
open(AVAIL,"/usr/testbed/sbin/avail |");
open(AVAIL,"/usr/testbed/sbin/avail includevirt |");
while (<AVAIL>) {
if (! /^\|/) {next};
if (/node_id/) {next;}
($node,$type) = /^\|([-a-zA-Z0-9]+)\s*\|(\w+)\s*\|$/;
($node,$type,$class) = /^\|([-a-zA-Z0-9]+)\s*\|(\w+)\s*\|(\w+)\s*\|$/;
print "node: $node type: $type\n";
if (defined($want{$type}) && $want{$type} > 0) {
push(@{$have{$type}},$node);
$want{$type}--;
} elsif (defined($want{$class}) && $want{$class} > 0) {
push(@{$have{$class}},$node);
$want{$class}--;
}
}
close(AVAIL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment