Revision 9b28d122 lib/backend.py
b/lib/backend.py | ||
---|---|---|
1915 | 1915 |
This is a wrapper over _RecursiveAssembleBD. |
1916 | 1916 |
|
1917 | 1917 |
@rtype: str or boolean |
1918 |
@return: a C{/dev/...} path for primary nodes, and
|
|
1919 |
C{True} for secondary nodes
|
|
1918 |
@return: a tuple with the C{/dev/...} path and the created symlink
|
|
1919 |
for primary nodes, and (C{True}, C{True}) for secondary nodes
|
|
1920 | 1920 |
|
1921 | 1921 |
""" |
1922 | 1922 |
try: |
1923 | 1923 |
result = _RecursiveAssembleBD(disk, owner, as_primary) |
1924 | 1924 |
if isinstance(result, bdev.BlockDev): |
1925 | 1925 |
# pylint: disable=E1103 |
1926 |
result = result.dev_path |
|
1926 |
dev_path = result.dev_path |
|
1927 |
link_name = None |
|
1927 | 1928 |
if as_primary: |
1928 |
_SymlinkBlockDev(owner, result, idx) |
|
1929 |
link_name = _SymlinkBlockDev(owner, dev_path, idx) |
|
1930 |
elif result: |
|
1931 |
return result, result |
|
1932 |
else: |
|
1933 |
_Fail("Unexpected result from _RecursiveAssembleBD") |
|
1929 | 1934 |
except errors.BlockDeviceError, err: |
1930 | 1935 |
_Fail("Error while assembling disk: %s", err, exc=True) |
1931 | 1936 |
except OSError, err: |
1932 | 1937 |
_Fail("Error while symlinking disk: %s", err, exc=True) |
1933 | 1938 |
|
1934 |
return result
|
|
1939 |
return dev_path, link_name
|
|
1935 | 1940 |
|
1936 | 1941 |
|
1937 | 1942 |
def BlockdevShutdown(disk): |
Also available in: Unified diff