Commit 6df6e7ba authored by Tom Mitchell's avatar Tom Mitchell

Merge branch 'master' into non-pg-users

parents d72fb5af 04977815
......@@ -52,14 +52,14 @@ TARGETS = emdb.pm emutil.pm emdbi.pm
SETUID_SBIN_SCRIPTS =
endif
$(SUBBOSS_BIN_SCRIPTS):
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(TARGETS)
$(SUBBOSS_BIN_SCRIPTS):
include $(TESTBED_SRCDIR)/GNUmakerules
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
......
......@@ -452,7 +452,7 @@ sub RedeemTickets($$$)
};
print STDERR "Redeeming all tickets in parallel ...\n";
if (ParRun(undef, \@results, $coderef, @resources)) {
if (ParRun({'maxwaittime' => 300}, \@results, $coderef, @resources)) {
print STDERR "*** RedeemTickets: Internal error getting tickets\n";
#
# Need to be careful here; some of the tickets might have been
......@@ -515,20 +515,25 @@ sub MapNodes($$)
print STDERR "$manifest_string\n"
if ($verbose);
foreach my $ref (GeniXML::FindNodes("n:node",
$manifest)->get_nodelist()) {
my $sliver_urn = GeniXML::GetSliverId($ref);
my $sliver_urn = GeniXML::GetText("sliver_urn", $ref);
my $vname = GeniXML::GetVirtualId($ref);
my $sshdport = GeniXML::GetText("sshdport", $ref);
my $manager_urn= GeniXML::GetText("component_manager_urn", $ref);
#
# The manifest can include nodes from other CMs. There will not
# be a sliver urn in that case.
#
my $component_manager_urn = GeniXML::GetManagerId($ref);
next
if (!defined($sliver_urn) && !defined($component_manager_urn));
if (!defined($sliver_urn));
# Hmm, still need to check this.
next
if (!defined($manager_urn) ||
$manager_urn ne $resource->manager_urn());
my $node = $experiment->VnameToNode($vname);
if (!defined($node)) {
......
......@@ -332,7 +332,8 @@ sub CreateFromSigned($$;$)
return undef;
}
if (!($target_certificate->hrn() =~ /^[-\w\.]+$/)) {
print STDERR "Invalid hrn in credential\n";
my $hrn = $target_certificate->hrn();
print STDERR "Invalid hrn $hrn in target of credential\n";
return undef;
}
if (!GeniHRN::IsValid($target_certificate->urn())) {
......@@ -356,7 +357,8 @@ sub CreateFromSigned($$;$)
return undef;
}
if (!($owner_certificate->hrn() =~ /^[-\w\.]+$/)) {
print STDERR "Invalid hrn in credential\n";
my $hrn = $owner_certificate->hrn();
print STDERR "Invalid hrn $hrn in owner of credential\n";
return undef;
}
if (!GeniHRN::IsValid($owner_certificate->urn())) {
......
......@@ -463,11 +463,23 @@ sub ManagerVersion($)
sub ConvertRspec($)
{
my ($rspec) = @_;
my $template;
my $template =
"<rspec xmlns=\"http://protogeni.net/resources/rspec/0.2\" ".
" type=\"request\" generated_by=\"libvtop\">".
"</rspec>";
if (1) {
$template =
"<rspec xmlns=\"http://protogeni.net/resources/rspec/0.2\" ".
" type=\"request\" generated_by=\"libvtop\">".
"</rspec>";
}
else {
$template =
"<rspec xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ".
" xsi:schemaLocation=".
"\"http://www.protogeni.net/resources/rspec/0.2 ".
" http://www.protogeni.net/resources/rspec/0.2/request.xsd\" ".
" type=\"request\" generated_by=\"libvtop\"> ".
"</rspec>";
}
my $new = GeniXML::Parse($template);
if (!defined($new)) {
......@@ -520,6 +532,14 @@ sub ConvertRspec($)
if (exists($ifaceref->{$key}));
}
}
foreach my $cmref (@{ $linkref->{'component_manager'} }) {
my $cm = GeniXML::AddElement("component_manager", $link);
foreach my $key ('id') {
GeniXML::SetText($key, $cm, $cmref->{$key})
if (exists($cmref->{$key}));
}
}
}
}
return $new;
......@@ -1106,55 +1126,6 @@ sub Clear($$)
}
}
if (defined($sliver_credential)) {
my $method_name = "DeleteSlice";
my $method_args = undef;
if ($manager_version == 1.0) {
$method_args->{'credential'} = $slice_credential->asString();
}
elsif ($manager_version == 2.0) {
$method_args->{'credentials'} = [$slice_credential->asString()];
$method_args->{'slice_urn'} = $slice->urn();
}
else {
print STDERR
"GeniResource::Clear Unknown version at $authority\n";
return -1;
}
print STDERR "Deleting sliver on $authority\n";
$response =
Genixmlrpc::CallMethod($authority->url(), $usercontext,
$method_name, $method_args);
if (!defined($response)) {
$self->{'last_rpc_error'} = GENIRESPONSE_RPCERROR();
print STDERR "*** Internal error deleting sliver for $self\n";
return -1;
}
$self->{'last_rpc_error'} = $response->code();
$self->{'last_rpc_output'} = $response->output();
$self->{'last_rpc_value'} = $response->value();
if ($response->code() != GENIRESPONSE_SUCCESS &&
$response->code() != GENIRESPONSE_SEARCHFAILED) {
print STDERR "Could not delete sliver for $self. Error: ";
print STDERR " " . $response->output() . "\n";
return -1;
}
$sliver_credential->Delete();
$self->Update({"credential_idx" => 0});
#
# Delete this now; no point in waiting for the CM to tell us.
#
# Needs to move elsewhere I think.
#
my $clientsliver =
GeniRegistry::ClientSliver->LookupByAuthority($slice,
$manager_urn);
$clientsliver->Delete()
if (defined($clientsliver));
}
if (defined($newticket)) {
my $method_name = "ReleaseTicket";
my $method_args = { "ticket" => $newticket->asString() };
......@@ -1197,6 +1168,54 @@ sub Clear($$)
$self->Update({"ticket_idx" => 0});
}
my $method_name = "DeleteSlice";
my $method_args = undef;
if ($manager_version == 1.0) {
$method_args->{'credential'} = $slice_credential->asString();
}
elsif ($manager_version == 2.0) {
$method_args->{'credentials'} = [$slice_credential->asString()];
$method_args->{'slice_urn'} = $slice->urn();
}
else {
print STDERR "GeniResource::Clear Unknown version at $authority\n";
return -1;
}
print STDERR "Deleting sliver on $authority\n";
$response =
Genixmlrpc::CallMethod($authority->url(), $usercontext,
$method_name, $method_args);
if (!defined($response)) {
$self->{'last_rpc_error'} = GENIRESPONSE_RPCERROR();
print STDERR "*** Internal error deleting sliver for $self\n";
return -1;
}
$self->{'last_rpc_error'} = $response->code();
$self->{'last_rpc_output'} = $response->output();
$self->{'last_rpc_value'} = $response->value();
if ($response->code() != GENIRESPONSE_SUCCESS &&
$response->code() != GENIRESPONSE_SEARCHFAILED) {
print STDERR "Could not delete sliver for $self. Error: ";
print STDERR " " . $response->output() . "\n";
return -1;
}
#
# Delete this now; no point in waiting for the CM to tell us.
#
# Needs to move elsewhere I think.
#
my $clientsliver =
GeniRegistry::ClientSliver->LookupByAuthority($slice,
$manager_urn);
$clientsliver->Delete()
if (defined($clientsliver));
if (defined($sliver_credential)) {
$sliver_credential->Delete();
$self->Update({"credential_idx" => 0});
}
#
# Move this elsewhere.
#
......
......@@ -652,8 +652,9 @@ sub Create($$$$$$)
return undef;
}
my $hrn;
my $sshdport;
my $sshdport = 22;
my $hostname;
my $phostname;
my $resource_id;
my $sliver_uuid;
......@@ -671,13 +672,14 @@ sub Create($$$$$$)
$sliver_uuid = $vnode->uuid();
$resource_id = $vnode->node_id();
$hostname = GeniUtil::FindHostname($vnode->node_id());
$phostname = GeniUtil::FindHostname($vnode->phys_nodeid());
$sshdport = $vnode->sshdport();
}
else {
$hrn = "${PGENIDOMAIN}." . $node->node_id();
$sliver_uuid = $node->uuid();
$resource_id = $node->node_id();
$hostname = GeniUtil::FindHostname($node->node_id());
$phostname = $hostname = GeniUtil::FindHostname($node->node_id());
}
#
......@@ -687,6 +689,13 @@ sub Create($$$$$$)
GeniXML::SetText("hostname", $rspec, $hostname);
GeniXML::SetText("sshdport", $rspec, $sshdport) if (defined($sshdport));
# This is a version 2.0 thing.
my $services = GeniXML::AddElement("services", $rspec);
my $login = GeniXML::AddElement("login", $services);
GeniXML::SetText("authentication", $login, "ssh-keys");
GeniXML::SetText("hostname", $login, $phostname);
GeniXML::SetText("port", $login, $sshdport);
return GeniSliver->Create($slice, $user, $sliver_uuid, $resource_uuid,
"Node", $resource_id, $hrn, $nickname, $rspec);
}
......
......@@ -337,8 +337,9 @@ sub CreateFromSignedTicket($$;$$)
print STDERR "Invalid target_uuid in credential\n";
return undef;
}
if (!($target_certificate->hrn() =~ /^[\w\.]+$/)) {
print STDERR "Invalid hrn in credential\n";
if (!($target_certificate->hrn() =~ /^[-\w\.]+$/)) {
my $hrn = $target_certificate->hrn();
print STDERR "Invalid hrn $hrn in target of ticket\n";
return undef;
}
......@@ -358,8 +359,9 @@ sub CreateFromSignedTicket($$;$$)
print STDERR "Invalid target_uuid in credential\n";
return undef;
}
if (!($owner_certificate->hrn() =~ /^[\w\.]+$/)) {
print STDERR "Invalid hrn in credential\n";
if (!($owner_certificate->hrn() =~ /^[-\w\.]+$/)) {
my $hrn = $owner_certificate->hrn();
print STDERR "Invalid hrn $hrn in owner of ticket\n";
return undef;
}
......
<rspec xmlns="http://protogeni.net/resources/rspec/0.1">
<node virtual_id="geni1"
colocate="geni1"
exclusive=0
exclusive="0"
virtualization_type="emulab-vnode"
virtualization_subtype="emulab-openvz">
</node>
<node virtual_id="geni2"
colocate="geni1"
exclusive=0
exclusive="0"
virtualization_type="emulab-vnode"
virtualization_subtype="emulab-openvz">
</node>
......
......@@ -1566,16 +1566,21 @@ sub Volunteers($)
package libossetup_protogeni;
use base qw(libossetup_handler);
my $PGENISUPPORT= @PROTOGENI_SUPPORT@;
use libdb;
use libtestbed;
use libossetup;
use libtblog;
use libGeni;
use Node;
use English;
use Data::Dumper;
use overload ('""' => 'Stringify');
if ($PGENISUPPORT) {
require libGeni;
}
sub New($$) {
my ($class, $parent) = @_;
......
......@@ -37,7 +37,6 @@ my $impotent = 0;
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $PGENISUPPORT= @PROTOGENI_SUPPORT@;
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
......
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