From: Bernardo Dal Seno Date: Thu, 27 Jun 2013 15:06:44 +0000 (+0200) Subject: Add exclusive_storage to blockdev_grow RPC X-Git-Tag: v2.9.0beta1~166 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/e43a624e6670809270ffe81123f09478b5345f2b Add exclusive_storage to blockdev_grow RPC The flag is passed to the RPC, but it's still ignored by noded. Signed-off-by: Bernardo Dal Seno Reviewed-by: Klaus Aehlig --- diff --git a/lib/cmdlib/instance_storage.py b/lib/cmdlib/instance_storage.py index d159187..7a4933a 100644 --- a/lib/cmdlib/instance_storage.py +++ b/lib/cmdlib/instance_storage.py @@ -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)) diff --git a/lib/rpc_defs.py b/lib/rpc_defs.py index 07b4645..31acf65 100644 --- a/lib/rpc_defs.py +++ b/lib/rpc_defs.py @@ -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, [ diff --git a/lib/server/noded.py b/lib/server/noded.py index 386e568..861e01c 100644 --- a/lib/server/noded.py +++ b/lib/server/noded.py @@ -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]