diff options
author | Pavel Glushchak <pglushchak@virtuozzo.com> | 2017-10-25 15:58:01 +0300 |
---|---|---|
committer | melanie witt <melwittt@gmail.com> | 2018-12-07 00:10:51 +0000 |
commit | 26521718bdba3bccbf6270e26b76754c26304658 (patch) | |
tree | c1d336e5916fe06e4de28ec1bc6ae456d0922de6 /nova/utils.py | |
parent | 20bc0136d0665bafdcd379f19389a0a5ea7bf310 (diff) | |
download | nova-26521718bdba3bccbf6270e26b76754c26304658.tar.gz |
Fixed concurrent access to direct io test file
When instances are deployed concurrently on multiple
compute nodes, nova-compute may fail on checking
direct io capabilities when instance_path is shared
across nodes. This fails on shared storage, that
doesn't support concurrent write access to the
same file, i.e. Virtuozzo Storage. To fix that we add
random string at the end of test file name.
Closes-Bug: #1727369
Change-Id: I085ade355fba0e9727a38d2dcbc9cffa735a62d1
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/utils.py b/nova/utils.py index f3eb785702..8d7bc1efd2 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -244,9 +244,13 @@ def ssh_execute(dest, *cmd, **kwargs): def generate_uid(topic, size=8): + random_string = generate_random_string(size) + return '%s-%s' % (topic, random_string) + + +def generate_random_string(size=8): characters = '01234567890abcdefghijklmnopqrstuvwxyz' - choices = [random.choice(characters) for _x in range(size)] - return '%s-%s' % (topic, ''.join(choices)) + return ''.join([random.choice(characters) for _x in range(size)]) # Default symbols to use for passwords. Avoids visually confusing characters. |