def create_node(self, name, image, auth, ex_description,
                    ex_network=None, ex_network_domain=None,
                    ex_vlan=None, ex_primary_ipv4=None,
                    ex_memory_gb=None,
                    ex_cpu_specification=None,
                    ex_is_started=True, ex_additional_nics_vlan=None,
                    ex_additional_nics_ipv4=None, **kwargs):
        password = None
        image_needs_auth = self._image_needs_auth(image)
        if image_needs_auth:
            if isinstance(auth, basestring):
                auth_obj = NodeAuthPassword(password=auth)
                password = auth
            else:
                auth_obj = self._get_and_check_auth(auth)
                password = auth_obj.password

        if (ex_network_domain is None and
                ex_network is None and
                ex_primary_ipv4 is None):
            raise ValueError("One of ex_network_domain, ex_network, "
                             "or ex_ipv6_primary must be specified")

        server_elm = ET.Element('deployServer', {'xmlns': TYPES_URN})
        ET.SubElement(server_elm, "name").text = name
        ET.SubElement(server_elm, "description").text = ex_description
        image_id = self._image_to_image_id(image)
        ET.SubElement(server_elm, "imageId").text = image_id
        ET.SubElement(server_elm, "start").text = str(ex_is_started).lower()
        if password is not None:
            ET.SubElement(server_elm, "administratorPassword").text = password

        if ex_cpu_specification is not None:
            cpu = ET.SubElement(server_elm, "cpu")
            cpu.set('speed', ex_cpu_specification.performance)
            cpu.set('count', str(ex_cpu_specification.cpu_count))
            cpu.set('coresPerSocket',
                    str(ex_cpu_specification.cores_per_socket))

        if ex_memory_gb is not None:
            ET.SubElement(server_elm, "memoryGb").text = str(ex_memory_gb)

        if ex_network is not None:
            network_elm = ET.SubElement(server_elm, "network")
            network_id = self._network_to_network_id(ex_network)
            ET.SubElement(network_elm, "networkId").text = network_id
        elif ex_network_domain is None and ex_primary_ipv4 is not None:
            network_elm = ET.SubElement(server_elm, "network")
            ET.SubElement(network_elm, "privateIpv4").text = ex_primary_ipv4
        elif ex_network_domain is not None:
            net_domain_id = self._network_domain_to_network_domain_id(
                ex_network_domain)
            network_inf_elm = ET.SubElement(
                server_elm, "networkInfo",
                {'networkDomainId': net_domain_id}
            )

            if ex_vlan is not None:
                vlan_id = self._vlan_to_vlan_id(ex_vlan)
                pri_nic = ET.SubElement(network_inf_elm, "primaryNic")
                ET.SubElement(pri_nic, "vlanId").text = vlan_id
            elif ex_primary_ipv4 is not None:
                pri_nic = ET.SubElement(network_inf_elm, "primaryNic")
                ET.SubElement(pri_nic, "privateIpv4").text = ex_primary_ipv4
            else:
                raise ValueError("One of ex_vlan or ex_primary_ipv4 "
                                 "must be specified")

            if isinstance(ex_additional_nics_ipv4, (list, tuple)):
                for ipv4_nic in ex_additional_nics_ipv4:
                    add_nic = ET.SubElement(network_inf_elm, "additionalNic")
                    ET.SubElement(add_nic, "privateIpv4").text = ipv4_nic
            elif ex_additional_nics_ipv4 is not None:
                raise TypeError("ex_additional_nics_ipv4 must "
                                "be None or a tuple/list")

            if isinstance(ex_additional_nics_vlan, (list, tuple)):
                for vlan_nic in ex_additional_nics_vlan:
                    add_nic = ET.SubElement(network_inf_elm, "additionalNic")
                    ET.SubElement(add_nic, "vlanId").text = vlan_nic
            elif ex_additional_nics_vlan is not None:
                raise TypeError("ex_additional_nics_vlan"
                                "must be None or tuple/list")

        response = self.connection.request_with_orgId_api_2(
            'server/deployServer',
            method='POST',
            data=ET.tostring(server_elm)).object

        node_id = None
        for info in findall(response, 'info', TYPES_URN):
            if info.get('name') == 'serverId':
                node_id = info.get('value')

        node = self.ex_get_node_by_id(node_id)

        if image_needs_auth:
            if getattr(auth_obj, "generated", False):
                node.extra['password'] = auth_obj.password

        return node
Create a new DimensionData node
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/dimensiondata.py/DimensionDataNodeDriver.create_node