libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [2/4] libcloud git commit: add a few missing functions and fix state
Date Sat, 01 Apr 2017 00:49:01 GMT
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 <mgogoulos@mist.io>
Authored: Wed Feb 15 17:40:50 2017 +0200
Committer: Anthony Shaw <anthonyshaw@apache.org>
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


Mime
View raw message