Commit 470a81e5 authored by Mike Hibler's avatar Mike Hibler

Modify NOVIRTNFSMOUNTS to allow mounts on vnodes with routable IPs.

This is different than the traditional behavior of this defs- variable.
Previously it caused tmcd to not expose any NFS mounts to shared-host vnodes.
We relax that now to allow exposing such mounts to vnodes with routable IP
addresses.

The rationale for this change is simply that the original option was only
intended to prevent exporting mounts to hosts that could not reach the FS
node anyway due to their unroutable cnet IPs.
parent 7ba4cfd0
......@@ -242,13 +242,17 @@ $nodes_result =
" e.nonfsmounts as enonfs,n.nonfsmounts as nnonfs,".
" i.IP,u.admin,r.sharing_mode,r.erole,nt.isvirtnode, ".
" e.nfsmounts as e_nfsmounts, ".
" n.nfsmounts as n_nfsmounts ".
" n.nfsmounts as n_nfsmounts, ".
" va.attrvalue as routable_ip ".
"from reserved as r ".
"left join experiments as e on r.pid=e.pid and r.eid=e.eid ".
"left join nodes as n on r.node_id=n.node_id ".
"left join node_types as nt on nt.type=n.type ".
"left join interfaces as i on r.node_id=i.node_id ".
"left join users as u on e.swapper_idx=u.uid_idx ".
"left join virt_node_attributes as va on ".
" va.pid=r.pid and va.eid=r.eid and va.vname=r.vname ".
" and va.attrkey='routable_control_ip' ".
" where i.IP!='NULL' and ".
" i.role='" . TBDB_IFACEROLE_CONTROL() . "' ".
" and (n.role='testnode' or n.role='virtnode')".
......@@ -353,6 +357,8 @@ while ($row = $nodes_result->fetchrow_hashref) {
my $nnonfs = $row->{'nnonfs'};
my $enfs = $row->{'e_nfsmounts'};
my $nnfs = $row->{'n_nfsmounts'};
my $routable= ((defined($row->{'routable_ip'}) &&
$row->{'routable_ip'} eq "true") ? 1 : 0);
my %fslist = ();
my @dirlist = ();
my @smbshares = ();
......@@ -375,9 +381,9 @@ while ($row = $nodes_result->fetchrow_hashref) {
next
if ($isvirt && !$shared);
# Skip shared virtnode nodes too, if NFS disabled for them.
# Skip shared virtnode nodes too, if NFS disabled and non-routable IP
next
if ($NOVNODENFS && $isvirt && $shared);
if ($NOVNODENFS && $isvirt && $shared && !$routable);
if ($lastpid eq $pid && $lastgid eq $gid && $lasterole eq $erole &&
(!$ISOLATEADMIN || $lastadmin eq $admin)) {
......
......@@ -241,6 +241,7 @@ typedef struct {
int allocated;
int jailflag;
int isvnode;
int isroutable_vnode; /* only valid if isvnode==1 */
int asvnode;
int issubnode;
int islocal;
......@@ -5002,7 +5003,8 @@ COMMAND_PROTOTYPE(domounts)
client_writeback(sock, buf, strlen(buf), tcp);
}
#ifdef NOVIRTNFSMOUNTS
if (reqp->sharing_mode[0] && reqp->isvnode) {
if (reqp->sharing_mode[0] && reqp->isvnode &&
!reqp->isroutable_vnode) {
return 0;
}
#endif
......@@ -7454,7 +7456,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" n.nonfsmounts,e.nonfsmounts AS enonfs, "
" r.erole, n.taint_states, "
" n.nfsmounts,e.nfsmounts AS enfsmounts, "
" p.nonlocal_id "
" p.nonlocal_id,NULL "
"FROM nodes AS n "
"LEFT JOIN reserved AS r ON "
" r.node_id=n.node_id "
......@@ -7485,7 +7487,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" (SELECT node_id FROM widearea_nodeinfo "
" WHERE privkey='%s') "
" AND notmcdinfo_types.attrvalue IS NULL",
42, nodekey);
43, nodekey);
}
else if (reqp->isvnode) {
char clause[BUFSIZ];
......@@ -7524,7 +7526,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" nv.nonfsmounts,e.nonfsmounts AS enonfs, "
" r.erole, nv.taint_states, "
" nv.nfsmounts,e.nfsmounts AS enfsmounts, "
" p.nonlocal_id "
" p.nonlocal_id,va.attrvalue "
"from nodes as nv "
"left join nodes as np on "
" np.node_id=nv.phys_nodeid "
......@@ -7546,8 +7548,12 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" nk.node_id=nv.node_id "
"left join users as u on "
" u.uid_idx=e.swapper_idx "
"left join virt_node_attributes as va on "
" va.pid=r.pid and va.eid=r.eid and "
" va.vname=r.vname and "
" va.attrkey='routable_control_ip' "
"where nv.node_id='%s' and (%s)",
42, reqp->vnodeid, clause);
43, reqp->vnodeid, clause);
}
else {
char clause[BUFSIZ];
......@@ -7579,7 +7585,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" n.nonfsmounts,e.nonfsmounts AS enonfs, "
" r.erole, n.taint_states, "
" n.nfsmounts,e.nfsmounts AS enfsmounts, "
" p.nonlocal_id "
" p.nonlocal_id,NULL "
"from interfaces as i "
"left join nodes as n on n.node_id=i.node_id "
"left join reserved as r on "
......@@ -7609,7 +7615,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" on n.type=dedicated_wa_types.type "
"where (%s) "
" and notmcdinfo_types.attrvalue is NULL",
42, clause);
43, clause);
}
if (!res) {
......@@ -7766,6 +7772,12 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
}
}
/* Do we have a routable IP */
if (reqp->isvnode && row[42] && strcmp(row[42], "true") == 0)
reqp->isroutable_vnode = 1;
else
reqp->isroutable_vnode = 0;
/* If a vnode, copy into the nodeid. Eventually split this properly */
strcpy(reqp->pnodeid, reqp->nodeid);
if (reqp->isvnode) {
......
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