Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
86564e95
Commit
86564e95
authored
Jan 12, 2012
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow override of the default jail ip/mask to make it easier to bring
up a container using a routable IP.
parent
49a9940e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
6 deletions
+41
-6
db/Node.pm.in
db/Node.pm.in
+36
-6
tbsetup/libvtop_test.pm.in
tbsetup/libvtop_test.pm.in
+5
-0
No files found.
db/Node.pm.in
View file @
86564e95
#
!/usr/bin/perl -wT
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2005
-
201
1
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2005
-
201
2
University
of
Utah
and
the
Flux
Group
.
#
All
rights
reserved
.
#
package
Node
;
...
...
@@ -13,7 +13,8 @@ use vars qw(@ISA @EXPORT $AUTOLOAD @EXPORT_OK);
@
EXPORT
=
qw
();
#
Configure
variables
use
vars
qw
($
TB
$
BOSSNODE
$
WOL
$
OSSELECT
$
ISUTAH
$
CONTROL_NETMASK
$
TBOPS
);
use
vars
qw
($
TB
$
BOSSNODE
$
WOL
$
OSSELECT
$
ISUTAH
$
CONTROL_NETMASK
$
TBOPS
$
JAILIPMASK
);
$
TB
=
"@prefix@"
;
$
BOSSNODE
=
"@BOSSNODE@"
;
$
TBOPS
=
"@TBOPSEMAIL@"
;
...
...
@@ -23,6 +24,7 @@ $OSSELECT = "$TB/bin/os_select";
$
ISUTAH
=
@
TBMAINSITE
@;
#
Need
this
for
jail
ip
assignment
.
$
CONTROL_NETMASK
=
"@CONTROL_NETMASK@"
;
$
JAILIPMASK
=
"@JAILIPMASK@"
;
use
libdb
;
use
libtestbed
;
...
...
@@ -1897,6 +1899,7 @@ sub CreateVnodes($$$)
my ($class, $rptr, $options) = @_;
my @created = ();
my @tocreate = ();
my @vlist = ();
require Interface;
require NodeType;
...
...
@@ -2193,9 +2196,10 @@ sub CreateVnodes($$$)
"def_boot_osid" => $osid,
"update_accounts" => 1,
"jailflag" => $isjailed);
$nodesets{"jailip"} = $jailip
if ($isjailed && !$isremote);
if ($isjailed && !$isremote) {
$nodesets{"jailip"} = $jailip;
$nodesets{"jailipmask"} = $JAILIPMASK;
}
my $statement = "insert into nodes set ".
join(",", map("$_='
" . $nodesets{$_} . "
'", keys(%nodesets)));
...
...
@@ -3048,7 +3052,32 @@ sub GetJailIP($;$)
$pnet++;
$pnode2 -= $nodenumlimit;
}
return "${IPBASE1}.${pnet}.${pnode2}.${num}";
return ("${IPBASE1}.${pnet}.${pnode2}.${num}", $JAILIPMASK);
}
#
# Another variant of above, this one looks in the virt_node_attributes
# table of the vnode assigned to the pnode.
#
sub SetJailIPFromVnode($$$)
{
my ($self, $experiment, $vnode_id) = @_;
my ($jailip, $jailipmask);
return -1
if ($experiment->GetVirtNodeAttribute($vnode_id, \$jailip) < 0 ||
$experiment->GetVirtNodeAttribute($vnode_id, \$jailipmask) < 0);
if (defined($jailip)) {
if (!defined($jailipmask)) {
print STDERR
"*** $vnode_id has a jailip attribute but no jailipmask.\n";
return -1;
}
return $self->Update({"jailip" => $jailip,
"jailipmask" => $jailipmask});
}
return 0;
}
#
...
...
@@ -3136,5 +3165,6 @@ sub CheckPreReserve($$)
return $result;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
tbsetup/libvtop_test.pm.in
View file @
86564e95
...
...
@@ -5117,6 +5117,11 @@ sub AllocVirtNodes($)
#
$
pnode
->
ModifyReservation
({
"vname"
=>
$
virtual
})
==
0
or
return
-
1
if
(
!$self->impotent());
#
#
Not
sure
where
to
put
this
.
#
$
pnode
->
SetJailIPFromVnode
($
experiment
,
$
virtual
);
}
#
Since
we
have
some
extra
physical
vnodes
reserved
on
this
pnode
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment