libcloud/compute/drivers/dimensiondata.py [1135:1210]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            r = self.ex_get_node_by_id(node.id)
            response_code = r.state.upper()

        return response_code in ["IN_PROGRESS", "OK", "STOPPED", "STOPPING"]

    def ex_reset(self, node):
        """
        This function will abruptly reset a server.  Unlike
        reboot_node, success ensures the node will restart but some OS
        and application configurations may be adversely affected by the
        equivalent of pulling the power plug out of the machine.

        :param      node: Node which should be used
        :type       node: :class:`Node`

        :rtype: ``bool``
        """
        request_elm = ET.Element("resetServer", {"xmlns": TYPES_URN, "id": node.id})
        body = self.connection.request_with_orgId_api_2(
            "server/resetServer", method="POST", data=ET.tostring(request_elm)
        ).object
        response_code = findtext(body, "responseCode", TYPES_URN)
        return response_code in ["IN_PROGRESS", "OK"]

    def ex_update_vm_tools(self, node):
        """
        This function triggers an update of the VMware Tools
        software running on the guest OS of a Server.

        :param      node: Node which should be used
        :type       node: :class:`Node`

        :rtype: ``bool``
        """
        request_elm = ET.Element("updateVmwareTools", {"xmlns": TYPES_URN, "id": node.id})
        body = self.connection.request_with_orgId_api_2(
            "server/updateVmwareTools", method="POST", data=ET.tostring(request_elm)
        ).object
        response_code = findtext(body, "responseCode", TYPES_URN)
        return response_code in ["IN_PROGRESS", "OK"]

    def ex_update_node(self, node, name=None, description=None, cpu_count=None, ram_mb=None):
        """
        Update the node, the name, CPU or RAM

        :param      node: Node which should be used
        :type       node: :class:`Node`

        :param      name: The new name (optional)
        :type       name: ``str``

        :param      description: The new description (optional)
        :type       description: ``str``

        :param      cpu_count: The new CPU count (optional)
        :type       cpu_count: ``int``

        :param      ram_mb: The new Memory in MB (optional)
        :type       ram_mb: ``int``

        :rtype: ``bool``
        """
        data = {}
        if name is not None:
            data["name"] = name
        if description is not None:
            data["description"] = description
        if cpu_count is not None:
            data["cpuCount"] = str(cpu_count)
        if ram_mb is not None:
            data["memory"] = str(ram_mb)
        body = self.connection.request_with_orgId_api_1(
            "server/%s" % (node.id), method="POST", data=urlencode(data, True)
        ).object
        response_code = findtext(body, "result", GENERAL_NS)
        return response_code in ["IN_PROGRESS", "SUCCESS"]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



libcloud/compute/drivers/nttcis.py [1244:1329]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            r = self.ex_get_node_by_id(node.id)
            response_code = r.state.upper()

        return response_code in ["IN_PROGRESS", "OK", "STOPPED", "STOPPING"]

    def ex_reset(self, node):
        """
        This function will abruptly reset a server.  Unlike
        reboot_node, success ensures the node will restart but some OS
        and application configurations may be adversely affected by the
        equivalent of pulling the power plug out of the machine.

        :param      node: Node which should be used
        :type       node: :class:`Node`

        :rtype: ``bool``
        """

        request_elm = ET.Element("resetServer", {"xmlns": TYPES_URN, "id": node.id})
        body = self.connection.request_with_orgId_api_2(
            "server/resetServer", method="POST", data=ET.tostring(request_elm)
        ).object
        response_code = findtext(body, "responseCode", TYPES_URN)

        return response_code in ["IN_PROGRESS", "OK"]

    def ex_update_vm_tools(self, node):
        """
        This function triggers an update of the VMware Tools
        software running on the guest OS of a Server.

        :param      node: Node which should be used
        :type       node: :class:`Node`

        :rtype: ``bool``
        """

        request_elm = ET.Element("updateVmwareTools", {"xmlns": TYPES_URN, "id": node.id})
        body = self.connection.request_with_orgId_api_2(
            "server/updateVmwareTools", method="POST", data=ET.tostring(request_elm)
        ).object
        response_code = findtext(body, "responseCode", TYPES_URN)

        return response_code in ["IN_PROGRESS", "OK"]

    def ex_update_node(self, node, name=None, description=None, cpu_count=None, ram_mb=None):
        """
        Update the node, the name, CPU or RAM

        :param      node: Node which should be used
        :type       node: :class:`Node`

        :param      name: The new name (optional)
        :type       name: ``str``

        :param      description: The new description (optional)
        :type       description: ``str``

        :param      cpu_count: The new CPU count (optional)
        :type       cpu_count: ``int``

        :param      ram_mb: The new Memory in MB (optional)
        :type       ram_mb: ``int``

        :rtype: ``bool``
        """

        data = {}

        if name is not None:
            data["name"] = name

        if description is not None:
            data["description"] = description

        if cpu_count is not None:
            data["cpuCount"] = str(cpu_count)

        if ram_mb is not None:
            data["memory"] = str(ram_mb)
        body = self.connection.request_with_orgId_api_1(
            "server/%s" % (node.id), method="POST", data=urlencode(data, True)
        ).object
        response_code = findtext(body, "result", GENERAL_NS)

        return response_code in ["IN_PROGRESS", "SUCCESS"]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



