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/04/13 04:55:55 UTC
[1/2] libcloud git commit: Added ability to define OS disk size for
Azure ARM compute
Repository: libcloud
Updated Branches:
refs/heads/trunk 9df384348 -> 694b02161
Added ability to define OS disk size for Azure ARM compute
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/67cd2d5e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/67cd2d5e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/67cd2d5e
Branch: refs/heads/trunk
Commit: 67cd2d5ecf657d7d691cdf002b454695c4a12b04
Parents: 9df3843
Author: Vojta Bartoš <hi...@vojtech.me>
Authored: Thu Apr 5 15:42:34 2018 +0200
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Apr 13 08:49:53 2018 +0400
----------------------------------------------------------------------
libcloud/compute/drivers/azure_arm.py | 9 ++++++
libcloud/test/compute/test_azure_arm.py | 42 ++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/67cd2d5e/libcloud/compute/drivers/azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py
index 1d9da01..edac4bb 100644
--- a/libcloud/compute/drivers/azure_arm.py
+++ b/libcloud/compute/drivers/azure_arm.py
@@ -415,6 +415,7 @@ class AzureNodeDriver(NodeDriver):
ex_tags={},
ex_customdata="",
ex_use_managed_disks=False,
+ ex_disk_size=None,
ex_storage_account_type="Standard_LRS"):
"""Create a new node instance. This instance will be started
automatically.
@@ -513,6 +514,9 @@ class AzureNodeDriver(NodeDriver):
in all regions (default False).
:type ex_use_managed_disks: ``bool``
+ :param ex_disk_size: Custom OS disk size in GB
+ :type ex_disk_size: ``int``
+
:param ex_storage_account_type: The Storage Account type,
``Standard_LRS``(HDD disks) or ``Premium_LRS``(SSD disks).
:type ex_storage_account_type: str
@@ -626,6 +630,11 @@ class AzureNodeDriver(NodeDriver):
}
}
+ if ex_disk_size:
+ data['properties']['storageProfile']['osDisk'].update({
+ 'diskSizeGB': ex_disk_size
+ })
+
if ex_customdata:
data["properties"]["osProfile"]["customData"] = \
base64.b64encode(ex_customdata)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/67cd2d5e/libcloud/test/compute/test_azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py
index 29ba98e..68dd1ce 100644
--- a/libcloud/test/compute/test_azure_arm.py
+++ b/libcloud/test/compute/test_azure_arm.py
@@ -124,6 +124,48 @@ class AzureNodeDriverTests(LibcloudTestCase):
self.assertEqual(os_profile['adminUsername'], 'any_user')
self.assertEqual(os_profile['adminPassword'], 'any_password')
self.assertTrue('managedDisk' in storage_profile['osDisk'])
+ self.assertTrue('diskSizeGB' not in storage_profile['osDisk'])
+ self.assertTrue(storage_profile['imageReference'], {
+ 'publisher': image.publisher,
+ 'offer': image.offer,
+ 'sku': image.sku,
+ 'version': image.version
+ })
+
+ def test_create_node_ex_disk_size(self):
+ location = NodeLocation('any_location', '', '', self.driver)
+ size = NodeSize('any_size', '', 0, 0, 0, 0, driver=self.driver)
+ image = AzureImage('1', '1', 'ubuntu', 'pub', location.id, self.driver)
+ auth = NodeAuthPassword('any_password')
+
+ node = self.driver.create_node(
+ 'test-node-1',
+ size,
+ image,
+ auth,
+ location=location,
+ ex_resource_group='000000',
+ ex_storage_account='000000',
+ ex_user_name='any_user',
+ ex_network='000000',
+ ex_subnet='000000',
+ ex_disk_size=100,
+ ex_use_managed_disks=True
+ )
+ hardware_profile = node.extra['properties']['hardwareProfile']
+ os_profile = node.extra['properties']['osProfile']
+ storage_profile = node.extra['properties']['storageProfile']
+
+ self.assertEqual(node.name, 'test-node-1')
+ self.assertEqual(node.state, NodeState.UPDATING)
+ self.assertEqual(node.private_ips, ['10.0.0.1'])
+ self.assertEqual(node.public_ips, [])
+ self.assertEqual(node.extra['location'], location.id)
+ self.assertEqual(hardware_profile['vmSize'], size.id)
+ self.assertEqual(os_profile['adminUsername'], 'any_user')
+ self.assertEqual(os_profile['adminPassword'], 'any_password')
+ self.assertTrue('managedDisk' in storage_profile['osDisk'])
+ self.assertEqual(storage_profile['osDisk']['diskSizeGB'], 100)
self.assertTrue(storage_profile['imageReference'], {
'publisher': image.publisher,
'offer': image.offer,
[2/2] libcloud git commit: Add changes for #1196
Posted by qu...@apache.org.
Add changes for #1196
Closes #1196
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/694b0216
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/694b0216
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/694b0216
Branch: refs/heads/trunk
Commit: 694b02161166456257423d0f298804aa25087030
Parents: 67cd2d5
Author: Quentin Pradet <qu...@apache.org>
Authored: Fri Apr 13 08:52:49 2018 +0400
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Apr 13 08:52:49 2018 +0400
----------------------------------------------------------------------
CHANGES.rst | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/694b0216/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 5fdcb26..b73bbef 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,6 +11,9 @@ Changes in Apache Libcloud in development
Compute
~~~~~~~
+- [ARM] Support OS disk size definition on node creation (GITHUB-1196)
+ [Vojta Bartoš]
+
- [Digital Ocean] Support floating IPs (GITHUB-1177)
[Rick van de Loo]