libvirtd pod is not starting when Ceph is enabled
When trying to install nova chart with Ceph enabled, libvirtd pod isn't starting. It's because container is executing virsh commands before libvirtd process is up. _libvirt.sh.tpl script needs to be fixed to start the process first and then execute the commands. Closes-Bug: #1691384 Change-Id: Icd5f31a5fbeb5985ed19213aeb236a25f600b18c
This commit is contained in:
parent
a3972f6e5d
commit
3f98813b1e
41
nova/templates/bin/_ceph-secret-define.sh.tpl
Normal file
41
nova/templates/bin/_ceph-secret-define.sh.tpl
Normal 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
|
@ -28,23 +28,4 @@ if [[ -c /dev/kvm ]]; then
|
||||
chown root:kvm /dev/kvm
|
||||
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
|
||||
|
@ -29,6 +29,10 @@ data:
|
||||
{{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }}
|
||||
libvirt.sh: |
|
||||
{{ 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: |
|
||||
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
nova-api.sh: |
|
||||
|
@ -43,6 +43,14 @@ spec:
|
||||
- name: nova-libvirt
|
||||
image: {{ .Values.images.libvirt }}
|
||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||
{{- if .Values.ceph.enabled }}
|
||||
lifecycle:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- /tmp/ceph-secret-define.sh
|
||||
{{- end }}
|
||||
{{- if .Values.resources.enabled }}
|
||||
resources:
|
||||
requests:
|
||||
@ -104,6 +112,10 @@ spec:
|
||||
mountPath: /etc/ceph/ceph.client.keyring
|
||||
subPath: ceph.client.keyring
|
||||
readOnly: true
|
||||
- name: nova-bin
|
||||
mountPath: /tmp/ceph-secret-define.sh
|
||||
subPath: ceph-secret-define.sh
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{ if $mounts_nova_libvirt.volumeMounts }}{{ toYaml $mounts_nova_libvirt.volumeMounts | indent 12 }}{{ end }}
|
||||
volumes:
|
||||
|
Loading…
x
Reference in New Issue
Block a user