Commit 594609c0 authored by Iustin Pop's avatar Iustin Pop
Browse files

Expose block device grow in backend.py

This patch adds a wrapper over the block device grow operation that
converts the input and output parameters as needed for the rpc layer.

Reviewed-by: imsnah
parent 1005d816
......@@ -1137,6 +1137,32 @@ def OSFromDisk(name, base_dir=None):
api_version=api_version)
def GrowBlockDevice(disk, amount):
"""Grow a stack of block devices.
This function is called recursively, with the childrens being the
first one resize.
Args:
disk: the disk to be grown
Returns: a tuple of (status, result), with:
status: the result (true/false) of the operation
result: the error message if the operation failed, otherwise not used
"""
r_dev = _RecursiveFindBD(disk)
if r_dev is None:
return False, "Cannot find block device %s" % (disk,)
try:
r_dev.Grow(amount)
except errors.BlockDeviceError, err:
return False, str(err)
return True, None
def SnapshotBlockDevice(disk):
"""Create a snapshot copy of a block device.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment