return result
-def BlockdevGrow(disk, amount):
+def BlockdevGrow(disk, amount, dryrun):
"""Grow a stack of block devices.
This function is called recursively, with the childrens being the
@type disk: L{objects.Disk}
@param disk: the disk to be grown
+ @type amount: integer
+ @param amount: the amount (in mebibytes) to grow with
+ @type dryrun: boolean
+ @param dryrun: whether to execute the operation in simulation mode
+ only, without actually increasing the size
@rtype: (status, result)
- @return: a tuple with the status of the operation
- (True/False), and the errors message if status
- is False
+ @return: a tuple with the status of the operation (True/False), and
+ the errors message if status is False
"""
r_dev = _RecursiveFindBD(disk)
_Fail("Cannot find block device %s", disk)
try:
- r_dev.Grow(amount, False)
+ r_dev.Grow(amount, dryrun)
except errors.BlockDeviceError, err:
_Fail("Failed to grow block device: %s", err, exc=True)
for node in instance.all_nodes:
self.cfg.SetDiskID(disk, node)
- result = self.rpc.call_blockdev_grow(node, disk, self.op.amount)
+ result = self.rpc.call_blockdev_grow(node, disk, self.op.amount, False)
result.Raise("Grow request failed to node %s" % node)
# TODO: Rewrite code to work properly
return self._SingleNodeCall(node, "iallocator_runner", [name, idata])
@_RpcTimeout(_TMO_NORMAL)
- def call_blockdev_grow(self, node, cf_bdev, amount):
+ def call_blockdev_grow(self, node, cf_bdev, amount, dryrun):
"""Request a snapshot of the given block device.
This is a single-node call.
"""
return self._SingleNodeCall(node, "blockdev_grow",
- [cf_bdev.ToDict(), amount])
+ [cf_bdev.ToDict(), amount, dryrun])
@_RpcTimeout(_TMO_1DAY)
def call_blockdev_export(self, node, cf_bdev,
"""
cfbd = objects.Disk.FromDict(params[0])
amount = params[1]
- return backend.BlockdevGrow(cfbd, amount)
+ dryrun = params[2]
+ return backend.BlockdevGrow(cfbd, amount, dryrun)
@staticmethod
def perspective_blockdev_close(params):