public void PutNode(NodeDescriptor node) { // Configure a node // enable/disable the node // disabling a node with running instances is allowed // set the port pool // adding or removing ports that are already associated with running or deployed instances is allowed // set the max instances // setting max instances to a value less than the number of currently deployed instances is allowed lock (_syncHandle) { var currentNode = _nodes.Nodes[node.HostName]; if (currentNode == null) { currentNode = node.Copy(); if (currentNode.IsEnabled) { _activeNodes.Add(currentNode); } _nodes.Nodes[node.HostName] = currentNode; } else { if (currentNode.IsEnabled && !node.IsEnabled) { _activeNodes.Remove(currentNode); } currentNode.CopyFrom(node); } _nodes.Save(); } }