RemoteFS: don't fail in do_mount if already mounted
This fixes a problem where two different callers are mounting a share at the same time: A: check if share is mounted B: check if share is mounted A: mount share B: mount share (fails because it is already mounted) Closes-Bug: 1780813 Change-Id: I6eca9c9e9eceb7aef357b0ed77bf157ac0010bfe
This commit is contained in:
parent
cb2ee2776d
commit
2f32c98a65
@ -20,6 +20,7 @@ import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
@ -116,8 +117,16 @@ class RemoteFsClient(executor.Executor):
|
||||
mnt_cmd.extend(flags)
|
||||
mnt_cmd.extend([share, mount_path])
|
||||
|
||||
self._execute(*mnt_cmd, root_helper=self._root_helper,
|
||||
run_as_root=True, check_exit_code=0)
|
||||
try:
|
||||
self._execute(*mnt_cmd, root_helper=self._root_helper,
|
||||
run_as_root=True, check_exit_code=0)
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
if 'already mounted' in exc.stderr:
|
||||
LOG.info("Already mounted: %s", share)
|
||||
else:
|
||||
LOG.error("Failed to mount %(share)s, reason: %(reason)s",
|
||||
{'share': share, 'reason': exc.stderr})
|
||||
raise
|
||||
|
||||
def _mount_nfs(self, nfs_share, mount_path, flags=None):
|
||||
"""Mount nfs share using present mount types."""
|
||||
|
Loading…
Reference in New Issue
Block a user