amount = params[1]
return backend.GrowBlockDevice(cfbd, amount)
+ @staticmethod
+ def perspective_blockdev_close(params):
+ """Closes the given block devices.
+
+ """
+ disks = [objects.Disk.FromDict(cf) for cf in params]
+ return backend.CloseBlockDevices(disks)
+
# export/import --------------------------
@staticmethod
return result
+def CloseBlockDevices(disks):
+ """Closes the given block devices.
+
+ This means they will be switched to secondary mode (in case of DRBD).
+
+ """
+ bdevs = []
+ for cf in disks:
+ rd = _RecursiveFindBD(cf)
+ if rd is None:
+ return (False, "Can't find device %s" % cf)
+ bdevs.append(rd)
+
+ msg = []
+ for rd in bdevs:
+ try:
+ rd.Close()
+ except errors.BlockDeviceError, err:
+ msg.append(str(err))
+ if msg:
+ return (False, "Can't make devices secondary: %s" % ",".join(msg))
+ else:
+ return (True, "All devices secondary")
+
+
class HooksRunner(object):
"""Hook runner.
return c.getresult().get(node, False)
+def call_blockdev_close(node, disks):
+ """Closes the given block devices.
+
+ This is a single-node call.
+
+ """
+ params = [cf.ToDict() for cf in disks]
+ c = Client("blockdev_close", params)
+ c.connect(node)
+ c.run()
+ return c.getresult().get(node, False)
+
+
def call_upload_file(node_list, file_name):
"""Upload a file.