Revision 594609c0
b/lib/backend.py | ||
---|---|---|
1137 | 1137 |
api_version=api_version) |
1138 | 1138 |
|
1139 | 1139 |
|
1140 |
def GrowBlockDevice(disk, amount): |
|
1141 |
"""Grow a stack of block devices. |
|
1142 |
|
|
1143 |
This function is called recursively, with the childrens being the |
|
1144 |
first one resize. |
|
1145 |
|
|
1146 |
Args: |
|
1147 |
disk: the disk to be grown |
|
1148 |
|
|
1149 |
Returns: a tuple of (status, result), with: |
|
1150 |
status: the result (true/false) of the operation |
|
1151 |
result: the error message if the operation failed, otherwise not used |
|
1152 |
|
|
1153 |
""" |
|
1154 |
r_dev = _RecursiveFindBD(disk) |
|
1155 |
if r_dev is None: |
|
1156 |
return False, "Cannot find block device %s" % (disk,) |
|
1157 |
|
|
1158 |
try: |
|
1159 |
r_dev.Grow(amount) |
|
1160 |
except errors.BlockDeviceError, err: |
|
1161 |
return False, str(err) |
|
1162 |
|
|
1163 |
return True, None |
|
1164 |
|
|
1165 |
|
|
1140 | 1166 |
def SnapshotBlockDevice(disk): |
1141 | 1167 |
"""Create a snapshot copy of a block device. |
1142 | 1168 |
|
Also available in: Unified diff