Skip to content

Instantly share code, notes, and snippets.

@mnaser
Last active December 19, 2020 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnaser/643fe67b74dcdf65b8e2bab19467065e to your computer and use it in GitHub Desktop.
Save mnaser/643fe67b74dcdf65b8e2bab19467065e to your computer and use it in GitHub Desktop.
#!/bin/bash
if ! command -v virsh; then
echo "virsh could not be found"
exit
fi
SECRET_UUID=$(virsh secret-list | grep 'client.cinder' | cut -d' ' -f2)
SECRET_VALUE=$(cat /etc/ceph/ceph.client.cinder.keyring | grep 'key' | cut -d'=' -f2 | cut -d' ' -f2)
virsh secret-undefine ${SECRET_UUID}
virsh secret-define --file /dev/stdin <<EOF
<secret ephemeral='no' private='no'>
<uuid>457eb676-33da-42ec-9a8c-9293d545c337</uuid>
<usage type='ceph'>
<name>client.cinder secret</name>
</usage>
</secret>
EOF
virsh secret-set-value --secret 457eb676-33da-42ec-9a8c-9293d545c337 --base64 ${SECRET_VALUE}
sed -i 's/^rbd_secret_uuid.*/rbd_secret_uuid = 457eb676-33da-42ec-9a8c-9293d545c337/' /etc/nova/nova.conf
systemctl restart nova-compute || systemctl restart openstack-nova-compute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment