Commit f149584a authored by Leigh Stoller's avatar Leigh Stoller

Clientside support for getting the virt node aiiributes.

parent 70bf157c
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
#
# TODO: Signal handlers for protecting db files.
......@@ -22,7 +22,7 @@ use Exporter;
ixpsetup libsetup_refresh gettopomap getfwconfig gettiptunnelconfig
gettraceconfig genhostsfile getmotelogconfig calcroutes fakejailsetup
getlocalevserver genvnodesetup getgenvnodeconfig stashgenvnodeconfig
getlinkdelayconfig getloadinfo getbootwhat
getlinkdelayconfig getloadinfo getbootwhat getnodeattributes
forcecopy getnodeuuid
getmanifest fetchmanifestblobs runbootscript runhooks
build_fake_macs
......@@ -3110,6 +3110,38 @@ sub getnodeuuid()
return $nodeuuid;
}
#
# Return the node attributes in a key/value array.
#
sub getnodeattributes($)
{
my ($rptr) = @_;
my @tmccresults = ();
my %result = ();
my $issharedhost = SHAREDHOST();
my %tmccopts = ();
if ($issharedhost) {
$tmccopts{"nocache"} = 1;
}
if (tmcc(TMCCCMD_NODEATTRIBUTES, undef, \@tmccresults, %tmccopts) < 0) {
warn("*** WARNING: Could not get node attributes from server!\n");
%$rptr = ();
return -1;
}
foreach my $line (@tmccresults) {
if ($line =~ /^(.*)="(.*)"$/ ||
$line =~ /^(.*)=(.+)$/) {
$result{$1} = $2;
}
}
%$rptr = %result;
return 0;
}
#
# Return the hostname or IP to use for a local event server.
# Defaults to "localhost" for most nodes or the physical host IP for Xen VMs.
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -35,7 +35,7 @@ use Exporter;
TMCCCMD_MOTELOG TMCCCMD_BOOTWHAT TMCCCMD_ROOTPSWD
TMCCCMD_LTMAP TMCCCMD_LTPMAP TMCCCMD_TOPOMAP TMCCCMD_LOADINFO
TMCCCMD_TPMBLOB TMCCCMD_TPMPUB TMCCCMD_DHCPDCONF TMCCCMD_MANIFEST
TMCCCMD_NODEUUID
TMCCCMD_NODEUUID TMCCCMD_NODEATTRIBUTES
);
# Must come after package declaration!
......@@ -197,6 +197,7 @@ my %commandset =
"dhcpdconf" => {TAG => "dhcpdconf"},
"manifest" => {TAG => "manifest"},
"nodeuuid" => {TAG => "nodeuuid"},
"nodeattributes" => {TAG => "nodeattributes"},
);
#
......@@ -268,6 +269,7 @@ sub TMCCCMD_LOADINFO() { $commandset{"loadinfo"}->{TAG}; }
sub TMCCCMD_DHCPDCONF() { $commandset{"dhcpdconf"}->{TAG}; }
sub TMCCCMD_MANIFEST() { $commandset{"manifest"}->{TAG}; }
sub TMCCCMD_NODEUUID() { $commandset{"nodeuuid"}->{TAG}; }
sub TMCCCMD_NODEATTRIBUTES() { $commandset{"nodeattributes"}->{TAG}; }
#
# Caller uses this routine to set configuration of this library
......
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