From 0a50cb8889f245bc89b49fbb2dacb9c02ded5f88 Mon Sep 17 00:00:00 2001
From: "Michal (inc0) Jastrzebski" <inc007@gmail.com>
Date: Tue, 6 Sep 2016 15:52:24 +0000
Subject: [PATCH] Change ceph version to Jewel

This patch changes version of ceph from hammer to jewel. Also removed
versionlock as it seems we don't use it in ubuntu, and actually might be
risky if we miss security patch on ceph.

Change-Id: Ib8f88c2f914a4b635e59a509fa0194605eb73165
Implements: blueprint upgrade-ceph-to-jewel
---
 ansible/roles/ceph/templates/ceph.conf.j2          |  6 ++++++
 doc/ceph-guide.rst                                 |  4 ++--
 docker/base/Dockerfile.j2                          | 14 +++-----------
 docker/base/sources.list.debian                    |  2 +-
 docker/base/sources.list.ubuntu                    |  2 +-
 docker/base/versionlock.list                       | 12 ------------
 docker/ceph/ceph-base/Dockerfile.j2                |  4 ----
 .../notes/ceph-jewel-33caab815946cb4c.yaml         |  5 +++++
 tools/setup_gate.sh                                |  1 -
 9 files changed, 18 insertions(+), 32 deletions(-)
 delete mode 100644 docker/base/versionlock.list
 create mode 100644 releasenotes/notes/ceph-jewel-33caab815946cb4c.yaml

diff --git a/ansible/roles/ceph/templates/ceph.conf.j2 b/ansible/roles/ceph/templates/ceph.conf.j2
index 70907affe6..261c594cd0 100644
--- a/ansible/roles/ceph/templates/ceph.conf.j2
+++ b/ansible/roles/ceph/templates/ceph.conf.j2
@@ -14,6 +14,12 @@ auth cluster required = cephx
 auth service required = cephx
 auth client required = cephx
 
+# NOTE(inc0): This line will mean that if ceph was upgraded, it will run as root
+#             until contents of /var/lib/ceph are chowned to ceph user.
+#             This change was introduced in Jewel version and we should include
+#             chown operation in upgrade procedure. https://bugs.launchpad.net/kolla/+bug/1620702
+setuser match path = /var/lib/ceph/$type/$cluster-$id
+
 [mon]
 # NOTE(SamYaple): The monitor files have been known to grow very large. The
 #                 only fix for that is to compact the files.
diff --git a/doc/ceph-guide.rst b/doc/ceph-guide.rst
index 61db35160d..48dbd20597 100644
--- a/doc/ceph-guide.rst
+++ b/doc/ceph-guide.rst
@@ -137,7 +137,7 @@ Finally deploy the Ceph-enabled OpenStack:
 Using a Cache Tier
 ==================
 
-An optional `cache tier <http://docs.ceph.com/docs/hammer/rados/operations/cache-tiering/>`_
+An optional `cache tier <http://docs.ceph.com/docs/jewel/rados/operations/cache-tiering/>`_
 can be deployed by formatting at least one cache device and enabling cache.
 tiering in the globals.yml configuration file.
 
@@ -167,7 +167,7 @@ After this run the playbooks as you normally would. For example:
 Setting up an Erasure Coded Pool
 ================================
 
-`Erasure code <http://docs.ceph.com/docs/hammer/rados/operations/erasure-code/>`_
+`Erasure code <http://docs.ceph.com/docs/jewel/rados/operations/erasure-code/>`_
 is the new big thing from Ceph. Kolla has the ability to setup your Ceph pools
 as erasure coded pools. Due to technical limitations with Ceph, using erasure
 coded pools as OpenStack uses them requires a cache tier. Additionally, you
diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index 1afeb1b474..ed2a4c5e0c 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -85,7 +85,7 @@ RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 {% set base_centos_yum_repo_packages = [
     'epel-release ',
     'yum-plugin-priorities',
-    'centos-release-ceph-hammer',
+    'centos-release-ceph-jewel',
     'centos-release-qemu-ev'
 ] %}
 
@@ -122,7 +122,7 @@ RUN yum -y install \
         http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/epel-release-7-5.noarch.rpm \
     && rpm -Uvh --nodeps \
         http://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-mitaka/centos-release-openstack-mitaka-1-3.el7.noarch.rpm \
-        http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-ceph-hammer-1.0-5.el7.centos.noarch.rpm \
+        http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-ceph-jewel-1.0-1.el7.centos.noarch.rpm \
         http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-qemu-ev-1.0-1.el7.noarch.rpm \
         http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-virt-common-1-1.el7.centos.noarch.rpm \
         http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-storage-common-1-2.el7.centos.noarch.rpm \
@@ -156,15 +156,7 @@ RUN yum -y install \
 
 {# We are back to the basic if conditional here which is:
     if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] #}
-
-{% block base_redhat_binary_versionlock %}
-RUN yum -y update \
-    && yum -y install \
-           yum-plugin-versionlock \
-    && yum clean all
-COPY versionlock.list /etc/yum/pluginconf.d/
-{% endblock %}
-
+{% block base_redhat_binary_versionlock %}{% endblock %}
     {% if install_type == 'binary' %}
 {% set base_centos_binary_packages = [
         'sudo',
diff --git a/docker/base/sources.list.debian b/docker/base/sources.list.debian
index edcf5214a7..fc14f672ff 100644
--- a/docker/base/sources.list.debian
+++ b/docker/base/sources.list.debian
@@ -14,7 +14,7 @@ deb http://security.debian.org jessie/updates main
 deb http://httpredir.debian.org/debian stretch main
 
 # Ceph repo
-deb http://download.ceph.com/debian-hammer/ jessie main
+deb http://download.ceph.com/debian-jewel/ jessie main
 
 # Maria DB repo
 deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/debian jessie main
diff --git a/docker/base/sources.list.ubuntu b/docker/base/sources.list.ubuntu
index b000673c5b..510293712f 100644
--- a/docker/base/sources.list.ubuntu
+++ b/docker/base/sources.list.ubuntu
@@ -17,7 +17,7 @@ deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu xenial main
 deb http://repo.percona.com/apt xenial main
 
 # Ceph repo
-deb http://download.ceph.com/debian-hammer/ xenial main
+deb http://download.ceph.com/debian-jewel/ xenial main
 
 # Elastic repo
 deb http://packages.elastic.co/elasticsearch/2.x/debian stable main
diff --git a/docker/base/versionlock.list b/docker/base/versionlock.list
deleted file mode 100644
index de2dd4cad5..0000000000
--- a/docker/base/versionlock.list
+++ /dev/null
@@ -1,12 +0,0 @@
-1:ceph-0.94.5-1.el7.*
-1:ceph-common-0.94.5-1.el7.*
-1:ceph-debuginfo-0.94.5-0.el7.*
-1:ceph-devel-compat-0.94.5-1.el7.*
-1:ceph-libs-compat-0.94.5-1.el7.*
-1:ceph-radosgw-0.94.5-1.el7.*
-1:librados2-0.94.5-1.el7.*
-1:libcephfs1-0.94.5-1.el7.*
-1:librbd1-0.94.5-1.el7.*
-1:python-cephfs-0.94.5-1.el7.*
-1:python-rados-0.94.5-1.el7.*
-1:python-rbd-0.94.5-1.el7.*
diff --git a/docker/ceph/ceph-base/Dockerfile.j2 b/docker/ceph/ceph-base/Dockerfile.j2
index ebd18d44d9..aec79be74e 100644
--- a/docker/ceph/ceph-base/Dockerfile.j2
+++ b/docker/ceph/ceph-base/Dockerfile.j2
@@ -24,10 +24,6 @@ MAINTAINER {{ maintainer }}
 COPY extend_start.sh /usr/local/bin/kolla_extend_start
 RUN chmod 755 /usr/local/bin/kolla_extend_start
 
-RUN useradd --user-group ceph \
-    && mkdir -p /home/ceph \
-    && chown -R ceph: /home/ceph
-
 {% block ceph_base_footer %}{% endblock %}
 {% block footer %}{% endblock %}
 {{ include_footer }}
diff --git a/releasenotes/notes/ceph-jewel-33caab815946cb4c.yaml b/releasenotes/notes/ceph-jewel-33caab815946cb4c.yaml
new file mode 100644
index 0000000000..8f1fab136f
--- /dev/null
+++ b/releasenotes/notes/ceph-jewel-33caab815946cb4c.yaml
@@ -0,0 +1,5 @@
+---
+features:
+  - Change Ceph version to Jewel
+upgrade:
+  - Version of Ceph has been changed from Hammer to Jewel
diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh
index daf3c76922..8afda31111 100755
--- a/tools/setup_gate.sh
+++ b/tools/setup_gate.sh
@@ -48,7 +48,6 @@ EOF
         # Optimize the repos to take advantage of the Infra provided mirrors for Ubuntu
         sed -i 's|^#apt_sources_list.*|apt_sources_list = /etc/kolla/sources.list|' /etc/kolla/kolla-build.conf
         sudo cp /etc/apt/sources.list /etc/kolla/sources.list
-        sudo cat /etc/apt/sources.list.available.d/ceph-deb-hammer.list | sudo tee -a /etc/kolla/sources.list
         sudo cat /etc/apt/sources.list.available.d/ubuntu-cloud-archive.list | sudo tee -a /etc/kolla/sources.list
         # Append non-infra provided repos to list
         cat << EOF | sudo tee -a /etc/kolla/sources.list