From 4c8ba8b31ceabbbf0b44fbcce929a0c53be2a12d Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 17 Jun 2008 06:50:19 +0000
Subject: [PATCH] Implement block device grow at the rpc layer

This simple patch exposes the block device grow operation at the rpc
layer. It does not increase the protocol version as it has been recently
changed by the live failover rpc call.

Reviewed-by: imsnah
---
 daemons/ganeti-noded |  9 +++++++++
 lib/rpc.py           | 12 ++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
index b68a8faf0..115c51b48 100755
--- a/daemons/ganeti-noded
+++ b/daemons/ganeti-noded
@@ -211,6 +211,15 @@ class ServerObject(BaseHTTPServer.BaseHTTPRequestHandler):
     cfbd = objects.Disk.FromDict(params[0])
     return backend.SnapshotBlockDevice(cfbd)
 
+  @staticmethod
+  def perspective_blockdev_grow(params):
+    """Grow a stack of devices.
+
+    """
+    cfbd = objects.Disk.FromDict(params[0])
+    amount = params[1]
+    return backend.GrowBlockDevice(cfbd, amount)
+
   # export/import  --------------------------
 
   @staticmethod
diff --git a/lib/rpc.py b/lib/rpc.py
index 8b5e5baac..335d8885b 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -607,6 +607,18 @@ def call_iallocator_runner(node, name, idata):
   return result
 
 
+def call_blockdev_grow(node, cf_bdev, amount):
+  """Request a snapshot of the given block device.
+
+  This is a single-node call.
+
+  """
+  c = Client("blockdev_grow", [cf_bdev.ToDict(), amount])
+  c.connect(node)
+  c.run()
+  return c.getresult().get(node, False)
+
+
 def call_blockdev_snapshot(node, cf_bdev):
   """Request a snapshot of the given block device.
 
-- 
GitLab