From 0bb30f1900528a2cdf25aa74048e9a4e27fd896d Mon Sep 17 00:00:00 2001 From: Irina Mihai Date: Tue, 19 Feb 2019 23:09:39 +0000 Subject: [PATCH] Nova chart: Add ephemeral pool creation Add new job to create the required ephemeral pool(s). Tests performed: - application apply - launch of instance without ephemeral storage - launch of instance with remote ephemeral storage - cold migration of instance with remote ephemeral storage Change-Id: Iac31bb5ae2dc32913addc8ab9b5182391515c0ea Story: 2005074 Task: 29648 Signed-off-by: Irina Mihai Depends-on: I9850663fc86c62ed759714f1297cfdaa8183183f --- .../openstack-helm/centos/build_srpm.data | 2 +- .../openstack-helm/centos/openstack-helm.spec | 2 + .../0012-Nova-chart-Add-ephemeral-pool.patch | 326 ++++++++++++++++++ 3 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 openstack/openstack-helm/files/0012-Nova-chart-Add-ephemeral-pool.patch diff --git a/openstack/openstack-helm/centos/build_srpm.data b/openstack/openstack-helm/centos/build_srpm.data index a00c0323..34c72c81 100644 --- a/openstack/openstack-helm/centos/build_srpm.data +++ b/openstack/openstack-helm/centos/build_srpm.data @@ -5,4 +5,4 @@ TAR="$TAR_NAME-$SHA.tar.gz" COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* " -TIS_PATCH_VER=12 +TIS_PATCH_VER=13 diff --git a/openstack/openstack-helm/centos/openstack-helm.spec b/openstack/openstack-helm/centos/openstack-helm.spec index 2f0856d4..d1ec407e 100644 --- a/openstack/openstack-helm/centos/openstack-helm.spec +++ b/openstack/openstack-helm/centos/openstack-helm.spec @@ -30,6 +30,7 @@ Patch09: 0008-Stein-Update-Cinder-to-include-resource_filters.json.patch Patch10: 0009-Stein-add-log_config_append-to-neutron-etc.patch Patch11: 0010-Stein-Nova-console-address-config-optionality.patch Patch12: 0011-Support-per-host-overrides-of-auto_bridge_add.patch +Patch13: 0012-Nova-chart-Add-ephemeral-pool.patch BuildRequires: helm BuildRequires: openstack-helm-infra @@ -52,6 +53,7 @@ Openstack Helm charts %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 %build # initialize helm and build the toolkit diff --git a/openstack/openstack-helm/files/0012-Nova-chart-Add-ephemeral-pool.patch b/openstack/openstack-helm/files/0012-Nova-chart-Add-ephemeral-pool.patch new file mode 100644 index 00000000..987f9788 --- /dev/null +++ b/openstack/openstack-helm/files/0012-Nova-chart-Add-ephemeral-pool.patch @@ -0,0 +1,326 @@ +From a69da80225eda187df707b7c1fc8ef1d2c1edb57 Mon Sep 17 00:00:00 2001 +From: Irina Mihai +Date: Fri, 15 Feb 2019 11:06:49 -0500 +Subject: [PATCH] Add support for ephemeral pool creation + +--- + nova/templates/bin/_nova-storage-init.sh.tpl | 73 +++++++++++++++ + nova/templates/configmap-bin.yaml | 2 + + nova/templates/job-storage-init.yaml | 154 ++++++++++++++++++++++++++++++++ + nova/values.yaml | 18 ++++ + 4 files changed, 247 insertions(+) + create mode 100644 nova/templates/bin/_nova-storage-init.sh.tpl + create mode 100644 nova/templates/job-storage-init.yaml + +diff --git a/nova/templates/bin/_nova-storage-init.sh.tpl b/nova/templates/bin/_nova-storage-init.sh.tpl +new file mode 100644 +index 0000000..571cce5 +--- /dev/null ++++ b/nova/templates/bin/_nova-storage-init.sh.tpl +@@ -0,0 +1,73 @@ ++#!/bin/bash ++ ++{{/* ++Copyright 2019 The Openstack-Helm Authors. ++ ++Licensed under the Apache License, Version 2.0 (the "License"); ++you may not use this file except in compliance with the License. ++You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++Unless required by applicable law or agreed to in writing, software ++distributed under the License is distributed on an "AS IS" BASIS, ++WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++See the License for the specific language governing permissions and ++limitations under the License. ++*/}} ++ ++set -x ++if [ "x$STORAGE_BACKEND" == "xrbd" ]; then ++ SECRET=$(mktemp --suffix .yaml) ++ KEYRING=$(mktemp --suffix .keyring) ++ function cleanup { ++ rm -f ${SECRET} ${KEYRING} ++ } ++ trap cleanup EXIT ++fi ++ ++set -ex ++if [ "x$STORAGE_BACKEND" == "xrbd" ]; then ++ ceph -s ++ function ensure_pool () { ++ ceph osd pool stats $1 || ceph osd pool create $1 $2 ++ local test_version=$(ceph tell osd.* version | egrep -c "mimic|luminous" | xargs echo) ++ if [[ ${test_version} -gt 0 ]]; then ++ ceph osd pool application enable $1 $3 ++ fi ++ size_protection=$(ceph osd pool get $1 nosizechange | cut -f2 -d: | tr -d '[:space:]') ++ ceph osd pool set $1 nosizechange 0 ++ ceph osd pool set $1 size ${RBD_POOL_REPLICATION} ++ ceph osd pool set $1 nosizechange ${size_protection} ++ ceph osd pool set $1 crush_rule "${RBD_POOL_CRUSH_RULE}" ++ } ++ ensure_pool ${RBD_POOL_NAME} ${RBD_POOL_CHUNK_SIZE} "nova-ephemeral" ++ ++ # TODO: Rework this part for the nova/glance/cinder charts to preserve this ++ # on the next chart rebase to latest if the ceph mimic rebase isn't complete. ++ if USERINFO=$(ceph auth get client.${RBD_POOL_USER}); then ++ KEYSTR=$(echo $USERINFO | sed 's/.*\( key = .*\) caps mon.*/\1/') ++ echo $KEYSTR > ${KEYRING} ++ else ++ #NOTE(Portdirect): Determine proper privs to assign keyring ++ ceph auth get-or-create client.${RBD_POOL_USER} \ ++ mon "allow *" \ ++ osd "allow *" \ ++ mgr "allow *" \ ++ -o ${KEYRING} ++ fi ++ ++ ENCODED_KEYRING=$(sed -n 's/^[[:blank:]]*key[[:blank:]]\+=[[:blank:]]\(.*\)/\1/p' ${KEYRING} | base64 -w0) ++ cat > ${SECRET} <