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-stable
Commits
c03050eb
Commit
c03050eb
authored
May 05, 2018
by
David Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let user choose Docker storage driver.
(Also, pass vhost node attributes to rootPreConfig.)
parent
23b73714
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
16 deletions
+47
-16
clientside/tmcc/common/mkvnode.pl
clientside/tmcc/common/mkvnode.pl
+3
-2
clientside/tmcc/linux/docker/libvnode_docker.pm
clientside/tmcc/linux/docker/libvnode_docker.pm
+42
-12
clientside/tmcc/linux/xen/libvnode_xen.pm
clientside/tmcc/linux/xen/libvnode_xen.pm
+2
-2
No files found.
clientside/tmcc/common/mkvnode.pl
View file @
c03050eb
#!/usr/bin/perl -w
#
# Copyright (c) 2009-201
7
University of Utah and the Flux Group.
# Copyright (c) 2009-201
8
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -232,7 +232,7 @@ foreach my $type (@nodetypes) {
# need to do this for each type encountered.
TBDebugTimeStampWithDate
("
starting
$type
rootPreConfig()
");
$libops
{
$type
}{'
rootPreConfig
'}
->
(
$BOSSIP
);
$libops
{
$type
}{'
rootPreConfig
'}
->
(
$BOSSIP
,
\
%attributes
);
TBDebugTimeStampWithDate
("
finished
$type
rootPreConfig()
");
}
if
(
$debug
)
{
...
...
@@ -309,6 +309,7 @@ my %vnconfig = ( "vnodeid" => $vnodeid,
"
environment
"
=>
undef
,
"
storageconfig
"
=>
undef
,
"
fwconfig
"
=>
undef
,
"
hostattributes
"
=>
\
%attributes
,
);
sub
VNCONFIG
($)
{
return
$vnconfig
{'
config
'}
->
{
$_
[
0
]};
}
...
...
clientside/tmcc/linux/docker/libvnode_docker.pm
View file @
c03050eb
...
...
@@ -158,12 +158,18 @@ my $USE_DOCKER_CE = 1;
#
my
$USE_LVM
=
1
;
#
# Which docker storage driver should we use; see rootPreConfig(). Note,
# if you change this, you should change USE_DOCKER_LVM to 0 if
# !devicemapper; 1 if devicemapper.
#
my
$DOCKER_STORAGE_DRIVER
=
'
overlay2
';
#
# Should we use the Docker devicemapper direct-lvm storage backend?
# This should remain set, so that it is used for shared hosts. User
# should be able to change to the default AUFS backend on dedicated
# hosts.
#
my
$USE_DOCKER_LVM
=
1
;
my
$USE_DOCKER_LVM
=
0
;
#
# Default NFS mounts to read-only for now so that nothing in the
# container can blow them away accidentally!
...
...
@@ -1275,9 +1281,9 @@ sub init($)
# Called on each vnode, but should only be executed once per boot.
# We use a file in /var/run (cleared on reboots) to ensure this.
#
sub
rootPreConfig
($)
sub
rootPreConfig
($
;
$
)
{
my
$bossip
=
shift
;
my
(
$bossip
,
$hostattributes
)
=
@_
;
my
(
$code
,
$content
,
$resp
);
#
...
...
@@ -1308,6 +1314,25 @@ sub rootPreConfig($)
TBDebugTimeStamp
("
Configuring root vhost context
");
#
# Check if we are using an alternate storage driver.
#
if
(
defined
(
$hostattributes
)
&&
exists
(
$hostattributes
->
{"
DOCKER_STORAGE_DRIVER
"}))
{
my
$driver
=
$hostattributes
->
{"
DOCKER_STORAGE_DRIVER
"};
if
(
$driver
eq
'
overlay2
'
||
$driver
eq
'
aufs
')
{
$DOCKER_STORAGE_DRIVER
=
$driver
;
$USE_DOCKER_LVM
=
0
;
}
elsif
(
$driver
eq
'
devicemapper
')
{
$DOCKER_STORAGE_DRIVER
=
$driver
;
$USE_DOCKER_LVM
=
1
;
}
else
{
warn
("
bogus storage driver
$driver
; ignoring!
\n
");
}
}
#
# Ensure we have the latest bridge/iface state!
#
...
...
@@ -1878,9 +1903,11 @@ sub rootPreConfig($)
mysystem
("
lvchange --metadataprofile
$VGNAME
-thinpool
"
.
"
$VGNAME
/thinpool
");
mysystem
("
lvs -o+seg_monitor
");
}
if
(
defined
(
$DOCKER_STORAGE_DRIVER
))
{
#
# Setup the Docker devicemapper direct-lvm storage backend.
# Setup the Docker storage backend.
# If devicemapper direct-lvm storage backend, like
# { "storage-driver": "devicemapper",
# "storage-opts": [
# "dm.thinpooldev=/dev/mapper/docker-thinpool",
...
...
@@ -1909,12 +1936,14 @@ sub rootPreConfig($)
# Write our config.
# Don't restart docker; that happens at the end of $USE_LVM.
$needdockerrestart
=
1
;
$json
->
{"
storage-driver
"}
=
"
devicemapper
";
$json
->
{"
storage-opts
"}
=
[
"
dm.thinpooldev=/dev/mapper/
${VGNAME}
-thinpool
",
"
dm.use_deferred_removal=true
",
"
dm.use_deferred_deletion=true
"
];
$json
->
{"
storage-driver
"}
=
"
$DOCKER_STORAGE_DRIVER
";
if
(
$DOCKER_STORAGE_DRIVER
eq
'
devicemapper
')
{
$json
->
{"
storage-opts
"}
=
[
"
dm.thinpooldev=/dev/mapper/
${VGNAME}
-thinpool
",
"
dm.use_deferred_removal=true
",
"
dm.use_deferred_deletion=true
"
];
}
TBDebugTimeStamp
("
Updating /etc/docker/daemon.json
");
...
...
@@ -1950,7 +1979,8 @@ sub rootPreConfig($)
TBScriptUnlock
();
return
-
1
;
}
mysystem2
("
mount -t aufs | grep /var/lib/docker/
");
my
$rca
=
mysystem2
("
mount -t aufs | grep /var/lib/docker/
");
my
$rco
=
mysystem2
("
mount -t overlay2 | grep /var/lib/docker/
");
if
(
$?
==
0
)
{
warn
("
filesystems still mounted in /var/lib/docker; aborting!
");
TBScriptUnlock
();
...
...
clientside/tmcc/linux/xen/libvnode_xen.pm
View file @
c03050eb
...
...
@@ -577,9 +577,9 @@ sub ImageLVName($)
# Called on each vnode, but should only be executed once per boot.
# We use a file in /var/run (cleared on reboots) to ensure this.
#
sub
rootPreConfig
($)
sub
rootPreConfig
($
;
$
)
{
my
$bossip
=
shift
;
my
(
$bossip
,
$hostattributes
)
=
@_
;
#
# Haven't been called yet, grab the lock and double check that someone
# didn't do it while we were waiting.
...
...
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