os-brick/os_brick/tests
Gorka Eguileor de89635ab7 Protect against race within os.path.realpath
On iSCSI connections, when we are making sure that there no links remain
like /dev/disk/by-id/scsi-* we make several calls to os.path.realpath
which normal behavior is:

- If file path doesn't exist, returns the same file path
- If file path exists, return the real path

But there is a third option, and that is when the file did exist but it
dissapear right when the  call to os.readlink in posixpath:_joinrealpath

   path, ok = _joinrealpath(path, os.readlink(newpath), seen)

Which ends up raising an exception such as:

   OSError: [Errno 2] No such file or directory:
            '/dev/disk/by-id/scsi-20024f40058540081'

And because of this exception the detach will fail when it shouldn't.

This patch adds includes the call to os.path.realpath within a
try...except clause to prevent this race condition from unexpectely
making the detach operation fail.

Change-Id: Ieb58826b28c62094c941fce10863c0a75fb4e8aa
Closes-Bug: #1719719
2017-09-26 21:01:14 +02:00
..
encryptors encryptors: Delay removal of legacy provider names 2017-05-16 08:27:12 +00:00
initiator Protect against race within os.path.realpath 2017-09-26 21:01:14 +02:00
local_dev Using assertIsNone(x) instead of assertEqual(None, x) 2017-03-23 10:57:37 +08:00
privileged Refactor iSCSI connect 2017-06-16 16:09:35 +02:00
remotefs Move vzstorage related code out of RemoteFsClient 2017-03-30 13:53:10 +03:00
windows Refactor iSCSI disconnect 2017-05-31 15:31:20 +02:00
__init__.py renamed the project to os-brick 2015-02-05 23:58:37 +00:00
base.py Merge "Replace assertDictMatch with assertDictEqual" 2016-12-22 17:24:10 +00:00
test_brick.py Removes unnecessary utf-8 encoding 2016-12-22 10:24:40 +07:00
test_exception.py Use six.text_type instead of unicode 2015-04-03 10:22:45 +03:00
test_executor.py iSCSI multipath: improve logging on connect 2017-06-26 20:31:59 +02:00
test_utils.py Mask passwords in utils.trace for func params 2016-11-08 12:55:46 -05:00