mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
mdadm_raid: Optionally ignore errors on examine.
During the RAID creation, the code examine each device to decide if belongs to an already present array or not. The first time that the RAID is created, is expected that examine will fail. This patch add an optional parameter to examine, to ignore the fail in the logs. Also calls examine with this parameter during the RAID creation.
This commit is contained in:
parent
836da17531
commit
bfd8b1157f
@ -360,17 +360,25 @@ def assemble(name,
|
||||
return __salt__['cmd.run'](cmd, python_shell=False)
|
||||
|
||||
|
||||
def examine(device):
|
||||
def examine(device, quiet=False):
|
||||
'''
|
||||
Show detail for a specified RAID component device
|
||||
|
||||
device
|
||||
Device to examine, that is part of the RAID
|
||||
|
||||
quiet
|
||||
If the device is not part of the RAID, do not show any error
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' raid.examine '/dev/sda1'
|
||||
'''
|
||||
res = __salt__['cmd.run_stdout']('mdadm -Y -E {0}'.format(device), output_loglevel='trace', python_shell=False)
|
||||
res = __salt__['cmd.run_stdout']('mdadm -Y -E {0}'.format(device),
|
||||
python_shell=False,
|
||||
ignore_retcode=quiet)
|
||||
ret = {}
|
||||
|
||||
for line in res.splitlines():
|
||||
|
@ -98,7 +98,7 @@ def present(name,
|
||||
if dev == 'missing' or not __salt__['file.access'](dev, 'f'):
|
||||
missing.append(dev)
|
||||
continue
|
||||
superblock = __salt__['raid.examine'](dev)
|
||||
superblock = __salt__['raid.examine'](dev, quiet=True)
|
||||
|
||||
if 'MD_UUID' in superblock:
|
||||
uuid = superblock['MD_UUID']
|
||||
|
Loading…
Reference in New Issue
Block a user