From 3f7a8ce9d07292687917a96ad71aec5c0f97543f Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Wed, 9 Nov 2016 12:21:49 -0500 Subject: [PATCH 1/3] Allow multiple preemptible instances to be created --- libcloud/compute/drivers/gce.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index e0d5ea0105..bc09ef66bc 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -4446,7 +4446,8 @@ def ex_create_multiple_nodes( ex_service_accounts=None, timeout=DEFAULT_TASK_COMPLETION_TIMEOUT, description=None, ex_can_ip_forward=None, ex_disks_gce_struct=None, ex_nic_gce_struct=None, ex_on_host_maintenance=None, - ex_automatic_restart=None, ex_image_family=None): + ex_automatic_restart=None, ex_image_family=None, + ex_preemptible=None): """ Create multiple nodes and return a list of Node objects. @@ -4579,6 +4580,12 @@ def ex_create_multiple_nodes( :return: A list of Node objects for the new nodes. :rtype: ``list`` of :class:`Node` + + :keyword ex_preemptible: Defines whether the instance is preemptible. + (If not supplied, the instance will + not be preemptible) + :type ex_preemptible: ``bool`` or ``None`` + """ if image and ex_disks_gce_struct: raise ValueError("Cannot specify both 'image' and " @@ -4625,7 +4632,8 @@ def ex_create_multiple_nodes( 'ex_disks_gce_struct': ex_disks_gce_struct, 'ex_nic_gce_struct': ex_nic_gce_struct, 'ex_on_host_maintenance': ex_on_host_maintenance, - 'ex_automatic_restart': ex_automatic_restart} + 'ex_automatic_restart': ex_automatic_restart, + 'ex_preemptible': ex_preemptible} # List for holding the status information for disk/node creation. status_list = [] @@ -7636,7 +7644,8 @@ def _multi_create_node(self, status, node_attrs): ex_nic_gce_struct=node_attrs['ex_nic_gce_struct'], ex_on_host_maintenance=node_attrs['ex_on_host_maintenance'], ex_automatic_restart=node_attrs['ex_automatic_restart'], - ex_subnetwork=node_attrs['subnetwork']) + ex_subnetwork=node_attrs['subnetwork'], + ex_preemptible=node_attrs['ex_preemptible']) try: node_res = self.connection.request(request, method='POST', From e8d08aa2e7f69f2aa96da60151789828a2d02c83 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Tue, 29 Nov 2016 11:00:18 -0500 Subject: [PATCH 2/3] Fix for documentation --- libcloud/compute/drivers/gce.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index bc09ef66bc..8261c1114b 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -4537,6 +4537,11 @@ def ex_create_multiple_nodes( send/receive non-matching src/dst packets. :type ex_can_ip_forward: ``bool`` or ``None`` + :keyword ex_preemptible: Defines whether the instance is preemptible. + (If not supplied, the instance will + not be preemptible) + :type ex_preemptible: ``bool`` or ``None`` + :keyword ex_disks_gce_struct: Support for passing in the GCE-specific formatted disks[] structure. No attempt is made to ensure proper formatting of @@ -4581,11 +4586,6 @@ def ex_create_multiple_nodes( :return: A list of Node objects for the new nodes. :rtype: ``list`` of :class:`Node` - :keyword ex_preemptible: Defines whether the instance is preemptible. - (If not supplied, the instance will - not be preemptible) - :type ex_preemptible: ``bool`` or ``None`` - """ if image and ex_disks_gce_struct: raise ValueError("Cannot specify both 'image' and " From dbb20ce653c2f70b5a9c5f1f39a2de5eaa9e0257 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Tue, 29 Nov 2016 11:42:27 -0500 Subject: [PATCH 3/3] Fix identation problems in docs --- libcloud/compute/drivers/gce.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index 8261c1114b..08df9f6cc4 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -4534,12 +4534,12 @@ def ex_create_multiple_nodes( :type description: ``str`` or ``None`` :keyword ex_can_ip_forward: Set to ``True`` to allow this node to - send/receive non-matching src/dst packets. + send/receive non-matching src/dst packets. :type ex_can_ip_forward: ``bool`` or ``None`` :keyword ex_preemptible: Defines whether the instance is preemptible. - (If not supplied, the instance will - not be preemptible) + (If not supplied, the instance will + not be preemptible) :type ex_preemptible: ``bool`` or ``None`` :keyword ex_disks_gce_struct: Support for passing in the GCE-specific