Commit 560f3cce authored by Mike Hibler's avatar Mike Hibler
Browse files

Merge remote branch 'central/master'

parents 19428e4f ed105035
......@@ -190,6 +190,7 @@ while (<IF>) {
my $mac = $row{"MAC"};
my $node_id;
my $next_server = "";
my $bootinfo_server = "";
my $hostname = "";
my $dns = "";
my $booting = "";
......@@ -243,10 +244,13 @@ while (<IF>) {
"${spaces}\toption host-name \"$node_id\";\n";
my $query_result =
DBQueryWarn( "(select attrvalue from node_attributes where node_id = '$node_id' " .
" and attrkey = 'tftp_server' ) union " .
"(select attrvalue from node_type_attributes where type = '$nodetype' " .
" and attrkey = 'tftp_server') limit 1" );
DBQueryWarn( "(select attrvalue from " .
"node_attributes where node_id = '$node_id' " .
" and attrkey = 'tftp_server' ) union " .
"(select attrvalue from " .
"node_type_attributes where type = " .
"'$nodetype' " .
" and attrkey = 'tftp_server') limit 1" );
if (! $query_result) {
fatal("Could not get tftp_server data from DB!");
......@@ -257,6 +261,25 @@ while (<IF>) {
$next_server = "${spaces}\tnext-server " .
$tftp_server . ";\n";
}
$query_result =
DBQueryWarn( "(select attrvalue from " .
"node_attributes where node_id = '$node_id' " .
" and attrkey = 'bootinfo_server' ) union " .
"(select attrvalue from " .
"node_type_attributes where type = " .
"'$nodetype' " .
" and attrkey = 'bootinfo_server') limit 1" );
if (! $query_result) {
fatal("Could not get bootinfo_server data from DB!");
}
if (my %row = $query_result->fetchhash()) {
$bootinfo_server = "${spaces}\toption " .
"PXE.emulab-bootinfo " .
$row{'attrvalue'} . ";\n";
}
}
#
......@@ -299,6 +322,7 @@ while (<IF>) {
print $OUT "${spaces}host $ip {\n";
print $OUT $filename;
print $OUT $next_server;
print $OUT $bootinfo_server;
print $OUT $dns;
print $OUT $booting;
print $OUT "${spaces}\thardware ethernet $mac;\n";
......
......@@ -27,6 +27,7 @@ ddns-update-style none; # req'd vers 3 directive
# to start a new MTFTP transfer
# Code 5: Number of secondes a client must listen before trying to restart
# a MTFTP transfer
# Code 128: IP address of Emulab bootinfo server
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
......@@ -35,6 +36,7 @@ option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
option PXE.emulab-bootinfo code 128 = ip-address;
#
# For PXE booting nodes we set the magic bits to tell the client that we are
......
......@@ -663,7 +663,7 @@ sub GetManifest($$)
return $manifest
if (!$asxml);
$xml = $manifest->toStringC14N();
$xml = GeniXML::Serialize($manifest);
return $xml;
}
......
......@@ -691,7 +691,7 @@ sub GetTicketAuxAux($$$$$$$$)
}
}
print $rspec->toStringC14N();
print GeniXML::Serialize($rspec);
foreach my $ref (GeniXML::FindNodes("n:node", $rspec)->get_nodelist()) {
my $resource_uuid = GeniXML::GetNodeId($ref);
......@@ -1150,7 +1150,7 @@ sub GetTicketAuxAux($$$$$$$$)
}
unlink($tmpfile);
print $solution->toStringC14N();
print GeniXML::Serialize($solution);
foreach my $ref (GeniXML::FindNodes("n:node",
$solution)->get_nodelist()) {
......@@ -1239,7 +1239,7 @@ sub GetTicketAuxAux($$$$$$$$)
goto bad;
}
print $rspec->toStringC14N();
print GeniXML::Serialize($rspec);
# Nalloc might fail if the node gets picked up by someone else.
if (@nodeids && !$impotent) {
......@@ -1274,7 +1274,7 @@ sub GetTicketAuxAux($$$$$$$$)
# Create a new ticket.
#
my $newticket = GeniTicket->Create($authority, $user,
$rspec->toStringC14N());
GeniXML::Serialize($rspec));
if (!defined($newticket)) {
$response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef,
......@@ -1559,7 +1559,7 @@ sub SliverWorkAux($$$$$$$)
my @freelinks= ();
my $needplabslice = 0;
print $rspec->toStringC14N();
print GeniXML::Serialize($rspec);
#
# Find current slivers and save.
......@@ -2265,7 +2265,7 @@ sub SliverWorkAux($$$$$$$)
}
# The Manifest.
my $manifest = $rspec->toStringC14N();
my $manifest = GeniXML::Serialize($rspec);
#
# Move this elsewhere.
......@@ -2611,7 +2611,7 @@ sub StartSliver($)
}
if (defined($manifest)) {
print $manifest->toStringC14N();
print GeniXML::Serialize($manifest);
#
# This is not signed, so have to be very careful about using
......@@ -3401,7 +3401,7 @@ sub SliverTicket($)
POSIX::strftime("20%y-%m-%dT%H:%M:%S",
gmtime(str2time($slice->expires()))));
my $rspec_xml = $rspec->toStringC14N();
my $rspec_xml = GeniXML::Serialize($rspec);
#
# Create a new ticket.
......@@ -4073,7 +4073,7 @@ sub UpdateManifest($)
}
}
my $manifest = $rspec->toStringC14N();
my $manifest = GeniXML::Serialize($rspec);
#
# Move this elsewhere.
......
......@@ -408,7 +408,8 @@ sub DeleteSliver($)
$response = GeniResponse->Create(GENIRESPONSE_ERROR);
goto bad;
}
my $ticket = GeniTicket->Create($authority, $user, $manifest->toStringC14N());
my $ticket = GeniTicket->Create($authority, $user,
GeniXML::Serialize($manifest));
if (!defined($ticket)) {
print STDERR "Could not create new ticket for $slice\n";
$response = GeniResponse->Create(GENIRESPONSE_ERROR);
......
......@@ -431,7 +431,7 @@ sub Sign($$)
if ($self->extensions()->size() > 0) {
$cap_xml .= "<extensions>\n";
foreach my $node ($self->extensions()->get_nodelist()) {
$cap_xml .= $node->toStringC14N();
$cap_xml .= GeniXML::Serialize($node);
}
$cap_xml .= "</extensions>\n";
}
......
......@@ -392,6 +392,7 @@ sub UpdateManifest($$)
return -1;
}
my $manifest_idx = $self->manifest_idx();
my $manifest_string =
eval { XMLout($manifest, "NoAttr" => 1, RootName => "manifest") };
if ($@) {
......@@ -399,6 +400,7 @@ sub UpdateManifest($$)
print STDERR Dumper($manifest);
return -1;
}
my $query_result =
DBQueryWarn("update geni_manifests set ".
" manifest=". DBQuoteSpecial($manifest_string) . ", " .
......@@ -477,6 +479,7 @@ sub GetTicket($$$$)
print STDERR Dumper($rspec);
return -1;
}
$rspec_string =~ s/opt\>/rspec\>/g;
#
......
......@@ -197,7 +197,7 @@ sub Create($$$$$$$$$)
push(@insert_data, "slice_uuid='$slice_uuid'");
if (defined($rspec)) {
my $rspec_string = $rspec->toStringC14N();
my $rspec_string = GeniXML::Serialize($rspec);
my $safe_rspec = DBQuoteSpecial($rspec_string);
push(@insert_data, "rspec_string=$safe_rspec");
......@@ -301,7 +301,7 @@ sub GetManifest($$)
return $manifest
if (!$asxml);
my $xml = $self->rspec()->toStringC14N();
my $xml = GeniXML::Serialize($self->rspec());
return $xml;
}
......
......@@ -578,7 +578,7 @@ sub rspecXML($)
return undef
if (!defined($self->rspec()));
return $self->rspec()->toStringC14N();
return GeniXML::Serialize($self->rspec());
}
#
......@@ -710,7 +710,7 @@ sub RunSigner($$)
my $target_cert = $self->target_cert()->cert();
my $owner_cert = $self->owner_cert()->cert();
my $ticket_uuid = $self->{'ticket_uuid'};
my $rspec_xml = $self->rspec()->toStringC14N();
my $rspec_xml = GeniXML::Serialize($self->rspec());
# Convert to GMT.
$expires = POSIX::strftime("20%y-%m-%dT%H:%M:%S",
......@@ -803,7 +803,7 @@ sub Release($$)
my $resource_uuid = GeniXML::GetNodeId($ref);
if (!defined($resource_uuid)) {
print STDERR "No resource id for node in ticket\n";
print $ref->toStringC14N();
print GeniXML::Serialize($ref);
return -1;
}
......@@ -878,7 +878,7 @@ sub ReleaseHolding($$)
my $resource_uuid = GeniXML::GetNodeId($ref);
if (!defined($resource_uuid)) {
print STDERR "No resource id for node in ticket\n";
print $ref->toStringC14N();
print GeniXML::Serialize($ref);
return -1;
}
......
......@@ -68,7 +68,7 @@ sub NewSliver($$$$)
}
}
if (defined($sliver->rspec())) {
my $rspec_string = $sliver->rspec()->toStringC14N();
my $rspec_string = GeniXML::Serialize($sliver->rspec());
my $safe_rspec = DBQuoteSpecial($rspec_string);
push(@insert_data, "rspec_string=$safe_rspec");
......@@ -310,7 +310,7 @@ sub NewManifest($$$)
my @insert_data = ();
my $aggregate_uuid = $aggregate->uuid();
my $manifest_string = $manifest->toStringC14N();
my $manifest_string = GeniXML::Serialize($manifest);
my $safe_manifest = DBQuoteSpecial($manifest_string);
# Insert into DB.
......
......@@ -244,6 +244,17 @@ sub GetText($$)
return $result;
}
# Converts the XML representation of a node to a UTF-8 string and
# outputs it as a complete XML document.
sub Serialize($)
{
my ($node) = @_;
my $newnode = $node->cloneNode(1);
return $newnode->toString();
}
# Create a new XML document with a given namespace URI and document
# element name.
sub CreateDocument($$)
{
my ($ns, $name) = @_;
......@@ -253,6 +264,8 @@ sub CreateDocument($$)
return $doc;
}
# Add a new element to a node. The new element will have the given
# name and be otherwise empty.
sub AddElement($$)
{
my ($name, $node) = @_;
......@@ -261,6 +274,8 @@ sub AddElement($$)
return $child;
}
# Remove a node with a given name from a node. It will be removed
# whether it is an attribute or an element. The name is not an xpath.
sub RemoveChild($$)
{
my ($name, $node) = @_;
......
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