You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/08/29 12:16:55 UTC

libcloud git commit: Adding ex_virtual_network_name and ex_network_config to create_node

Repository: libcloud
Updated Branches:
  refs/heads/trunk 06070a58d -> 06df217df


Adding ex_virtual_network_name and ex_network_config to create_node

Closes #569

Signed-off-by: Tomaz Muraus <to...@apache.org>


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

Branch: refs/heads/trunk
Commit: 06df217df22d111f506b3ee0e900f207ab69964a
Parents: 06070a5
Author: Jesaja Everling <je...@gl-systemhaus.de>
Authored: Tue Jul 7 20:35:36 2015 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Aug 29 12:07:52 2015 +0200

----------------------------------------------------------------------
 CHANGES.rst                       |  6 ++++++
 libcloud/compute/drivers/azure.py | 19 ++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/06df217d/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 3bbfcdc..293d791 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -28,6 +28,12 @@ Compute
   (LIBCLOUD-736, GITHUB-564)
   [Anthony Shaw]
 
+- Add new ``ex_virtual_network_name`` and ``ex_network_config`` argument to the
+  `create_node`` method in the Azure driver. With those arguments user can now
+  specify which virtual network to use.
+  (GITHUB-569)
+  [Jesaja Everling]
+
 DNS
 ~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/06df217d/libcloud/compute/drivers/azure.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure.py b/libcloud/compute/drivers/azure.py
index b392552..1ca5d16 100644
--- a/libcloud/compute/drivers/azure.py
+++ b/libcloud/compute/drivers/azure.py
@@ -363,7 +363,7 @@ class AzureNodeDriver(NodeDriver):
         """
         sizes = []
 
-        for key, values in self._instance_types.items():
+        for _, values in self._instance_types.items():
             node_size = self._to_node_size(copy.deepcopy(values))
             sizes.append(node_size)
 
@@ -517,6 +517,7 @@ class AzureNodeDriver(NodeDriver):
                     ex_storage_service_name=None, ex_new_deployment=False,
                     ex_deployment_slot="Production", ex_deployment_name=None,
                     ex_admin_user_id="azureuser", ex_custom_data=None,
+                    ex_virtual_network_name=None, ex_network_config=None,
                     auth=None, **kwargs):
         """
         Create Azure Virtual Machine
@@ -578,6 +579,15 @@ class AzureNodeDriver(NodeDriver):
 
         :keyword     ex_admin_user_id: Optional. Defaults to 'azureuser'.
         :type        ex_admin_user_id:  ``str``
+
+        :keyword     ex_virtual_network_name: Optional. If this is not passed
+                                              in no virtual network is used.
+        :type        ex_virtual_network_name:  ``str``
+
+        :keyword     ex_network_config: Optional. The ConfigurationSet to use
+                                        for network configuration
+        :type        ex_network_config:  `ConfigurationSet`
+
         """
         # TODO: Refactor this method to make it more readable, split it into
         # multiple smaller methods
@@ -599,7 +609,10 @@ class AzureNodeDriver(NodeDriver):
             ex_cloud_service_name=ex_cloud_service_name
         )
 
-        network_config = ConfigurationSet()
+        if ex_network_config is None:
+            network_config = ConfigurationSet()
+        else:
+            network_config = ex_network_config
         network_config.configuration_set_type = 'NetworkConfiguration'
 
         # Base64 encode custom data if provided
@@ -747,7 +760,7 @@ class AzureNodeDriver(NodeDriver):
                     None,
                     None,
                     size.id,
-                    None,
+                    ex_virtual_network_name,
                     vm_image_id
                 )
             )