Increase timeout and remove empty keyring for ceph-create-keys

Sync relevant changes from charms.ceph.

Default timeout of ceph-create-keys of 600 seconds is not
adequate in all circumstances.

When ceph-create-keys times out it leaves a empty keyring.
The retry attempt will fail as long as the empty keyring exists.
Remove it before retry attempt.

Change-Id: I914be8a5a7dcd9676438de92bba7f91283232837
Closes-Bug: #1719436
This commit is contained in:
Frode Nordahl 2018-03-09 15:51:13 +01:00
parent 96657b6f2c
commit 8134a12bc5
No known key found for this signature in database
GPG Key ID: 6A5D59A3BA48373F
1 changed files with 9 additions and 2 deletions

View File

@ -1355,10 +1355,17 @@ def add_keyring_to_ceph(keyring, secret, hostname, path, done, init_marker):
# admin keys for the cluster; this command
# will wait for quorum in the cluster before
# returning.
cmd = ['ceph-create-keys', '--id', hostname]
# NOTE(fnordahl): The default timeout in ceph-create-keys of 600
# seconds is not adequate for all situations.
# LP#1719436
cmd = ['ceph-create-keys', '--id', hostname, '--timeout', '1800']
subprocess.check_call(cmd)
osstat = os.stat("/etc/ceph/ceph.client.admin.keyring")
_client_admin_keyring = '/etc/ceph/ceph.client.admin.keyring'
osstat = os.stat(_client_admin_keyring)
if not osstat.st_size:
# NOTE(fnordahl): Retry will fail as long as this file exists.
# LP#1719436
os.remove(_client_admin_keyring)
raise Exception