libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/2] git commit: Add ex_clone_node method to vSphere driver.
Date Wed, 30 Jul 2014 22:30:17 GMT
Add ex_clone_node method to vSphere driver.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/106846bf
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/106846bf
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/106846bf

Branch: refs/heads/trunk
Commit: 106846bf67ce8ccb04befdeaf90408b425852c18
Parents: abdde15
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Thu Jul 31 00:29:44 2014 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Thu Jul 31 00:29:44 2014 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/vsphere.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/106846bf/libcloud/compute/drivers/vsphere.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/vsphere.py b/libcloud/compute/drivers/vsphere.py
index 31086e5..da40ba9 100644
--- a/libcloud/compute/drivers/vsphere.py
+++ b/libcloud/compute/drivers/vsphere.py
@@ -175,6 +175,33 @@ class VSphereNodeDriver(NodeDriver):
         return nodes
 
     @wrap_non_libcloud_exceptions
+    def ex_clone_node(self, node, name, power_on=True, template=False):
+        """
+        Clone the provided node.
+
+        :param node: Node to clone.
+        :type node: :class:`Node`
+
+        :param name: Name of the new node.
+        :type name: ``str``
+
+        :param power_on: Power the new node on after being created.
+        :type power_on: ``bool``
+
+        :param template: Specifies whether or not the new virtual machine
+                         should be marked as a template.
+        :type template: ``bool``
+
+        :return: New node.
+        :rtype: :class:`Node`
+        """
+        vm = self._get_vm_for_node(node=node)
+        new_vm = vm.clone(name=name, power_on=power_on, template=template)
+        new_node = self._to_node(vm=new_vm)
+
+        return new_node
+
+    @wrap_non_libcloud_exceptions
     def reboot_node(self, node):
         vm = self._get_vm_for_node(node=node)
         vm.reset()


Mime
View raw message