Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *** Test ***
- def test__udev_settle(self, mocked_execute):
- hardware._udev_settle()
- mocked_execute.assert_called_once_with('udevadm', 'settle')
- + def test__check_for_iscsi_f(self,mocked_execute):
- + hardware._check_for_iscsi()
- + mocked_execute.assert_called_with('iscsistart', '-f')
- ***code***
- def _udev_settle():
- """Wait for the udev event queue to settle.
- Wait for the udev event queue to settle to make sure all devices
- are detected once the machine boots up.
- """
- try:
- utils.execute('udevadm', 'settle')
- except processutils.ProcessExecutionError as e:
- LOG.warning('Something went wrong when waiting for udev '
- 'to settle. Error: %s', e)
- return
- +def _check_for_iscsi():
- + """iscsi detection
- +
- + iscsistart -f will print the iBFT or OF info.
- + In case such connection exists, we would like to issue
- + iscsistart -b to create a session to the target.
- + - if no connection is detected we simply return.
- + """
- + try:
- + utils.execute('iscsistart', '-f')
- + except (processutils.ProcessExecutionError, EnvironmentError) as e:
- + LOG.debug('No iscsi connection detected. Skipping iscsi.'
- + 'Error: %s', e)
- + return
- + try:
- + utils.execute('iscsistart', '-b')
- + except processutils.ProcessExecutionError as e:
- + LOG.warning('Something went wrong executing iscsistart -b'
- + 'Error: %s', e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement