Commit a492e5e2 authored by Leigh B Stoller's avatar Leigh B Stoller

Add getserviceinfo() which asks tmcd for its subboss setup. This will

eventually be used for pubsubd clustering using subboss, but that is
a future commit (read: when I have time to get back to it).
parent bedf1a8a
......@@ -3318,6 +3318,40 @@ sub getenvvars($)
return 0;
}
#
# Return the service info in a key/value array.
#
sub getserviceinfo($)
{
my ($rptr) = @_;
my @tmccresults = ();
my %result = ();
my $issharedhost = SHAREDHOST();
my %tmccopts = ();
if ($issharedhost) {
$tmccopts{"nocache"} = 1;
}
if (tmcc(TMCCCMD_SERVINCEINFO, undef, \@tmccresults, %tmccopts) < 0) {
warn("*** WARNING: Could not get service info from server!\n");
%$rptr = ();
return -1;
}
foreach my $line (@tmccresults) {
foreach my $token (split(/\s+/, $line)) {
if ($token =~ /^(.*)="(.*)"$/ ||
$token =~ /^(.*)=(.+)$/) {
$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.
......
......@@ -54,7 +54,7 @@ use Exporter;
TMCCCMD_TPMBLOB TMCCCMD_TPMPUB TMCCCMD_DHCPDCONF TMCCCMD_MANIFEST
TMCCCMD_NODEUUID TMCCCMD_NODEATTRIBUTES TMCCCMD_DISKS
TMCCCMD_ARPINFO TMCCCMD_STORAGE TMCCCMD_IMAGESIZE
TMCCCMD_PNETNODEATTRS
TMCCCMD_PNETNODEATTRS TMCCCMD_SERVINCEINFO
);
# Must come after package declaration!
......@@ -222,6 +222,7 @@ my %commandset =
"storageconfig" => {TAG => "storageconfig"},
"imagesize" => {TAG => "imagesize"},
"pnetnodeattrs" => {TAG => "pnetnodeattrs"},
"serviceinfo" => {TAG => "serviceinfo"},
);
#
......@@ -299,6 +300,7 @@ sub TMCCCMD_ARPINFO() { $commandset{"arpinfo"}->{TAG}; }
sub TMCCCMD_STORAGE() { $commandset{"storageconfig"}->{TAG}; }
sub TMCCCMD_IMAGESIZE() { $commandset{"imagesize"}->{TAG}; }
sub TMCCCMD_PNETNODEATTRS() {$commandset{"pnetnodeattrs"}->{TAG}; }
sub TMCCCMD_SERVINCEINFO() {$commandset{"serviceinfo"}->{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