(context, cluster, node_count, is_master=False)
return ng
Returns a nodegroup object based on the given cluster object.
Returns a nodegroup object based on the given cluster object.
Returns a nodegroup object based on the given cluster object .
def _get_nodegroup_object(context, cluster, node_count, is_master=False):
    """Returns a nodegroup object based on the given cluster object."""
    ng = nodegroup.NodeGroup(context)
    ng.cluster_id = cluster.uuid
    ng.project_id = cluster.project_id
    ng.labels = cluster.labels
    ng.node_count = node_count
    ng.image_id = cluster.cluster_template.image_id
    ng.docker_volume_size = (cluster.docker_volume_size or
                             cluster.cluster_template.docker_volume_size)

    if is_master:
        ng.flavor_id = (cluster.master_flavor_id or
                        cluster.cluster_template.master_flavor_id)
        ng.role = "master"
    else:
        ng.flavor_id = cluster.flavor_id or cluster.cluster_template.flavor_id
        ng.role = "worker"
    if (cluster.labels != wtypes.Unset and cluster.labels is not None
       and 'min_node_count' in cluster.labels):
        ng.min_node_count = cluster.labels['min_node_count']
    else:
        ng.min_node_count = 0
    ng.name = "default-%s" % ng.role
    ng.is_default = True
    ng.status = fields.ClusterStatus.CREATE_IN_PROGRESS
    return ng
def _get_nodegroup_object ( context , cluster , node_count , is_master = False ) : ng = nodegroup . NodeGroup ( context ) ng . cluster_id = cluster . uuid ng . project_id = cluster . project_id ng . labels = cluster . labels ng . node_count = node_count ng . image_id = cluster . cluster_template . image_id ng . docker_volume_size = ( cluster . docker_volume_size or cluster . cluster_template . docker_volume_size ) if is_master : ng . flavor_id = ( cluster . master_flavor_id or cluster . cluster_template . master_flavor_id ) ng . role = "master" else : ng . flavor_id = cluster . flavor_id or cluster . cluster_template . flavor_id ng . role = "worker" if ( cluster . labels != wtypes . Unset and cluster . labels is not None and 'min_node_count' in cluster . labels ) : ng . min_node_count = cluster . labels [ 'min_node_count' ] else : ng . min_node_count = 0 ng . name = "default-%s" % ng . role ng . is_default = True ng . status = fields . ClusterStatus . CREATE_IN_PROGRESS return ng