Try luksFormat up to 3 times in case the device is in use
Cinder change I03f8cae05cc117e14f7482115de685fc9f3fa54a is failing for
some volume driver third party CI like NetApp iSCSI because the device
is in use when formatting the device for LUKS.
This change adds a retry counter to the luksFormat command execution
like we did in commit eef97cdf4b
for
closing the volume and hitting intermittent in-use issues.
Closes-Bug: #1470562
Related-Bug: #1440227
Change-Id: I0cb32a6f9fbe68ae033ad00534512aa5d82a417b
This commit is contained in:
parent
e4e16e9077
commit
3aabe378b1
|
@ -61,7 +61,7 @@ class LuksEncryptorTestCase(test_cryptsetup.CryptsetupEncryptorTestCase):
|
|||
mock.call('cryptsetup', '--batch-mode', 'luksFormat',
|
||||
'--key-file=-', self.dev_path,
|
||||
process_input='passphrase',
|
||||
run_as_root=True, check_exit_code=True),
|
||||
run_as_root=True, check_exit_code=True, attempts=3),
|
||||
])
|
||||
self.assertEqual(1, mock_execute.call_count)
|
||||
|
||||
|
@ -118,7 +118,7 @@ class LuksEncryptorTestCase(test_cryptsetup.CryptsetupEncryptorTestCase):
|
|||
run_as_root=True, check_exit_code=True),
|
||||
mock.call('cryptsetup', '--batch-mode', 'luksFormat',
|
||||
'--key-file=-', self.dev_path, process_input='0' * 32,
|
||||
run_as_root=True, check_exit_code=True),
|
||||
run_as_root=True, check_exit_code=True, attempts=3),
|
||||
mock.call('cryptsetup', 'luksOpen', '--key-file=-', self.dev_path,
|
||||
self.dev_name, process_input='0' * 32,
|
||||
run_as_root=True, check_exit_code=True),
|
||||
|
|
|
@ -75,7 +75,7 @@ class LuksEncryptor(cryptsetup.CryptsetupEncryptor):
|
|||
cmd.extend([self.dev_path])
|
||||
|
||||
utils.execute(*cmd, process_input=passphrase,
|
||||
check_exit_code=True, run_as_root=True)
|
||||
check_exit_code=True, run_as_root=True, attempts=3)
|
||||
|
||||
def _open_volume(self, passphrase, **kwargs):
|
||||
"""Opens the LUKS partition on the volume using the specified
|
||||
|
|
Loading…
Reference in New Issue