(self, cluster_ident, cluster_resize_req)
return ClusterID(cluster.uuid)
Resize a cluster.

        :param cluster_ident: UUID of a cluster or logical name of the cluster.
Resize a cluster.
Resize a cluster .
def _resize(self, cluster_ident, cluster_resize_req):
        """Resize a cluster.

        :param cluster_ident: UUID of a cluster or logical name of the cluster.
        """
        context = pecan.request.context
        cluster = api_utils.get_resource('Cluster', cluster_ident)
        policy.enforce(context, 'cluster:resize', cluster,
                       action='cluster:resize')

        if (cluster_resize_req.nodegroup == wtypes.Unset or
                not cluster_resize_req.nodegroup):
            # NOTE(ttsiouts): If the nodegroup is not specified
            # reflect the change to the default worker nodegroup
            nodegroup = cluster.default_ng_worker
        else:
            nodegroup = objects.NodeGroup.get(
                context, cluster.uuid, cluster_resize_req.nodegroup)

        if nodegroup.role == 'master':
            # NOTE(ttsiouts): Restrict the resize to worker nodegroups
            raise exception.MasterNGResizeNotSupported()

        # NOTE(ttsiouts): Make sure that the new node count is within
        # the configured boundaries of the selected nodegroup.
        if nodegroup.min_node_count > cluster_resize_req.node_count:
            raise exception.NGResizeOutBounds(
                nodegroup=nodegroup.name, min_nc=nodegroup.min_node_count,
                max_nc=nodegroup.max_node_count)
        if (nodegroup.max_node_count and
                nodegroup.max_node_count < cluster_resize_req.node_count):
            raise exception.NGResizeOutBounds(
                nodegroup=nodegroup.name, min_nc=nodegroup.min_node_count,
                max_nc=nodegroup.max_node_count)

        pecan.request.rpcapi.cluster_resize_async(
            cluster,
            cluster_resize_req.node_count,
            cluster_resize_req.nodes_to_remove,
            nodegroup)
        return ClusterID(cluster.uuid)
def _resize ( self , cluster_ident , cluster_resize_req ) : context = pecan . request . context cluster = api_utils . get_resource ( 'Cluster' , cluster_ident ) policy . enforce ( context , 'cluster:resize' , cluster , action = 'cluster:resize' ) if ( cluster_resize_req . nodegroup == wtypes . Unset or not cluster_resize_req . nodegroup ) : # NOTE(ttsiouts): If the nodegroup is not specified # reflect the change to the default worker nodegroup nodegroup = cluster . default_ng_worker else : nodegroup = objects . NodeGroup . get ( context , cluster . uuid , cluster_resize_req . nodegroup ) if nodegroup . role == 'master' : # NOTE(ttsiouts): Restrict the resize to worker nodegroups raise exception . MasterNGResizeNotSupported ( ) # NOTE(ttsiouts): Make sure that the new node count is within # the configured boundaries of the selected nodegroup. if nodegroup . min_node_count > cluster_resize_req . node_count : raise exception . NGResizeOutBounds ( nodegroup = nodegroup . name , min_nc = nodegroup . min_node_count , max_nc = nodegroup . max_node_count ) if ( nodegroup . max_node_count and nodegroup . max_node_count < cluster_resize_req . node_count ) : raise exception . NGResizeOutBounds ( nodegroup = nodegroup . name , min_nc = nodegroup . min_node_count , max_nc = nodegroup . max_node_count ) pecan . request . rpcapi . cluster_resize_async ( cluster , cluster_resize_req . node_count , cluster_resize_req . nodes_to_remove , nodegroup ) return ClusterID ( cluster . uuid )