(self, cluster_ident, cluster_upgrade_req)
return ClusterID(cluster.uuid)
Upgrade a cluster.

        :param cluster_ident: UUID of a cluster or logical name of the cluster.
Upgrade a cluster.
Upgrade a cluster .
def _upgrade(self, cluster_ident, cluster_upgrade_req):
        """Upgrade a cluster.

        :param cluster_ident: UUID of a cluster or logical name of the cluster.
        """
        context = pecan.request.context
        if context.is_admin:
            policy.enforce(context, "cluster:upgrade_all_projects",
                           action="cluster:upgrade_all_projects")
            context.all_tenants = True

        cluster = api_utils.get_resource('Cluster', cluster_ident)
        policy.enforce(context, 'cluster:upgrade', cluster,
                       action='cluster:upgrade')

        new_cluster_template = api_utils.get_resource(
            'ClusterTemplate', cluster_upgrade_req.cluster_template)

        if (cluster_upgrade_req.nodegroup == wtypes.Unset or
                not cluster_upgrade_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_upgrade_req.nodegroup)
            if (new_cluster_template.uuid != cluster.cluster_template_id
                    and not nodegroup.is_default):
                reason = ("Nodegroup %s can be upgraded only to "
                          "match cluster's template (%s).")
                reason = reason % (nodegroup.name,
                                   cluster.cluster_template.name)
                raise exception.InvalidClusterTemplateForUpgrade(reason=reason)

        pecan.request.rpcapi.cluster_upgrade(
            cluster,
            new_cluster_template,
            cluster_upgrade_req.max_batch_size,
            nodegroup)
        return ClusterID(cluster.uuid)
def _upgrade ( self , cluster_ident , cluster_upgrade_req ) : context = pecan . request . context if context . is_admin : policy . enforce ( context , "cluster:upgrade_all_projects" , action = "cluster:upgrade_all_projects" ) context . all_tenants = True cluster = api_utils . get_resource ( 'Cluster' , cluster_ident ) policy . enforce ( context , 'cluster:upgrade' , cluster , action = 'cluster:upgrade' ) new_cluster_template = api_utils . get_resource ( 'ClusterTemplate' , cluster_upgrade_req . cluster_template ) if ( cluster_upgrade_req . nodegroup == wtypes . Unset or not cluster_upgrade_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_upgrade_req . nodegroup ) if ( new_cluster_template . uuid != cluster . cluster_template_id and not nodegroup . is_default ) : reason = ( "Nodegroup %s can be upgraded only to " "match cluster's template (%s)." ) reason = reason % ( nodegroup . name , cluster . cluster_template . name ) raise exception . InvalidClusterTemplateForUpgrade ( reason = reason ) pecan . request . rpcapi . cluster_upgrade ( cluster , new_cluster_template , cluster_upgrade_req . max_batch_size , nodegroup ) return ClusterID ( cluster . uuid )