Commit 4a64493c authored by Leigh B. Stoller's avatar Leigh B. Stoller

Temp fix for the problem of tunnels not working, which was caused by

a missing url in the certificate for component (node). Why was that?
Well, when I create a sliver, I use the same uuid as the node, and
then later when I need to find the node for that sliver, I look for it
in the nodes table using the that uuid. This was bad cause for each
sliver I create a new certificate pair, and thus a new uuid. This
overwrites the original certificate bound to that node, only the new
certificate is not created with a URL. This is bad all around, but
with uuids being replaced by URNs and so close to the demo, I am not
going to fix this properly, but rather just avoid the problem by
reusing the existing certificate for the node when creating a sliver.
Revisit later this week.
parent 527996c8
......@@ -25,6 +25,7 @@ use GeniSlice;
use GeniRegistry;
use GeniUtil;
use emutil;
use Data::Dumper;
use English;
use overload ('""' => 'Stringify');
use XML::Simple;
......@@ -825,24 +826,25 @@ sub Create($$$$$$)
}
}
else {
#
# Need to ask the clearinghouse where this node comes from.
#
$clearinghouse = GeniRegistry::ClearingHouse->Create();
my $component = GeniComponent->Lookup($node1rspec->{'component_uuid'});
my $blob;
if ($clearinghouse->Resolve($node1rspec->{'component_uuid'},
"Component", \$blob) != 0) {
print STDERR "Could not lookup node at clearinghouse\n";
goto bad;
}
my $certificate = GeniCertificate->LoadFromString($blob->{'gid'});
goto bad
if (!defined($certificate));
my $component = GeniComponent->Lookup($certificate->uuid());
if (!defined($component)) {
#
# Need to ask the clearinghouse where this node comes from.
#
$clearinghouse = GeniRegistry::ClearingHouse->Create();
if ($clearinghouse->Resolve($node1rspec->{'component_uuid'},
"Component", \$blob) != 0) {
print STDERR "Could not lookup node at clearinghouse\n";
print STDERR Dumper($node1rspec);
goto bad;
}
my $certificate = GeniCertificate->LoadFromString($blob->{'gid'});
goto bad
if (!defined($certificate));
$component = GeniComponent->CreateFromCertificate($certificate);
if (!defined($component)) {
print STDERR "Could not create component from $certificate\n";
......@@ -866,7 +868,7 @@ sub Create($$$$$$)
if (defined($blob) && exists($blob->{'physctrl'}));
if (!defined($ctrlip1)) {
print STDERR "Could get control IP for ".
print STDERR "Could not get control IP for ".
"$node1rspec->{'component_uuid'} at $component\n";
goto bad;
}
......@@ -888,24 +890,24 @@ sub Create($$$$$$)
}
}
else {
#
# Need to ask the clearinghouse where this node comes from.
#
$clearinghouse = GeniRegistry::ClearingHouse->Create()
if (!defined($clearinghouse));
my $blob;
if ($clearinghouse->Resolve($node2rspec->{'component_uuid'},
"Component", \$blob) != 0) {
print STDERR "Could not lookup node at clearinghouse\n";
goto bad;
}
my $certificate = GeniCertificate->LoadFromString($blob->{'gid'});
goto bad
if (!defined($certificate));
my $component = GeniComponent->Lookup($certificate->uuid());
my $component = GeniComponent->Lookup($node2rspec->{'component_uuid'});
if (!defined($component)) {
#
# Need to ask the clearinghouse where this node comes from.
#
$clearinghouse = GeniRegistry::ClearingHouse->Create();
if ($clearinghouse->Resolve($node2rspec->{'component_uuid'},
"Component", \$blob) != 0) {
print STDERR "Could not lookup node at clearinghouse\n";
print STDERR Dumper($node2rspec);
goto bad;
}
my $certificate = GeniCertificate->LoadFromString($blob->{'gid'});
goto bad
if (!defined($certificate));
$component = GeniComponent->CreateFromCertificate($certificate);
if (!defined($component)) {
print STDERR "Could not create component from $certificate\n";
......@@ -929,7 +931,7 @@ sub Create($$$$$$)
if (defined($blob) && exists($blob->{'physctrl'}));
if (!defined($ctrlip2)) {
print STDERR "Could get control IP for ".
print STDERR "Could not get control IP for ".
"$node2rspec->{'component_uuid'} at $component\n";
goto bad;
}
......
......@@ -173,8 +173,19 @@ sub Create($$$$$$$$;$$$)
if ($credential->Store() != 0);
}
else {
# Create a cert pair, for this resource uuid.
$certificate = GeniCertificate->Create("sliver", $hrn, $TBOPS, $uuid);
# Create a cert pair, for this resource uuid.
if (defined($uuid) && $resource_type eq "Node") {
$certificate = GeniCertificate->Lookup($uuid);
if (defined($certificate) && $certificate->hrn() ne $hrn) {
print STDERR "GeniSliver::Create: ".
"Already have a certificate for $hrn/$uuid\n";
return undef;
}
}
$certificate = GeniCertificate->Create("sliver", $hrn, $TBOPS, $uuid)
if (!defined($certificate));
if (!defined($certificate)) {
print STDERR "GeniSliver::Create: ".
"Could not generate new certificate and UUID for $hrn/$uuid\n";
......@@ -274,8 +285,10 @@ sub Delete($$)
}
DBQueryWarn("delete from geni_credentials where this_uuid='$uuid'")
or return -1;
DBQueryWarn("delete from geni_certificates where uuid='$uuid'")
or return -1;
if ($self->resource_type() ne "Node") {
DBQueryWarn("delete from geni_certificates where uuid='$uuid'")
or return -1;
}
DBQueryWarn("delete from geni_slivers where idx='$idx'")
or return -1;
......
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