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

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: Ifa61fe593fa2cd2b12a70659f8f4b1b3673a4608
Related-Bug: #1719436
This commit is contained in:
Frode Nordahl 2018-03-09 15:19:03 +01:00
parent 523d76db44
commit 23f0c12c47
No known key found for this signature in database
GPG Key ID: 6A5D59A3BA48373F
2 changed files with 11 additions and 3 deletions

View File

@ -1358,10 +1358,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

View File

@ -432,7 +432,8 @@ class CephTestCase(unittest.TestCase):
]
if luminous:
test_calls.append(
call(['ceph-create-keys', '--id', test_hostname])
call(['ceph-create-keys', '--id', test_hostname, '--timeout',
'1800'])
)
fake_open = mock_open()