Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 72D1A200C57 for ; Sat, 1 Apr 2017 02:49:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6E4BD160B8C; Sat, 1 Apr 2017 00:49:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B42AF160B9F for ; Sat, 1 Apr 2017 02:49:01 +0200 (CEST) Received: (qmail 99292 invoked by uid 500); 1 Apr 2017 00:49:01 -0000 Mailing-List: contact notifications-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list notifications@libcloud.apache.org Received: (qmail 99240 invoked by uid 500); 1 Apr 2017 00:49:00 -0000 Delivered-To: apmail-libcloud-commits@libcloud.apache.org Received: (qmail 99230 invoked by uid 99); 1 Apr 2017 00:49:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Apr 2017 00:49:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A5FACDFE5C; Sat, 1 Apr 2017 00:49:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anthonyshaw@apache.org To: commits@libcloud.apache.org Date: Sat, 01 Apr 2017 00:49:01 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/4] libcloud git commit: add a few missing functions and fix state archived-at: Sat, 01 Apr 2017 00:49:02 -0000 add a few missing functions and fix state Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f90a2516 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f90a2516 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f90a2516 Branch: refs/heads/trunk Commit: f90a251671a5231e806c9ac4da02cc1e12deafa2 Parents: 53591b7 Author: Markos Gogoulos Authored: Wed Feb 15 17:40:50 2017 +0200 Committer: Anthony Shaw Committed: Sat Apr 1 11:47:22 2017 +1100 ---------------------------------------------------------------------- libcloud/compute/drivers/linode.py | 41 ++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f90a2516/libcloud/compute/drivers/linode.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/linode.py b/libcloud/compute/drivers/linode.py index e24e367..94ac2a0 100644 --- a/libcloud/compute/drivers/linode.py +++ b/libcloud/compute/drivers/linode.py @@ -97,7 +97,7 @@ class LinodeNodeDriver(NodeDriver): (-1): NodeState.PENDING, # Being Created 0: NodeState.PENDING, # Brand New 1: NodeState.RUNNING, # Running - 2: NodeState.TERMINATED, # Powered Off + 2: NodeState.STOPPED, # Powered Off 3: NodeState.REBOOTING, # Shutting Down 4: NodeState.UNKNOWN # Reserved } @@ -118,6 +118,15 @@ class LinodeNodeDriver(NodeDriver): data = self.connection.request(API_ROOT, params=params).objects[0] return self._to_nodes(data) + def ex_start_node(self, node): + """ + Boot the given Linode + + """ + params = {"api_action": "linode.boot", "LinodeID": node.id} + self.connection.request(API_ROOT, params=params) + return True + def reboot_node(self, node): """ Reboot the given Linode @@ -364,6 +373,10 @@ class LinodeNodeDriver(NodeDriver): "Comments": comments, "DiskList": disks } + if "ex_private" in kwargs and kwargs["ex_private"]: + params['helper_network'] = True + params['helper_distro'] = True + data = self.connection.request(API_ROOT, params=params).objects[0] linode["config"] = data["ConfigID"] @@ -388,6 +401,32 @@ class LinodeNodeDriver(NodeDriver): return None + def ex_resize_node(self, node, size): + """Resizes a Linode from one plan to another + + Immediately shuts the Linode down, charges/credits the account, + and issue a migration to another host server. + Requires a size (numeric), which is the desired PlanID available from + avail.LinodePlans() + After resize is complete the node needs to be booted + """ + + params = {"api_action": "linode.resize", "LinodeID": node.id, + "PlanID": size} + self.connection.request(API_ROOT, params=params) + return True + + def ex_rename_node(self, node, name): + """Renames a node""" + + params = { + "api_action": "linode.update", + "LinodeID": node.id, + "Label": name + } + data = self.connection.request(API_ROOT, params=params) + return True + def list_sizes(self, location=None): """ List available Linode plans