summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhuri Kumari <madhuri.rai07@gmail.com>2017-08-31 09:15:41 +0000
committerMadhuri Kumari <madhuri.rai07@gmail.com>2018-01-09 10:16:22 +0530
commitf4b1a02959140a65e069c10b45109fa80e4c68d1 (patch)
tree057cc880938e5a6394e613ff4bf6da32a1583cb7
parent20047d232e89e323bce61139ca5191b215f6ec4f (diff)
Add support for Clear Container Runtime
This patch installs Clear Container[1] as one of the runtime for docker. [1] https://clearlinux.org/features/intel%C2%AE-clear-containers Change-Id: Ibacebf84ce1ff68a779589c7c9e17916503cafab
Notes
Notes (review): Code-Review+2: Hongbin Lu <hongbin034@gmail.com> Code-Review+2: Sam Yaple <sam+git@yaple.net> Workflow+1: Sam Yaple <sam+git@yaple.net> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 09 Jan 2018 16:00:21 +0000 Reviewed-on: https://review.openstack.org/499534 Project: openstack/devstack-plugin-container Branch: refs/heads/master
-rw-r--r--README.rst12
-rw-r--r--contrib/post_test_hook.sh6
-rw-r--r--devstack/lib/docker45
-rw-r--r--devstack/settings1
4 files changed, 54 insertions, 10 deletions
diff --git a/README.rst b/README.rst
index ebed304..fe36497 100644
--- a/README.rst
+++ b/README.rst
@@ -1,13 +1,13 @@
1================= 1================
2 Container Plugin 2Container Plugin
3================= 3================
4 4
5This plugin enables installation of container engine on Devstack. The default 5This plugin enables installation of container engine on Devstack. The default
6container engine is Docker (currently this plugin supports only Docker!). 6container engine is Docker (currently this plugin supports only Docker!).
7 7
8====================== 8====================
9 Enabling in Devstack 9Enabling in Devstack
10====================== 10====================
11 11
121. Download DevStack 121. Download DevStack
13-------------------- 13--------------------
diff --git a/contrib/post_test_hook.sh b/contrib/post_test_hook.sh
index 3317915..a613752 100644
--- a/contrib/post_test_hook.sh
+++ b/contrib/post_test_hook.sh
@@ -38,11 +38,11 @@ echo_summary "Devstack-plugin-container's post_test_hook.sh was called..."
38# Verify that Docker is installed correctly by running the hello-world image 38# Verify that Docker is installed correctly by running the hello-world image
39sudo -H -u stack docker run hello-world 39sudo -H -u stack docker run hello-world
40 40
41EXIT_CODE=$?
42
41# Copy over docker systemd unit journals. 43# Copy over docker systemd unit journals.
42mkdir -p $WORKSPACE/logs 44mkdir -p $WORKSPACE/logs
43sudo journalctl -o short-precise --unit docker | sudo tee $WORKSPACE/logs/docker.txt > /dev/null 45sudo journalctl -o short-precise --unit docker | sudo tee $WORKSPACE/logs/docker.txt > /dev/null
44 46
45EXIT_CODE=$?
46
47$XTRACE 47$XTRACE
48exit $EXIT_CODE \ No newline at end of file 48exit $EXIT_CODE
diff --git a/devstack/lib/docker b/devstack/lib/docker
index 66a8fc3..9b035f1 100644
--- a/devstack/lib/docker
+++ b/devstack/lib/docker
@@ -26,7 +26,7 @@ DOCKER_ENGINE_PORT=${DOCKER_ENGINE_PORT:-2375}
26DOCKER_CLUSTER_STORE=${DOCKER_CLUSTER_STORE:-} 26DOCKER_CLUSTER_STORE=${DOCKER_CLUSTER_STORE:-}
27DOCKER_GROUP=${DOCKER_GROUP:-$STACK_USER} 27DOCKER_GROUP=${DOCKER_GROUP:-$STACK_USER}
28DOCKER_CGROUP_DRIVER=${DOCKER_CGROUP_DRIVER:-} 28DOCKER_CGROUP_DRIVER=${DOCKER_CGROUP_DRIVER:-}
29 29ENABLE_CLEAR_CONTAINER=$(trueorfalse False ENABLE_CLEAR_CONTAINER)
30 30
31# Functions 31# Functions
32# --------- 32# ---------
@@ -73,6 +73,19 @@ function install_docker {
73 fi 73 fi
74 yum_install docker-ce 74 yum_install docker-ce
75 fi 75 fi
76 if [[ "$ENABLE_CLEAR_CONTAINER" == "True" ]]; then
77 # Clear Container can't run inside VM, so check whether virtualization
78 # is enabled or not
79 if sudo grep -E 'svm|vmx' /proc/cpuinfo &> /dev/null; then
80 if is_ubuntu; then
81 install_clear_container_ubuntu
82 elif is_fedora; then
83 install_clear_container_fedora
84 fi
85 else
86 (>&2 echo "WARNING: Clear Container needs the CPU extensions svm or vmx which is not enabled. Skipping Clear Container installation.")
87 fi
88 fi
76} 89}
77 90
78function configure_docker { 91function configure_docker {
@@ -83,6 +96,16 @@ function configure_docker {
83 if [[ -n "$DOCKER_CLUSTER_STORE" ]]; then 96 if [[ -n "$DOCKER_CLUSTER_STORE" ]]; then
84 cluster_store_opts+="\"cluster-store\": \"$DOCKER_CLUSTER_STORE\"," 97 cluster_store_opts+="\"cluster-store\": \"$DOCKER_CLUSTER_STORE\","
85 fi 98 fi
99 local runtime_opts=""
100 if [[ "$ENABLE_CLEAR_CONTAINER" == "True" ]]; then
101 if sudo grep -E 'svm|vmx' /proc/cpuinfo &> /dev/null; then
102 runtime_opts+="\"runtimes\": {
103 \"cor\": {
104 \"path\": \"/usr/bin/cc-oci-runtime\"
105 }
106 },"
107 fi
108 fi
86 local docker_config_file=/etc/docker/daemon.json 109 local docker_config_file=/etc/docker/daemon.json
87 local debug 110 local debug
88 if [[ "$ENABLE_DEBUG_LOG_LEVEL" == "True" ]]; then 111 if [[ "$ENABLE_DEBUG_LOG_LEVEL" == "True" ]]; then
@@ -94,6 +117,7 @@ function configure_docker {
94 cat <<EOF | sudo tee $docker_config_file >/dev/null 117 cat <<EOF | sudo tee $docker_config_file >/dev/null
95{ 118{
96 $cluster_store_opts 119 $cluster_store_opts
120 $runtime_opts
97 "debug": ${debug}, 121 "debug": ${debug},
98 "group": "$DOCKER_GROUP", 122 "group": "$DOCKER_GROUP",
99EOF 123EOF
@@ -111,6 +135,7 @@ EOF
111 ] 135 ]
112} 136}
113EOF 137EOF
138
114 # NOTE(hongbin): We override ExecStart to workaround issue 22339. 139 # NOTE(hongbin): We override ExecStart to workaround issue 22339.
115 # https://github.com/docker/docker/issues/22339 140 # https://github.com/docker/docker/issues/22339
116 local docker_drop_in_file=/etc/systemd/system/docker.service.d/docker.conf 141 local docker_drop_in_file=/etc/systemd/system/docker.service.d/docker.conf
@@ -129,5 +154,23 @@ function stop_docker {
129 sudo systemctl stop docker.service || true 154 sudo systemctl stop docker.service || true
130} 155}
131 156
157function install_clear_container_ubuntu {
158 sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/clearlinux:/preview:/clear-containers-2.1/xUbuntu_$(lsb_release -rs)/ /' >> /etc/apt/sources.list.d/cc-oci-runtime.list"
159 curl -fsSL http://download.opensuse.org/repositories/home:/clearlinux:/preview:/clear-containers-2.1/xUbuntu_$(lsb_release -rs)/Release.key | sudo apt-key add -
160 REPOS_UPDATED=False apt_get_update
161 apt_get install cc-oci-runtime
162}
163
164function install_clear_container_fedora {
165 source /etc/os-release
166 local lsb_dist=${os_VENDOR,,}
167 if [[ "$lsb_dist" = "fedora" ]]; then
168 sudo -E dnf config-manager \
169 --add-repo \
170 http://download.opensuse.org/repositories/home:clearlinux:preview:clear-containers-2.1/Fedora\_$VERSION_ID/home:clearlinux:preview:clear-containers-2.1.repo
171 fi
172 yum_install cc-oci-runtime linux-container
173}
174
132# Restore xtrace 175# Restore xtrace
133$_XTRACE_DOCKER 176$_XTRACE_DOCKER
diff --git a/devstack/settings b/devstack/settings
index 4c9dacc..da3271d 100644
--- a/devstack/settings
+++ b/devstack/settings
@@ -1,6 +1,7 @@
1# Devstack settings 1# Devstack settings
2 2
3CONTAINER_ENGINE=${CONTAINER_ENGINE:-docker} 3CONTAINER_ENGINE=${CONTAINER_ENGINE:-docker}
4ENABLE_CLEAR_CONTAINER=${ENABLE_CLEAR_CONTAINER:-true}
4 5
5# Enable container services 6# Enable container services
6enable_service container 7enable_service container