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):
        """
        Create a new DimensionData node

        :keyword    name:   String with a name for this new node (required)
        :type       name:   ``str``

        :keyword    image:  OS Image to boot on node. (required)
        :type       image:  :class:`NodeImage` or ``str``

        :keyword    auth:   Initial authentication information for the
                            node. (If this is a customer LINUX
                            image auth will be ignored)
        :type       auth:   :class:`NodeAuthPassword` or ``str`` or ``None``

        :keyword    ex_description:  description for this node (required)
        :type       ex_description:  ``str``

        :keyword    ex_network:  Network to create the node within
                                 (required unless using ex_network_domain
                                 or ex_primary_ipv4)

        :type       ex_network: :class:`DimensionDataNetwork` or ``str``

        :keyword    ex_network_domain:  Network Domain to create the node
                                        (required unless using network
                                        or ex_primary_ipv4)
        :type       ex_network_domain: :class:`DimensionDataNetworkDomain`
                                        or ``str``

        :keyword    ex_primary_ipv4: Primary nics IPv4 Address
                                     MCP1: (required unless ex_network)
                                     MCP2: (required unless ex_vlan)
        :type       ex_primary_ipv4: ``str``

        :keyword    ex_vlan:  VLAN to create the node within
                              (required unless using network)
        :type       ex_vlan: :class:`DimensionDataVlan` or ``str``

        :keyword    ex_memory_gb:  The amount of memory in GB for the server
        :type       ex_memory_gb: ``int``

        :keyword    ex_cpu_specification: The spec of CPU to deploy (optional)
        :type       ex_cpu_specification:
            :class:`DimensionDataServerCpuSpecification`

        :keyword    ex_is_started:  Start server after creation? default
                                   true (required)
        :type       ex_is_started:  ``bool``

        :keyword    ex_additional_nics_vlan: (MCP2 Only) List of additional
                                              nics to add by vlan
        :type       ex_additional_nics_vlan: ``list`` of
            :class:`DimensionDataVlan` or ``list`` of ``str``

        :keyword    ex_additional_nics_ipv4: (MCP2 Only) List of additional
                                              nics to add by ipv4 address
        :type       ex_additional_nics_ipv4: ``list`` of ``str``

        :return: The newly created :class:`Node`.
        :rtype: :class:`Node`
        """
        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
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/dimensiondata.py/DimensionDataNodeDriver.create_node/original