Commit e43a624e authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Add exclusive_storage to blockdev_grow RPC



The flag is passed to the RPC, but it's still ignored by noded.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 3771161c
......@@ -1394,6 +1394,7 @@ class LUInstanceGrowDisk(LogicalUnit):
node_uuids = list(self.instance.all_nodes)
for node_uuid in node_uuids:
CheckNodeOnline(self, node_uuid)
self.node_es_flags = rpc.GetExclusiveStorageForNodes(self.cfg, node_uuids)
if self.instance.disk_template not in constants.DTS_GROWABLE:
raise errors.OpPrereqError("Instance's disk layout does not support"
......@@ -1425,10 +1426,7 @@ class LUInstanceGrowDisk(LogicalUnit):
if template not in (constants.DTS_NO_FREE_SPACE_CHECK):
# TODO: check the free disk space for file, when that feature will be
# supported
nodes = map(self.cfg.GetNodeInfo, node_uuids)
es_nodes = filter(lambda n: IsExclusiveStorageEnabledNode(self.cfg, n),
nodes)
if es_nodes:
if any(self.node_es_flags.values()):
# With exclusive storage we need to something smarter than just looking
# at free space; for now, let's simply abort the operation.
raise errors.OpPrereqError("Cannot grow disks when exclusive_storage"
......@@ -1459,7 +1457,8 @@ class LUInstanceGrowDisk(LogicalUnit):
self.cfg.SetDiskID(self.disk, node_uuid)
result = self.rpc.call_blockdev_grow(node_uuid,
(self.disk, self.instance),
self.delta, True, True)
self.delta, True, True,
self.node_es_flags[node_uuid])
result.Raise("Dry-run grow request failed to node %s" %
self.cfg.GetNodeName(node_uuid))
......@@ -1492,7 +1491,8 @@ class LUInstanceGrowDisk(LogicalUnit):
self.cfg.SetDiskID(self.disk, node_uuid)
result = self.rpc.call_blockdev_grow(node_uuid,
(self.disk, self.instance),
self.delta, False, True)
self.delta, False, True,
self.node_es_flags[node_uuid])
result.Raise("Grow request failed to node %s" %
self.cfg.GetNodeName(node_uuid))
......@@ -1500,7 +1500,8 @@ class LUInstanceGrowDisk(LogicalUnit):
node_uuid = self.instance.primary_node
self.cfg.SetDiskID(self.disk, node_uuid)
result = self.rpc.call_blockdev_grow(node_uuid, (self.disk, self.instance),
self.delta, False, False)
self.delta, False, False,
self.node_es_flags[node_uuid])
result.Raise("Grow request failed to node %s" %
self.cfg.GetNodeName(node_uuid))
......
......@@ -417,6 +417,7 @@ _BLOCKDEV_CALLS = [
("amount", None, None),
("dryrun", None, None),
("backingstore", None, None),
("es_flag", None, None),
], None, None, "Request growing of the given block device by a"
" given amount"),
("blockdev_export", SINGLE, None, constants.RPC_TMO_1DAY, [
......
......@@ -361,9 +361,9 @@ class NodeRequestHandler(http.server.HttpServerHandler):
"""Grow a stack of devices.
"""
if len(params) < 4:
raise ValueError("Received only 3 parameters in blockdev_grow,"
" old master?")
if len(params) < 5:
raise ValueError("Received only %s parameters in blockdev_grow,"
" old master?" % len(params))
cfbd = objects.Disk.FromDict(params[0])
amount = params[1]
dryrun = params[2]
......
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