You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by qu...@apache.org on 2018/03/16 15:15:44 UTC
[1/4] libcloud git commit: Added tests.
Repository: libcloud
Updated Branches:
refs/heads/trunk 0310ba9ed -> 68ba179d8
Added tests.
Signed-off-by: Quentin Pradet <qu...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4c638782
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4c638782
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4c638782
Branch: refs/heads/trunk
Commit: 4c638782c6c3f4d94ede6c1ff0c1fa6335e39ef8
Parents: 94db5c4
Author: Rahul Paigavan <ra...@cambridgesemantics.com>
Authored: Thu Jan 25 21:12:49 2018 +0530
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 09:00:05 2018 +0400
----------------------------------------------------------------------
libcloud/test/compute/fixtures/gce/aggregated_disks.json | 4 ++--
libcloud/test/compute/test_gce.py | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c638782/libcloud/test/compute/fixtures/gce/aggregated_disks.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/aggregated_disks.json b/libcloud/test/compute/fixtures/gce/aggregated_disks.json
index e884940..4103785 100644
--- a/libcloud/test/compute/fixtures/gce/aggregated_disks.json
+++ b/libcloud/test/compute/fixtures/gce/aggregated_disks.json
@@ -107,7 +107,7 @@
"description": "I'm a happy little persistent disk",
"type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-standard",
"selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/lcnode-000",
- "sizeGb": "10",
+ "sizeGb": "25",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20131120",
"sourceImageId": "17312518942796567789",
"status": "READY",
@@ -122,7 +122,7 @@
"description": "I'm a happy little persistent disk",
"type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-standard",
"selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/lcnode-001",
- "sizeGb": "10",
+ "sizeGb": "25",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20131120",
"sourceImageId": "17312518942796567791",
"status": "READY",
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c638782/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index 35aa4d8..3b5c5a6 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -1365,13 +1365,16 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
image = self.driver.ex_get_image('debian-7')
size = self.driver.ex_get_size('n1-standard-1')
number = 2
+ disk_size = "25"
nodes = self.driver.ex_create_multiple_nodes(base_name, size, image,
- number)
+ number, ex_disk_size=disk_size)
self.assertEqual(len(nodes), 2)
self.assertTrue(isinstance(nodes[0], Node))
self.assertTrue(isinstance(nodes[1], Node))
self.assertEqual(nodes[0].name, '%s-000' % base_name)
self.assertEqual(nodes[1].name, '%s-001' % base_name)
+ self.assertEqual(nodes[0].extra['boot_disk'].size, disk_size)
+ self.assertEqual(nodes[1].extra['boot_disk'].size, disk_size)
def test_ex_create_multiple_nodes_image_family(self):
base_name = 'lcnode'
[2/4] libcloud git commit: [LIBCLOUD-973] Support disk_size parameter
for boot disk while creating instances in ex_create_multiple_nodes API call.
Posted by qu...@apache.org.
[LIBCLOUD-973] Support disk_size parameter for boot disk while creating instances in ex_create_multiple_nodes API call.
Signed-off-by: Quentin Pradet <qu...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/94db5c45
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/94db5c45
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/94db5c45
Branch: refs/heads/trunk
Commit: 94db5c45db6cdf136afe83508a184dcadf54f0a2
Parents: 0310ba9
Author: Rahul Paigavan <ra...@cambridgesemantics.com>
Authored: Tue Jan 9 17:19:49 2018 +0530
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 09:00:05 2018 +0400
----------------------------------------------------------------------
libcloud/compute/drivers/gce.py | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94db5c45/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 3ecb3ca..fc2ee90 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -4233,7 +4233,7 @@ class GCENodeDriver(NodeDriver):
preemptible=None, tags=None, metadata=None,
description=None, disks_gce_struct=None, nic_gce_struct=None,
use_selflinks=True, labels=None, accelerator_type=None,
- accelerator_count=None):
+ accelerator_count=None, disk_size=None):
"""
Create the GCE instance properties needed for instance templates.
@@ -4360,6 +4360,9 @@ class GCENodeDriver(NodeDriver):
None.
:type accelerator_count: ``int`` or ``None``
+ :keyword disk_size: Specify size of the boot disk.
+ Integer in gigabytes.
+ :type disk_size: ``int`` or ``None``
:return: A dictionary formatted for use with the GCE API.
:rtype: ``dict``
@@ -4391,7 +4394,8 @@ class GCENodeDriver(NodeDriver):
device_name, source=source, disk_type=disk_type, image=image,
disk_name=disk_name, usage_type='PERSISTENT',
mount_mode='READ_WRITE', auto_delete=disk_auto_delete,
- is_boot=True, use_selflinks=use_selflinks)]
+ is_boot=True, use_selflinks=use_selflinks,
+ disk_size=disk_size)]
# build network interfaces
if nic_gce_struct is not None:
@@ -4513,9 +4517,10 @@ class GCENodeDriver(NodeDriver):
if not isinstance(auto_delete, bool):
raise ValueError("auto_delete field is not a bool.")
- if disk_size is not None and not disk_size.isdigit():
+ if disk_size is not None \
+ and(not isinstance(disk_size, int)and not disk_size.isdigit()):
raise ValueError("disk_size must be a digit, '%s' provided." %
- (disk_size))
+ str(disk_size))
mount_modes = ['READ_WRITE', 'READ_ONLY']
if mount_mode not in mount_modes:
@@ -4802,7 +4807,7 @@ class GCENodeDriver(NodeDriver):
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_preemptible=None, ex_labels=None):
+ ex_preemptible=None, ex_labels=None, ex_disk_size=None):
"""
Create multiple nodes and return a list of Node objects.
@@ -4945,6 +4950,10 @@ class GCENodeDriver(NodeDriver):
:param ex_labels: Label dict for node.
:type ex_labels: ``dict``
+ :keyword ex_disk_size: Defines size of the boot disk.
+ Integer in gigabytes.
+ :type ex_disk_size: ``int`` or ``None``
+
:return: A list of Node objects for the new nodes.
:rtype: ``list`` of :class:`Node`
@@ -4997,7 +5006,8 @@ class GCENodeDriver(NodeDriver):
'ex_on_host_maintenance': ex_on_host_maintenance,
'ex_automatic_restart': ex_automatic_restart,
'ex_preemptible': ex_preemptible,
- 'ex_labels': ex_labels}
+ 'ex_labels': ex_labels,
+ 'ex_disk_size': ex_disk_size}
# List for holding the status information for disk/node creation.
status_list = []
@@ -7922,7 +7932,8 @@ class GCENodeDriver(NodeDriver):
ex_disks_gce_struct=None, ex_nic_gce_struct=None,
ex_on_host_maintenance=None, ex_automatic_restart=None,
ex_preemptible=None, ex_subnetwork=None, ex_labels=None,
- ex_accelerator_type=None, ex_accelerator_count=None):
+ ex_accelerator_type=None, ex_accelerator_count=None,
+ ex_disk_size=None):
"""
Returns a request and body to create a new node.
@@ -8040,6 +8051,10 @@ class GCENodeDriver(NodeDriver):
:param ex_subnetwork: The network to associate with the node.
:type ex_subnetwork: :class:`GCESubnetwork`
+ :keyword ex_disk_size: Specify the size of boot disk.
+ Integer in gigabytes.
+ :type ex_disk_size: ``int`` or ``None``
+
:param ex_labels: Label dict for node.
:type ex_labels: ``dict`` or ``None``
@@ -8083,7 +8098,7 @@ class GCENodeDriver(NodeDriver):
nic_gce_struct=ex_nic_gce_struct,
accelerator_type=ex_accelerator_type,
accelerator_count=ex_accelerator_count,
- use_selflinks=use_selflinks)
+ use_selflinks=use_selflinks, disk_size=ex_disk_size)
node_data['name'] = name
request = '/zones/%s/instances' % (location.name)
@@ -8188,7 +8203,8 @@ class GCENodeDriver(NodeDriver):
ex_automatic_restart=node_attrs['ex_automatic_restart'],
ex_subnetwork=node_attrs['subnetwork'],
ex_preemptible=node_attrs['ex_preemptible'],
- ex_labels=node_attrs['ex_labels']
+ ex_labels=node_attrs['ex_labels'],
+ ex_disk_size=node_attrs['ex_disk_size']
)
try:
[4/4] libcloud git commit: Add changes for #1162
Posted by qu...@apache.org.
Add changes for #1162
Closes #1162.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/68ba179d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/68ba179d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/68ba179d
Branch: refs/heads/trunk
Commit: 68ba179d890eb4bfa3ae43efc160d2f6690a3195
Parents: 115caf6
Author: Quentin Pradet <qu...@apache.org>
Authored: Fri Mar 16 19:14:55 2018 +0400
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:14:55 2018 +0400
----------------------------------------------------------------------
CHANGES.rst | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/68ba179d/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 7c0cddc..945780e 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -25,6 +25,10 @@ Compute
- [GCE] Allow shared VPC in managed instance group creation (GITHUB-1179)
[Boris Chazalet]
+- [GCE] Support disk_size parameter for boot disk when creating instance
+ (LIBCLOUD-973, GITHUB-1162)
+ [Rahul Paigavan]
+
- [OpenStack] Implement Glance Image API v2 (GITHUB-1151)
[Rick van de Loo]
[3/4] libcloud git commit: gce: Fix conditional formatting
Posted by qu...@apache.org.
gce: Fix conditional formatting
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/115caf6b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/115caf6b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/115caf6b
Branch: refs/heads/trunk
Commit: 115caf6b3f67b6f65a4f571b719aa9b0d85f00f8
Parents: 4c63878
Author: Quentin Pradet <qu...@apache.org>
Authored: Fri Mar 16 14:42:35 2018 +0400
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 14:42:35 2018 +0400
----------------------------------------------------------------------
libcloud/compute/drivers/gce.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/115caf6b/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index fc2ee90..0594587 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -4517,8 +4517,8 @@ class GCENodeDriver(NodeDriver):
if not isinstance(auto_delete, bool):
raise ValueError("auto_delete field is not a bool.")
- if disk_size is not None \
- and(not isinstance(disk_size, int)and not disk_size.isdigit()):
+ if (disk_size is not None and
+ not (isinstance(disk_size, int) or disk_size.isdigit())):
raise ValueError("disk_size must be a digit, '%s' provided." %
str(disk_size))