Commit a07c3c83 authored by Leigh Stoller's avatar Leigh Stoller

Minor change to includevirt option. Instead of "[includevirt]", the

option is now "[[includevirt] or [virtonly[=<phys>]]]". In other
words, you can ask to include virtual nodes, or you can ask for just
virtual nodes. Optionally, you can ask for the virtual nodes for a
specific physical node. I use this from assign_wrapper to map local
jail nodes.
parent d564e0fb
......@@ -20,7 +20,7 @@ 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] [rand]\n".
" [[includevirt] or [virtonly[=<phys>]]] [rand]\n".
#" [deltas=<delta[,delta,...]>]".
# " [fixes=<fix_name[,fix_name,...]>]".
"\n".
......@@ -57,10 +57,22 @@ if ( $d ) {
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' ) ";
} else {
my $cond= "b.node_id is null ";
if ($args{"virtonly"}) {
$cond .= " and ( a.role='virtnode' ";
if ($args{"virtonly"} ne '=') {
$cond .= " and a.phys_nodeid='" . $args{"virtonly"} . "' ";
}
$cond .= " ) ";
}
else {
$cond .= " and ( a.role='testnode' ";
if ($args{"includevirt"}) {
$cond .= " or a.role='virtnode' ";
}
$cond .= " ) ";
}
......
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