Make cryptohome mount calls asynchronous under the hood
Sometimes we see failures during testing where mounting/unmounting/remounting
leads to DBus timeouts when trying to talk to cryptohomed. The synchronous
API for this isn't supposed to be used anymore anyhow, so let's stop
using it during testing.
BUG=None
TEST=login_RemoteOwnership, suite:smoke
Change-Id: I46f4f3028facc616a2e77ff43a9bdbbce41bb693
Reviewed-on: https://chromium-review.googlesource.com/175594
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
diff --git a/client/cros/cryptohome.py b/client/cros/cryptohome.py
index d63ef09..8948827 100644
--- a/client/cros/cryptohome.py
+++ b/client/cros/cryptohome.py
@@ -133,10 +133,10 @@
def mount_vault(user, password, create=False):
"""Mount the given user's vault."""
args = [CRYPTOHOME_CMD, '--action=mount', '--user=%s' % user,
- '--password=%s' % password]
+ '--password=%s' % password, '--async']
if create:
args.append('--create')
- print utils.system_output(args)
+ logging.info(__run_cmd(' '.join(args)))
# Ensure that the vault exists in the shadow directory.
user_hash = get_user_hash(user)
if not os.path.exists(os.path.join(constants.SHADOW_ROOT, user_hash)):
@@ -151,7 +151,8 @@
def mount_guest():
"""Mount the given user's vault."""
- print utils.system_output([CRYPTOHOME_CMD, '--action=mount_guest'])
+ args = [CRYPTOHOME_CMD, '--action=mount_guest', '--async']
+ logging.info(__run_cmd(' '.join(args)))
# Ensure that the guest tmpfs is mounted.
if not is_guest_vault_mounted(allow_fail=True):
raise ChromiumOSError('Cryptohome did not mount tmpfs.')
@@ -169,8 +170,7 @@
Once unmounting for a specific user is supported, the user parameter will
name the target user. See crosbug.com/20778.
"""
- cmd = (CRYPTOHOME_CMD + ' --action=unmount')
- __run_cmd(cmd)
+ __run_cmd(CRYPTOHOME_CMD + ' --action=unmount')
# Ensure that the vault is not mounted.
if is_vault_mounted(user, allow_fail=True):
raise ChromiumOSError('Cryptohome did not unmount the user.')