mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
mount: cache blkid information
During the mount of a device a call to blkid is done, to get information of the current devices. blkid is a slow operation, to avoid that use an internal cache, that is specified in /etc/blkid configuration file, but a single blkid can still redo this cache file, making the second call equally slow. This patch cache the blkid information for _active_mountinfo in the __context__ dict, making the next mount action a fast operation.
This commit is contained in:
parent
87835dc879
commit
c1ede1d97c
@ -63,7 +63,9 @@ def _active_mountinfo(ret):
|
||||
msg = 'File not readable {0}'
|
||||
raise CommandExecutionError(msg.format(filename))
|
||||
|
||||
blkid_info = __salt__['disk.blkid']()
|
||||
if 'disk.blkid' not in __context__:
|
||||
__context__['disk.blkid'] = __salt__['disk.blkid']()
|
||||
blkid_info = __context__['disk.blkid']
|
||||
|
||||
with salt.utils.files.fopen(filename) as ifile:
|
||||
for line in ifile:
|
||||
|
Loading…
Reference in New Issue
Block a user