Revision ff5def9b lib/backend.py
b/lib/backend.py | ||
---|---|---|
2255 | 2255 |
This is a wrapper over _RecursiveAssembleBD. |
2256 | 2256 |
|
2257 | 2257 |
@rtype: str or boolean |
2258 |
@return: a C{/dev/...} path for primary nodes, and
|
|
2259 |
C{True} for secondary nodes
|
|
2258 |
@return: a tuple with the C{/dev/...} path and the created symlink
|
|
2259 |
for primary nodes, and (C{True}, C{True}) for secondary nodes
|
|
2260 | 2260 |
|
2261 | 2261 |
""" |
2262 | 2262 |
try: |
2263 | 2263 |
result = _RecursiveAssembleBD(disk, owner, as_primary) |
2264 | 2264 |
if isinstance(result, BlockDev): |
2265 | 2265 |
# pylint: disable=E1103 |
2266 |
result = result.dev_path |
|
2266 |
dev_path = result.dev_path |
|
2267 |
link_name = None |
|
2267 | 2268 |
if as_primary: |
2268 |
_SymlinkBlockDev(owner, result, idx) |
|
2269 |
link_name = _SymlinkBlockDev(owner, dev_path, idx) |
|
2270 |
elif result: |
|
2271 |
return result, result |
|
2272 |
else: |
|
2273 |
_Fail("Unexpected result from _RecursiveAssembleBD") |
|
2269 | 2274 |
except errors.BlockDeviceError, err: |
2270 | 2275 |
_Fail("Error while assembling disk: %s", err, exc=True) |
2271 | 2276 |
except OSError, err: |
2272 | 2277 |
_Fail("Error while symlinking disk: %s", err, exc=True) |
2273 | 2278 |
|
2274 |
return result
|
|
2279 |
return dev_path, link_name
|
|
2275 | 2280 |
|
2276 | 2281 |
|
2277 | 2282 |
def BlockdevShutdown(disk): |
Also available in: Unified diff