Create a cluster of BIG-IP® devices.

        :param kwargs: dict -- keyword arguments for cluster manager
179975
def create(self, **kwargs):
        '''
        '''

        try:
            cluster = getattr(self, "cluster", None)
        except NoClusterToManage:
            cluster = None
        if cluster is not None:
            msg = 'The ClusterManager is already managing a cluster.'
            raise AlreadyManagingCluster(msg)

        self._check_device_number(kwargs['devices'])
        self.trust_domain.create(
            devices=kwargs['devices'],
            partition=kwargs['device_group_partition']
        )
        self.device_group.create(**kwargs)
        self.cluster = Cluster(**kwargs)
309812
def add_cluster(
        self, 
        name, 
        server=None,
        certificate_authority_data=None,
        **attrs):
        """"""
        if self.cluster_exists(name):
            raise KubeConfError("Cluster with the given name already exists.")

        clusters = self.get_clusters()
        
        # Add parameters.
        new_cluster = {'name': name, 'cluster':{}}
        attrs_ = new_cluster['cluster']
        if server is not None:
            attrs_['server'] = server
        if certificate_authority_data is not None:
            attrs_['certificate-authority-data'] = certificate_authority_data

        attrs_.update(attrs)
        clusters.append(new_cluster)
218626
def get_cluster_id(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The get_cluster_id function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    if name is None:
        raise SaltCloudSystemExit(
            'The get_cluster_id function requires a name.'
        )

    try:
        ret = list_clusters()[name]['id']
    except KeyError:
        raise SaltCloudSystemExit(
            'The cluster \'{0}\' could not be found'.format(name)
        )

    return ret
665368
def create(self, ipv4s):
        

        data = {'ips': ipv4s}
        return super(ApiV4IPv4, self).post('api/v4/ipv4/', data)
856436
def create_cluster(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The create_cluster function must be called with '
            '-f or --function.'
        )

    cluster_name = kwargs.get('name') if kwargs and 'name' in kwargs else None
    datacenter = kwargs.get('datacenter') if kwargs and 'datacenter' in kwargs else None

    if not cluster_name:
        raise SaltCloudSystemExit(
            'You must specify name of the new cluster to be created.'
        )

    if not datacenter:
        raise SaltCloudSystemExit(
            'You must specify name of the datacenter where the cluster should be created.'
        )

    # Get the service instance
    si = _get_si()

    if not isinstance(datacenter, vim.Datacenter):
        datacenter = salt.utils.vmware.get_mor_by_property(si, vim.Datacenter, datacenter)
        if not datacenter:
            raise SaltCloudSystemExit(
                'The specified datacenter does not exist.'
            )

    # Check if cluster already exists
    cluster_ref = salt.utils.vmware.get_mor_by_property(si, vim.ClusterComputeResource, cluster_name)
    if cluster_ref:
        return {cluster_name: 'cluster already exists'}

    cluster_spec = vim.cluster.ConfigSpecEx()
    folder = datacenter.hostFolder

    # Verify that the folder is of type vim.Folder
    if isinstance(folder, vim.Folder):
        try:
            folder.CreateClusterEx(name=cluster_name, spec=cluster_spec)
        except Exception as exc:
            log.error(
                'Error creating cluster %s: %s',
                cluster_name, exc,
                # Show the traceback if the debug logging level is enabled
                exc_info_on_loglevel=logging.DEBUG
            )
            return False

        log.debug(
            "Created cluster %s under datacenter %s",
            cluster_name, datacenter.name
        )
        return {cluster_name: 'created'}

    return False
75955
def create(self, name, plugin_name, plugin_version,
               cluster_template_id=None, default_image_id=None,
               is_transient=None, description=None, cluster_configs=None,
               node_groups=None, user_keypair_id=None,
               anti_affinity=None, net_id=None, count=None,
               use_autoconfig=None, shares=None,
               is_public=None, is_protected=None):
        """"""

        data = {
            'name': name,
            'plugin_name': plugin_name,
            'plugin_version': plugin_version,
        }

        return self._do_create(data, cluster_template_id, default_image_id,
                               is_transient, description, cluster_configs,
                               node_groups, user_keypair_id, anti_affinity,
                               net_id, count, use_autoconfig, shares,
                               is_public, is_protected, api_ver=2)
1240946
def create_cluster_meta(cluster_groups):
    """"""
    meta = ClusterMeta()
    meta.add_field('group')

    cluster_groups = cluster_groups or {}
    data = {c: {'group': v} for c, v in cluster_groups.items()}
    meta.from_dict(data)

    return meta
1234629
def createCluster(self, hzVersion, xmlconfig):
        
        self.send_createCluster(hzVersion, xmlconfig)
        return self.recv_createCluster()
940401
def new_ipy(s=''):
    
    # Modified by Bo Peng.
    # This package has been deprecated. Need to import from ipykernel
    from jupyter_client.manager import KernelManager
    km = KernelManager()
    km.start_kernel()
    return km_from_string(km.connection_file)
12833
def create(cls, address, ospf_area=None, **kwargs):
        
        return super(LoopbackClusterInterface, cls).create(
            address=address,
            network_value='{}/32'.format(address),
            interface_id='Loopback Interface',
            ospfv2_area_ref=ospf_area,
            **kwargs)
1140107
def _group_cluster(self, clusters, adj_list, counts):
        ''' '''

        groups = []
        for cluster in clusters:
            groups.append(sorted(cluster, key=lambda x: counts[x],
                                 reverse=True))

        return groups
1344717
def _create_ip_address_objs(ip_addresses, cloud_manager):
        
        # ip-addresses might be provided as a flat array or as a following dict:
        # {'ip_addresses': {'ip_address': [...]}} || {'ip_address': [...]}

        if 'ip_addresses' in ip_addresses:
            ip_addresses = ip_addresses['ip_addresses']

        if 'ip_address' in ip_addresses:
            ip_addresses = ip_addresses['ip_address']

        return [
            IPAddress(cloud_manager=cloud_manager, **ip_addr)
            for ip_addr in ip_addresses
        ]
363292
def from_list(cls, values, settings):
        
        logger.debug('Creating Cluster from list')
        self = cls()
        self.settings = settings
        self.instances = []

        for instance in values:
            uid, ip, port = instance['uid'], instance['ip'], instance['port']
            new_instance = Instance.new(settings=settings, cluster=self, uid=uid, ip=ip, port=port)
            self.instances.append(new_instance)
        return self
550288
def create(self, networkipv4s):
        

        data = {'networks': networkipv4s}
        return super(ApiNetworkIPv4, self).post('api/v3/networkv4/', data)
289218
def create_ipam_config(*pools, **kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)

    try:
        # docker-py 2.0 and newer
        pool_args = salt.utils.args.get_function_argspec(
            docker.types.IPAMPool.__init__).args
        create_pool = docker.types.IPAMPool
        create_config = docker.types.IPAMConfig
    except AttributeError:
        # docker-py < 2.0
        pool_args = salt.utils.args.get_function_argspec(
            docker.utils.create_ipam_pool).args
        create_pool = docker.utils.create_ipam_pool
        create_config = docker.utils.create_ipam_config

    for primary_key, alias_key in (('driver', 'ipam_driver'),
                                   ('options', 'ipam_opts')):

        if alias_key in kwargs:
            alias_val = kwargs.pop(alias_key)
            if primary_key in kwargs:
                log.warning(
                    'docker.create_ipam_config: Both \'%s\' and \'%s\' '
                    'passed. Ignoring \'%s\'',
                    alias_key, primary_key, alias_key
                )
            else:
                kwargs[primary_key] = alias_val

    if salt.utils.data.is_dictlist(kwargs.get('options')):
        kwargs['options'] = salt.utils.data.repack_dictlist(kwargs['options'])

    # Get all of the IPAM pool args that were passed as individual kwargs
    # instead of in the *pools tuple
    pool_kwargs = {}
    for key in list(kwargs):
        if key in pool_args:
            pool_kwargs[key] = kwargs.pop(key)

    pool_configs = []
    if pool_kwargs:
        pool_configs.append(create_pool(**pool_kwargs))
    pool_configs.extend([create_pool(**pool) for pool in pools])

    if pool_configs:
        # Sanity check the IPAM pools. docker-py's type/function for creating
        # an IPAM pool will allow you to create a pool with a gateway, IP
        # range, or map of aux addresses, even when no subnet is passed.
        # However, attempting to use this IPAM pool when creating the network
        # will cause the Docker Engine to throw an error.
        if any('Subnet' not in pool for pool in pool_configs):
            raise SaltInvocationError('A subnet is required in each IPAM pool')
        else:
            kwargs['pool_configs'] = pool_configs

    ret = create_config(**kwargs)
    pool_dicts = ret.get('Config')
    if pool_dicts:
        # When you inspect a network with custom IPAM configuration, only
        # arguments which were explictly passed are reflected. By contrast,
        # docker-py will include keys for arguments which were not passed in
        # but set the value to None. Thus, for ease of comparison, the below
        # loop will remove all keys with a value of None from the generated
        # pool configs.
        for idx, _ in enumerate(pool_dicts):
            for key in list(pool_dicts[idx]):
                if pool_dicts[idx][key] is None:
                    del pool_dicts[idx][key]

    return ret
354481
def populate(self):
        
        server, IPAddresses, storages = self.cloud_manager.get_server_data(self.uuid)
        self._reset(
            server,
            ip_addresses=IPAddresses,
            storage_devices=storages,
            populated=True
        )
        return self
787957
def nameservers_for_device(n_ip)
      nameservers = []
      raw_nameservers = ENV["RS_IP#{n_ip}_NAMESERVERS"].to_s.strip.split(/[, ]+/)
      raw_nameservers.each do |nameserver|
        if valid_ipv4?(nameserver)
          nameservers << nameserver
        else
          # Non-fatal error, we only need one working
          logger.error("Invalid nameserver #{nameserver} for interface##{n_ip}")
        end
      end
      # Also a non-fatal error, DHCP or another interface specify nameservers and we're still good
      logger.warn("No valid nameservers specified for static interface##{n_ip}") unless nameservers.length > 0
      nameservers
    end