Commit 40e7cd19 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents dbac23a3 ba5d8029
......@@ -1474,10 +1474,10 @@ sub Create($$$$$$)
my $iface2ref = $interfaces[1];
# These are the ips of the tunnel.
my $ip1 = GeniXML::GetText("tunnel_ip", $iface1ref);
my $ip2 = GeniXML::GetText("tunnel_ip", $iface2ref);
my $virtid1 = GeniXML::GetInterfaceNodeId($iface1ref);
my $virtid2 = GeniXML::GetInterfaceNodeId($iface2ref);
my $ip1 = GeniXML::GetIp($iface1ref, $node1rspec);
my $ip2 = GeniXML::GetIp($iface2ref, $node2rspec);
my $virtid1 = GeniXML::GetVirtualId($node1rspec);
my $virtid2 = GeniXML::GetVirtualId($node2rspec);
my $ctrlip1;
my $ctrlip2;
my $iface1;
......
......@@ -746,6 +746,14 @@ sub GetTicketAuxAux($$$$$$$$$)
my $osname;
my $node;
# Always populate iface2node mapping, even if we let the node
# pass through.
foreach my $linkref (GeniXML::FindNodes("n:interface",
$ref)->get_nodelist()) {
my $virtual_id = GeniXML::GetInterfaceId($linkref);
$iface2node{$virtual_id} = $node_nickname;
}
# Let remote nodes pass through.
if (! GeniXML::IsLocalNode($ref)) {
$external_nodemap{$node_nickname} = $ref;
......@@ -873,7 +881,7 @@ sub GetTicketAuxAux($$$$$$$$$)
goto bad;
}
$exclusive = 1;
if (! GeniXML::SetVirtualizationType($ref, "raw")) {
if (! GeniXML::SetVirtualizationSubtype($ref, "raw")) {
$response = GeniResponse->Create(GENIRESPONSE_BADARGS,
undef,
"Malformed rspec: Cannot set virtualization_type to raw");
......@@ -1023,7 +1031,7 @@ sub GetTicketAuxAux($$$$$$$$$)
foreach my $linkref (GeniXML::FindNodes("n:interface",
$ref)->get_nodelist()) {
my $virtual_id = GeniXML::GetVirtualId($linkref);
my $virtual_id = GeniXML::GetInterfaceId($linkref);
if (!defined($virtual_id)) {
$response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
......@@ -1031,8 +1039,6 @@ sub GetTicketAuxAux($$$$$$$$$)
goto bad;
}
$iface2node{$virtual_id} = $node_nickname;
$ifacemap{$node_nickname} = {}
if (!exists($ifacemap{$node_nickname}));
......@@ -1112,8 +1118,15 @@ sub GetTicketAuxAux($$$$$$$$$)
if (!$istunnel) {
foreach my $ref (@interfaces) {
my $node_nickname = GeniXML::GetInterfaceNodeId($ref);
if (! GeniXML::IsVersion0($ref)) {
my $iface_id = GeniXML::GetInterfaceId($ref);
if (defined($iface_id)) {
$node_nickname = $iface2node{$iface_id};
}
}
if (exists($lannodes{$node_nickname})) {
if (defined($node_nickname)
&& exists($lannodes{$node_nickname})) {
$lanname = $node_nickname;
}
}
......@@ -1135,7 +1148,7 @@ sub GetTicketAuxAux($$$$$$$$$)
goto bad;
}
if (! GeniXML::IsVersion0($ref)) {
if (! GeniXML::IsVersion0($ref) && defined($iface_id)) {
$node_nickname = $iface2node{$iface_id};
}
......@@ -1319,8 +1332,9 @@ sub GetTicketAuxAux($$$$$$$$$)
my $member = "$node_nickname:$iface_vport";
my $bandwidth = 100000;
# TODO: Allow asymmetric bandwidths
# Let user override.
my $user_bandwidth = GeniXML::GetText("bandwidth", $linkref);
my $user_bandwidth = GeniXML::GetBandwidth($linkref);
if (defined($user_bandwidth)) {
$bandwidth = $user_bandwidth;
}
......@@ -2069,6 +2083,16 @@ sub SliverWorkAux($$$$$$$)
my $node_nickname = GeniXML::GetVirtualId($ref);
my $manager_id = GeniXML::GetManagerId($ref);
# Always populate iface2node mapping, even if we let the node
# pass through.
foreach my $iface (GeniXML::FindNodes("n:interface",
$ref)->get_nodelist()) {
my $iface_id = GeniXML::GetInterfaceId($iface);
if (defined($iface_id)) {
$iface2node{$iface_id} = $node_nickname;
}
}
# Let remote nodes pass through.
if (! GeniXML::IsLocalNode($ref)) {
$external_nodemap{$node_nickname} = $ref;
......@@ -2117,13 +2141,6 @@ sub SliverWorkAux($$$$$$$)
$message = "$resource_id ($node) is not available";
goto bad;
}
foreach my $iface (GeniXML::FindNodes("n:interface",
$ref)->get_nodelist()) {
my $iface_id = GeniXML::GetVirtualId($iface);
if (defined($iface_id)) {
$iface2node{$iface_id} = $node_nickname;
}
}
# Unincorporated nodes have no genisliver_idx.
my $restable = $node->ReservedTableEntry();
if (defined($restable) &&
......@@ -2531,10 +2548,25 @@ sub SliverWorkAux($$$$$$$)
$iface1ref);
my $node2_id = GeniXML::GetText("virtual_node_id",
$iface2ref);
my $node1sliver = $nodemap{$node1_id};
my $node2sliver = $nodemap{$node2_id};
my $node1rspec = $rspecmap{$node1_id};
my $node2rspec = $rspecmap{$node2_id};
if (! GeniXML::IsVersion0($linkref)) {
my $iface1_id = GeniXML::GetInterfaceId($iface1ref);
$node1_id = $iface2node{$iface1_id}
if (defined($iface1_id));
my $iface2_id = GeniXML::GetInterfaceId($iface2ref);
$node2_id = $iface2node{$iface2_id}
if (defined($iface2_id));
}
my $node1sliver;
my $node2sliver;
my $node1rspec;
my $node2rspec;
if (defined($node1_id) && defined($node2_id)) {
$node1sliver = $nodemap{$node1_id};
$node2sliver = $nodemap{$node2_id};
$node1rspec = $rspecmap{$node1_id};
$node2rspec = $rspecmap{$node2_id};
}
if (! (defined($node1sliver) || (defined($node2sliver)))) {
$message = "$linkname: No local nodes for tunnel";
......
......@@ -940,7 +940,7 @@ sub ProcessManifest($$)
my $sliver_urn = GeniXML::GetSliverId($ref);
if (defined($sliver_urn) && $sliver_urn eq $self->sliver_urn()) {
# startup command.
my $startupcmd = GeniXML::GetText("startup_command", $ref);
my $startupcmd = GeniXML::GetStartupCommand($ref);
if (defined($startupcmd)) {
if (! TBcheck_dbslot($startupcmd, "virt_nodes",
"startupcmd",
......
......@@ -13,10 +13,10 @@ use vars qw(@ISA @EXPORT);
@ISA = "Exporter";
@EXPORT = qw(Parse ParseFile IsVersion0 FindNodes FindNodesNS
FindFirst FindElement FindAttr GetNodeByVirtualId GetLinkByVirtualId
IsLanNode IsLocalNode IsTunnel GetExpires
IsLanNode IsLocalNode IsTunnel GetExpires GetBandwidth GetIp
GetNodeId GetVirtualId GetInterfaceId GetInterfaceNodeId GetSliverId
GetManagerId GetColocate GetSubnodeOf GetStartupCommand GetTarball
GetVirtualizationType SetVirtualizationType GetVirtualizationSubtype
GetVirtualizationType SetVirtualizationSubtype GetVirtualizationSubtype
GetExclusive SetExclusive GetLinkManager SetText GetText Serialize
CreateDocument AddElement RemoveChild PolicyExists);
......@@ -275,7 +275,7 @@ sub IsTunnel($)
my @types = FindNodes("n:link_type", $link)->get_nodelist();
foreach my $current (@types) {
my $name = GetText("name", $current);
if ($name eq "gre-tunnel") {
if (defined($name) && $name eq "gre-tunnel") {
$result = 1;
last;
}
......@@ -300,13 +300,51 @@ sub SetExpires($$)
}
}
sub GetBandwidth($)
{
my ($link) = @_;
my $result = undef;
if (IsVersion0($link)) {
$result = GeniXML::GetText("bandwidth", $link);
} else {
my $prop = FindFirst("n:property", $link);
if (defined($prop)) {
$result = GeniXML::GetText("capacity", $prop);
}
}
return $result;
}
sub GetIp($$)
{
my ($ifaceref, $node) = @_;
my $result = undef;
if (IsVersion0($ifaceref)) {
$result = GetText("tunnel_ip", $ifaceref);
} else {
my $id = GetInterfaceId($ifaceref);
my @ifaces = FindNodes("n:interface", $node)->get_nodelist();
foreach my $iface (@ifaces) {
my $testid = GetInterfaceId($iface);
if (defined($id) && defined($testid) && $testid eq $id) {
my $ip = FindFirst("n:ip", $iface);
if (defined($ip)) {
$result = GetText("address", $ip);
}
last;
}
}
}
return $result;
}
# Returns the uuid or urn of an RSpec node or undef if it is not a node.
sub GetNodeId($)
{
my ($node) = @_;
my $result = GetFirstText($node, "component_urn", "component_id",
"component_uuid", "uuid");
if ($result eq "") {
if (defined($result) && $result eq "") {
$result = undef;
}
return $result;
......@@ -343,7 +381,7 @@ sub GetManagerId($)
my $result = GetFirstText($node, "component_manager_urn",
"component_manager_id",
"component_manager_uuid");
if ($result eq "") {
if (defined($result) && $result eq "") {
$result = undef;
}
return $result;
......@@ -382,7 +420,9 @@ sub GetStartupCommand($)
$result = GetText("startup_command", $node);
} else {
my $execute = FindFirst("n:services/n:execute", $node);
$result = GetText("command", $execute);
if (defined($execute)) {
$result = GetText("command", $execute);
}
}
return $result;
}
......@@ -409,7 +449,7 @@ sub GetTarball($)
$result .= $install . " " . $url;
}
}
if ($result eq "") {
if (defined($result) && $result eq "") {
$result = undef;
}
}
......@@ -426,12 +466,18 @@ sub GetVirtualizationType($)
return $result;
}
sub SetVirtualizationType($$)
sub SetVirtualizationSubtype($$)
{
my ($node, $arg) = @_;
my $result = 1;
if (IsVersion0($node)) {
$result = SetText("virtualization_type", $node, $arg);
$result = SetText("virtualization_subtype", $node, $arg);
} else {
my $type = FindFirst("n:sliver_type", $node);
if (! defined($type)) {
$type = AddElement("sliver_type", $node);
}
SetText("name", $type, $arg);
}
return $result;
}
......@@ -444,7 +490,9 @@ sub GetVirtualizationSubtype($)
$result = GetText("virtualization_subtype", $node);
} else {
my $type = FindFirst("n:sliver_type", $node);
$result = GetText("name", $type);
if (defined($type)) {
$result = GetText("name", $type);
}
}
return $result;
}
......
......@@ -14,7 +14,9 @@ NodeContents &=
attribute sliver_id { text }
LinkContents &=
attribute sliver_id { text }
attribute sliver_id { text } &
# vlan tag number used for stitching
attribute vlantag { text }
InterfaceContents &=
attribute mac_address { text } ?
......
......@@ -665,8 +665,6 @@ sub tmccgetconfig()
#
package libtmcc::blob;
my $SERVERFILE = "$VARDIR/boot/bossip";
# tmcc.c jumps through hoops to get it... do we have to, too?
my $NICKNAMEFILE = "$BOOTDIR/nickname";
my $KEYHASHFILE = "$BOOTDIR/keyhash";
......@@ -838,10 +836,7 @@ sub getblob($$;\@$) {
$struct{'key'} = $key;
close KEYHASH;
open BOSSIP, $SERVERFILE or die "$SERVERFILE: $!";
<BOSSIP> =~ /^(\d+\.\d+\.\d+\.\d++)$/;
$struct{'server'} = $1;
close BOSSIP;
(undef,$struct{'server'}) = libtmcc::tmccbossinfo();
if( $debug ) {
$, = " ";
......
......@@ -1399,7 +1399,7 @@ COMMAND_PROTOTYPE(domanifest)
MYSQL_RES *res = NULL;
MYSQL_ROW row;
char buf[2*MYBUFSIZE];
int nrows;
int nrows = 0;
int disable_type = 0, disable_osid = 0, disable_node = 0;
res = mydb_query("select opt_name,opt_value"
......@@ -1481,7 +1481,9 @@ COMMAND_PROTOTYPE(domanifest)
/* 23 */
" cstype.alt_blob_id,cstype.enable,cstype.enable_hooks,"
/* 26 */
" cstype.fatal,cstype.user_can_override"
" cstype.fatal,cstype.user_can_override,"
/* 28 */
" cs.hooks_only"
" from reserved as r"
" left join nodes as n on r.node_id=n.node_id"
" straight_join client_services as cs"
......@@ -1523,7 +1525,7 @@ COMMAND_PROTOTYPE(domanifest)
" or csnode.enable is not NULL"
" or csos.enable is not NULL"
" or cstype.enable is not NULL)",
28, reqp->exptidx, reqp->nodeid);
29, reqp->exptidx, reqp->nodeid);
if (!res) {
error("MANIFEST: %s: DB Error getting manifest info!\n",
reqp->nodeid);
......@@ -1540,12 +1542,15 @@ COMMAND_PROTOTYPE(domanifest)
char *blobid = NULL;
int admin_service_not_overrideable = 0;
int admin_idx = 0;
int hooks_only;
int disable_admin = 0;
row = mysql_fetch_row(res);
hooks_only = (strcmp(row[28],"1") == 0) ? 1 : 0;
/* figure out which service control entry to use! */
/* start by choosing the per-node or per-experiment stuff */
if (row[5] != NULL) {
if (row[5] != NULL && !hooks_only) {
enabled = row[5];
hooks_enabled = row[6];
fatal = row[7];
......@@ -1558,7 +1563,7 @@ COMMAND_PROTOTYPE(domanifest)
if (blobid == NULL)
blobid = row[4];
}
else if (row[9] != NULL) {
else if (row[9] != NULL && !hooks_only) {
enabled = row[10];
hooks_enabled = row[11];
fatal = row[12];
......@@ -1567,23 +1572,45 @@ COMMAND_PROTOTYPE(domanifest)
blobid = row[8];
}
if (row[17] != NULL && !disable_node) {
if (row[17] != NULL) {
admin_idx = 13;
if (strcmp(row[17],"0") == 0) {
admin_service_not_overrideable = 1;
}
if (disable_node)
disable_admin = 1;
}
else if (row[22] != NULL && !disable_osid) {
else if (row[22] != NULL) {
admin_idx = 18;
if (strcmp(row[22],"0") == 0) {
admin_service_not_overrideable = 1;
}
if (disable_osid)
disable_admin = 1;
}
else if (row[27] != NULL && !disable_type) {
admin_idx = 22;
else if (row[27] != NULL) {
admin_idx = 23;
if (strcmp(row[27],"0") == 0) {
admin_service_not_overrideable = 1;
}
if (disable_type)
disable_admin = 1;
}
/* If the user wants to ignore the admin setting, and
* the admin allows it to be overridden, AND the user
* didn't specify a control for this service... skip! */
if (disable_admin && !admin_service_not_overrideable
&& enabled == NULL) {
--nrows;
continue;
}
/* If the admin set hooks_only on a service, and didn't
* specify a service entry, bail! */
if (hooks_only && admin_idx == 0) {
--nrows;
continue;
}
/* If the admin seting can't be overridden, or if the
......
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