Commit dae40834 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add generators slot to virt_trafgens table, defaults to "TG" for now.

This is for Shashi and NSE support. TMCD returns this new field in
the trafgens command, and libsetup.pm has a new test; do nothing if
the generator does not equal TG. This is a temporary change; finalize
when Shashi is done.
parent 775ddd4f
......@@ -235,6 +235,28 @@ sub domounts()
}
}
#
# The MFS version does not support (or need) this DB stuff. Just mount
# them up.
#
if (-e "$SETUPDIR/ismfs") {
while (($remote, $local) = each %mounts) {
if (! -e $local) {
if (! os_mkdir($local, 0770)) {
warn "*** WARNING: Could not make directory $local: $!\n";
next;
}
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
next;
}
}
return 0;
}
dbmopen(%MDB, TMMOUNTDB, 0660);
#
......@@ -734,9 +756,9 @@ sub dotrafficconfig()
$TM = OPENTMCC(TMCCCMD_TRAFFIC);
$pat = q(MYNAME=([-\w.]+) MYPORT=(\d+) );
$pat = q(MYNAME=([-\w.]+) MYPORT=(\d+) );
$pat .= q(PEERNAME=([-\w.]+) PEERPORT=(\d+) );
$pat .= q(PROTO=(\w+) ROLE=(\w+));
$pat .= q(PROTO=(\w+) ROLE=(\w+) GENERATOR=(\w+));
while (<$TM>) {
if ($_ =~ /$pat/) {
......@@ -752,8 +774,15 @@ sub dotrafficconfig()
my $peerport = $4;
my $proto = $5;
my $role = $6;
my $generator = $7;
my $target;
# Skip if not specified as a TG generator. At some point
# work in Shashi's NSE work.
if ($generator ne "TG") {
next;
}
if ($role eq "sink") {
$target = "$ownaddr.$ownport";
}
......
......@@ -235,6 +235,28 @@ sub domounts()
}
}
#
# The MFS version does not support (or need) this DB stuff. Just mount
# them up.
#
if (-e "$SETUPDIR/ismfs") {
while (($remote, $local) = each %mounts) {
if (! -e $local) {
if (! os_mkdir($local, 0770)) {
warn "*** WARNING: Could not make directory $local: $!\n";
next;
}
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
next;
}
}
return 0;
}
dbmopen(%MDB, TMMOUNTDB, 0660);
#
......@@ -734,9 +756,9 @@ sub dotrafficconfig()
$TM = OPENTMCC(TMCCCMD_TRAFFIC);
$pat = q(MYNAME=([-\w.]+) MYPORT=(\d+) );
$pat = q(MYNAME=([-\w.]+) MYPORT=(\d+) );
$pat .= q(PEERNAME=([-\w.]+) PEERPORT=(\d+) );
$pat .= q(PROTO=(\w+) ROLE=(\w+));
$pat .= q(PROTO=(\w+) ROLE=(\w+) GENERATOR=(\w+));
while (<$TM>) {
if ($_ =~ /$pat/) {
......@@ -752,8 +774,15 @@ sub dotrafficconfig()
my $peerport = $4;
my $proto = $5;
my $role = $6;
my $generator = $7;
my $target;
# Skip if not specified as a TG generator. At some point
# work in Shashi's NSE work.
if ($generator ne "TG") {
next;
}
if ($role eq "sink") {
$target = "$ownaddr.$ownport";
}
......
......@@ -2130,12 +2130,12 @@ dotrafgens(int sock, struct in_addr ipaddr, char *rdata, int tcp)
}
res = mydb_query("select vi.vname,role,proto,"
"vnode,port,target_vnode,target_port "
"vnode,port,target_vnode,target_port,generator "
"from virt_trafgens as vi "
"left join reserved as r on r.vname=vi.vnode "
"where r.node_id='%s' and "
" vi.pid='%s' and vi.eid='%s'",
7, nodeid, pid, eid);
8, nodeid, pid, eid);
if (!res) {
syslog(LOG_ERR, "TRAFGENS: %s: DB Error getting virt_trafgens",
......@@ -2152,9 +2152,9 @@ dotrafgens(int sock, struct in_addr ipaddr, char *rdata, int tcp)
sprintf(buf, "TRAFGEN=%s MYNAME=%s-0 MYPORT=%s "
"PEERNAME=%s-0 PEERPORT=%s "
"PROTO=%s ROLE=%s\n",
"PROTO=%s ROLE=%s GENERATOR=%s\n",
row[0], row[3], row[4], row[5], row[6],
row[2], row[1]);
row[2], row[1], row[7]);
client_writeback(sock, buf, strlen(buf), tcp);
......
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