Revision 968a7623 lib/backend.py
b/lib/backend.py | ||
---|---|---|
1442 | 1442 |
return (True, (rbd.dev_path, rbd.major, rbd.minor) + rbd.GetSyncStatus()) |
1443 | 1443 |
|
1444 | 1444 |
|
1445 |
def BlockdevGetsize(disks): |
|
1446 |
"""Computes the size of the given disks. |
|
1447 |
|
|
1448 |
If a disk is not found, returns None instead. |
|
1449 |
|
|
1450 |
@type disks: list of L{objects.Disk} |
|
1451 |
@param disks: the list of disk to compute the size for |
|
1452 |
@rtype: list |
|
1453 |
@return: list with elements None if the disk cannot be found, |
|
1454 |
otherwise the size |
|
1455 |
|
|
1456 |
""" |
|
1457 |
result = [] |
|
1458 |
for cf in disks: |
|
1459 |
try: |
|
1460 |
rbd = _RecursiveFindBD(cf) |
|
1461 |
except errors.BlockDeviceError, err: |
|
1462 |
result.append(None) |
|
1463 |
continue |
|
1464 |
if rbd is None: |
|
1465 |
result.append(None) |
|
1466 |
else: |
|
1467 |
result.append(rbd.GetActualSize()) |
|
1468 |
return result |
|
1469 |
|
|
1470 |
|
|
1445 | 1471 |
def UploadFile(file_name, data, mode, uid, gid, atime, mtime): |
1446 | 1472 |
"""Write a file to the filesystem. |
1447 | 1473 |
|
Also available in: Unified diff