Add a node to the NodeServer

        :param node: Dictionary of node settings. Keys: address, name, node_def_id, primary, and drivers are required.
762539
def addNode(self, node):
        
        LOGGER.info('Adding node {}({})'.format(node.name, node.address))
        message = {
            'addnode': {
                'nodes': [{
                    'address': node.address,
                    'name': node.name,
                    'node_def_id': node.id,
                    'primary': node.primary,
                    'drivers': node.drivers,
                    'hint': node.hint
                }]
            }
        }
        self.send(message)
1049482
def create_node(**kwargs):
    '''
    
    '''
    name = kwargs['name']
    size = kwargs['size']
    image = kwargs['image']
    location = kwargs['location']
    networks = kwargs.get('networks')
    tag = kwargs.get('tag')
    locality = kwargs.get('locality')
    metadata = kwargs.get('metadata')
    firewall_enabled = kwargs.get('firewall_enabled')

    create_data = {
        'name': name,
        'package': size['name'],
        'image': image['name'],
    }
    if networks is not None:
        create_data['networks'] = networks

    if locality is not None:
        create_data['locality'] = locality

    if metadata is not None:
        for key, value in six.iteritems(metadata):
            create_data['metadata.{0}'.format(key)] = value

    if tag is not None:
        for key, value in six.iteritems(tag):
            create_data['tag.{0}'.format(key)] = value

    if firewall_enabled is not None:
        create_data['firewall_enabled'] = firewall_enabled

    data = salt.utils.json.dumps(create_data)

    ret = query(command='my/machines', data=data, method='POST',
                location=location)
    if ret[0] in VALID_RESPONSE_CODES:
        return ret[1]
    else:
        log.error('Failed to create node %s: %s', name, ret[1])

    return {}
549404
def add_variable(self, node):
        
        if node.name not in self.variable_names:
            self.variables.append(node)
            self.variable_names.add(node.name)
            node.parent = self
604917
def add_node(self, node):
        
        new = ClusterNode.from_uri(node["addr"])
        cluster_member = self.nodes[0]
        check_new_nodes([new], [cluster_member])

        new.meet(cluster_member.host, cluster_member.port)
        self.nodes.append(new)

        self.wait()

        if node["role"] != "slave":
            return

        if "master" in node:
            target = self.get_node(node["master"])
            if not target:
                raise NodeNotFound(node["master"])
        else:
            masters = sorted(self.masters, key=lambda x: len(x.slaves(x.name)))
            target = masters[0]

        new.replicate(target.name)
        new.flush_cache()
        target.flush_cache()
1310672
def add_node(self, node):
        """"""
        self.nodes.append(node)

        # add node_ids
        try:
            if node.node_id != b"$stats":
                self.node_ids.append(node.node_id)
        except NotImplementedError:
            raise
        except Exception:
            print("ERROR: getting Node")
51241
def _add_node(self, node):
        
        self.nodes[node.node_id] = node
        logging.info("Added node with id {} containing {} streams".format(node.node_id, len(node.streams)))
824190
boolean add(DatanodeDescriptor node) {
    hostmapLock.writeLock().lock();
    try {
      if (node==null || contains(node)) {
        return false;
      }
      
      String host = node.getHost();
      DatanodeDescriptor[] nodes = map.get(host);
      DatanodeDescriptor[] newNodes;
      if (nodes==null) {
        newNodes = new DatanodeDescriptor[1];
        newNodes[0]=node;
      } else { // rare case: more than one datanode on the host
        newNodes = new DatanodeDescriptor[nodes.length+1];
        System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
        newNodes[nodes.length] = node;
      }
      map.put(host, newNodes);
      return true;
    } finally {
      hostmapLock.writeLock().unlock();
    }
  }
131013
def apply(self, node):
        
        new_node = self.run(node)
        return self.update, new_node
35662
def addNode(self, node):
        '''
        
        '''
        self.mybldgbuids[node.buid] = node
        self.allbldgbuids[node.buid] = (node, self.doneevent)
98367
def add_node(self, node_name):
        
        graph = self.graph
        if node_name in graph:
            raise KeyError('node %s already exists' % node_name)
        graph[node_name] = set()
928600
def add_nodes(network_id, nodes,**kwargs):
    
    start_time = datetime.datetime.now()

    names=[]        # used to check uniqueness of node name
    for n_i in nodes:
        if n_i.name in names:
            raise HydraError("Duplicate Node Name: %s"%(n_i.name))
        names.append(n_i.name)

    user_id = kwargs.get('user_id')
    try:
        net_i = db.DBSession.query(Network).filter(Network.id == network_id).one()
        net_i.check_write_permission(user_id)
    except NoResultFound:
        raise ResourceNotFoundError("Network %s not found"%(network_id))

    _add_nodes_to_database(net_i, nodes)

    net_i.project_id=net_i.project_id
    db.DBSession.flush()

    node_s =  db.DBSession.query(Node).filter(Node.network_id==network_id).all()

    #Maps temporary node_ids to real node_ids
    node_id_map = dict()

    iface_nodes = dict()
    for n_i in node_s:
        iface_nodes[n_i.name] = n_i

    for node in nodes:
        node_id_map[node.id] = iface_nodes[node.name]

    _bulk_add_resource_attrs(network_id, 'NODE', nodes, iface_nodes)

    log.info("Nodes added in %s", get_timing(start_time))
    return node_s
942091
def add_node(self, id, label=None, type='CLASS', meta=None):
        
        g = self.get_graph()
        if meta is None:
            meta={}
        g.add_node(id, label=label, type=type, meta=meta)
819802
public void addNode(N node)
    {
        if(!nodes.containsKey(node))
            nodes.put(node, new Pair<HashSet<N>, HashSet<N>>(new HashSet<N>(), new HashSet<N>()));
    }
162364
public void addNode(Node node) {

		long nId = node.getId();
		
		if (this.containsNode(nId))
			throw new DuplicatedNodeException(nId);
		int index = nextNodeId++;
		nodeIdMapping.put(nId, index);

		int aliveIndex = index >> 5;
		int aliveSubIndex = index & 31;

		if (aliveIndex >= aliveNodes.size())
			aliveNodes.add(0);

		aliveNodes.set(aliveIndex, aliveNodes.get(aliveIndex) | (byte)(1 << aliveSubIndex));

		adjacency.add(new IntHashSet[] {new IntHashSet(), new IntHashSet()});

		nodes.add(node);
		numberOfNodes++;
	}
112997
def insert_node(self, node):
        
        if self._is_node_reserved(node):
            return False

        # Put node in map
        self._node_map[node.get_id()] = node
        return True
1014791
def add_node(node, **kwds):
    
    nodes._add_node_class_names([node.__name__])
    for key, val in kwds.iteritems():
        try:
            visit, depart = val
        except ValueError:
            raise ValueError('Value for key %r must be a '
                                 '(visit, depart) function tuple' % key)
        if key == 'html':
            from docutils.writers.html4css1 import HTMLTranslator as translator
        elif key == 'latex':
            from docutils.writers.latex2e import LaTeXTranslator as translator
        else:
            # ignore invalid keys for compatibility
            continue
        setattr(translator, 'visit_'+node.__name__, visit)
        if depart:
            setattr(translator, 'depart_'+node.__name__, depart)
738246
def add_node(self, node):
        
        if node.id in self.nodes:
            del self.nodes[node.id]
            self.nodes[node.id] = node
        elif len(self) < self.ksize:
            self.nodes[node.id] = node
        else:
            if node.id in self.replacement_nodes:
                del self.replacement_nodes[node.id]
            self.replacement_nodes[node.id] = node
            return False
        return True