Merge "libvirtd pod is not starting when Ceph is enabled"

This commit is contained in:
Jenkins 2017-06-09 21:47:13 +00:00 committed by Gerrit Code Review
commit d0f61affce
4 changed files with 57 additions and 19 deletions

View File

@ -0,0 +1,41 @@
#!/bin/bash
# Copyright 2017 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 -ex
# Wait for the libvirtd is up
TIMEOUT=60
while [[ ! -f /var/run/libvirtd.pid ]]; do
if [[ ${TIMEOUT} -gt 0 ]]; then
let TIMEOUT-=1
sleep 1
else
exit 1
fi
done
cat > /tmp/secret.xml <<EOF
<secret ephemeral='no' private='no'>
<uuid>{{ .Values.ceph.secret_uuid }}</uuid>
<usage type='ceph'>
<name>client.{{ .Values.ceph.cinder_user }} secret</name>
</usage>
</secret>
EOF
virsh secret-define --file /tmp/secret.xml
virsh secret-set-value --secret {{ .Values.ceph.secret_uuid }} --base64 {{ .Values.ceph.cinder_keyring }}
rm /tmp/secret.xml

View File

@ -28,23 +28,4 @@ if [[ -c /dev/kvm ]]; then
chown root:kvm /dev/kvm chown root:kvm /dev/kvm
fi fi
sleep 30
{{- if .Values.ceph.enabled }}
cat > /tmp/secret.xml <<EOF
<secret ephemeral='no' private='no'>
<uuid>{{ .Values.ceph.secret_uuid }}</uuid>
<usage type='ceph'>
<name>client.{{ .Values.ceph.cinder_user }} secret</name>
</usage>
</secret>
EOF
virsh secret-define --file /tmp/secret.xml
virsh secret-set-value --secret {{ .Values.ceph.secret_uuid }} --base64 {{ .Values.ceph.cinder_keyring }}
rm /tmp/secret.xml
{{- end }}
exec libvirtd -v --listen exec libvirtd -v --listen

View File

@ -29,6 +29,10 @@ data:
{{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }} {{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }}
libvirt.sh: | libvirt.sh: |
{{ tuple "bin/_libvirt.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_libvirt.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- if .Values.ceph.enabled }}
ceph-secret-define.sh: |
{{ tuple "bin/_ceph-secret-define.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
{{- end }}
bootstrap.sh: | bootstrap.sh: |
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
nova-api.sh: | nova-api.sh: |

View File

@ -43,6 +43,14 @@ spec:
- name: nova-libvirt - name: nova-libvirt
image: {{ .Values.images.libvirt }} image: {{ .Values.images.libvirt }}
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
{{- if .Values.ceph.enabled }}
lifecycle:
postStart:
exec:
command:
- bash
- /tmp/ceph-secret-define.sh
{{- end }}
{{- if .Values.resources.enabled }} {{- if .Values.resources.enabled }}
resources: resources:
requests: requests:
@ -104,6 +112,10 @@ spec:
mountPath: /etc/ceph/ceph.client.keyring mountPath: /etc/ceph/ceph.client.keyring
subPath: ceph.client.keyring subPath: ceph.client.keyring
readOnly: true readOnly: true
- name: nova-bin
mountPath: /tmp/ceph-secret-define.sh
subPath: ceph-secret-define.sh
readOnly: true
{{- end }} {{- end }}
{{ if $mounts_nova_libvirt.volumeMounts }}{{ toYaml $mounts_nova_libvirt.volumeMounts | indent 12 }}{{ end }} {{ if $mounts_nova_libvirt.volumeMounts }}{{ toYaml $mounts_nova_libvirt.volumeMounts | indent 12 }}{{ end }}
volumes: volumes: