[GitHub] libcloud pull request #1088: Fix Linode DNS records to have 'priority' in ex...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1088 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[1/2] libcloud git commit: Fix Linode DNS records to have 'priority' in extra
Repository: libcloud Updated Branches: refs/heads/trunk c7e81a5f6 -> 95b087fd4 Fix Linode DNS records to have 'priority' in extra 'priority' extra field is being used in DNSDriver._get_bind_record_line() for export_zone_to_bind_format() Closes #1088 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0490cde9 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0490cde9 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0490cde9 Branch: refs/heads/trunk Commit: 0490cde9b2eee44683ad51ba6d9bf8e515ae4736 Parents: c7e81a5 Author: mete0rAuthored: Tue Aug 8 01:52:45 2017 +0900 Committer: Anthony Shaw Committed: Fri Aug 11 15:19:22 2017 +1000 -- libcloud/dns/drivers/linode.py | 3 ++- libcloud/test/dns/test_linode.py | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/0490cde9/libcloud/dns/drivers/linode.py -- diff --git a/libcloud/dns/drivers/linode.py b/libcloud/dns/drivers/linode.py index 5d497ed..2089d4c 100644 --- a/libcloud/dns/drivers/linode.py +++ b/libcloud/dns/drivers/linode.py @@ -265,7 +265,8 @@ class LinodeDNSDriver(DNSDriver): Build a Record object from the item dictionary. """ extra = {'protocol': item['PROTOCOL'], 'ttl_sec': item['TTL_SEC'], - 'port': item['PORT'], 'weight': item['WEIGHT']} + 'port': item['PORT'], 'weight': item['WEIGHT'], + 'priority': item['PRIORITY']} type = self._string_to_record_type(item['TYPE']) record = Record(id=item['RESOURCEID'], name=item['NAME'], type=type, data=item['TARGET'], zone=zone, driver=self, http://git-wip-us.apache.org/repos/asf/libcloud/blob/0490cde9/libcloud/test/dns/test_linode.py -- diff --git a/libcloud/test/dns/test_linode.py b/libcloud/test/dns/test_linode.py index d197c1d..72da66c 100644 --- a/libcloud/test/dns/test_linode.py +++ b/libcloud/test/dns/test_linode.py @@ -68,6 +68,15 @@ class LinodeTests(unittest.TestCase): self.assertHasKeys(arecord.extra, ['protocol', 'ttl_sec', 'port', 'weight']) +srvrecord = records[1] +self.assertEquals(srvrecord.id, '3585141') +self.assertEquals(srvrecord.name, '_minecraft._udp') +self.assertEquals(srvrecord.type, RecordType.SRV) +self.assertEquals(srvrecord.data, 'mc.linode.com') +self.assertHasKeys(srvrecord.extra, ['protocol', 'ttl_sec', 'port', + 'priority', 'weight']) + + def test_list_records_zone_does_not_exist(self): zone = self.driver.list_zones()[0]
[2/2] libcloud git commit: changes for #1088
changes for #1088 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/95b087fd Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/95b087fd Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/95b087fd Branch: refs/heads/trunk Commit: 95b087fd401263b058ecafa6530b02c3f9a7248e Parents: 0490cde Author: Anthony ShawAuthored: Fri Aug 11 15:20:42 2017 +1000 Committer: Anthony Shaw Committed: Fri Aug 11 15:20:42 2017 +1000 -- CHANGES.rst | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/95b087fd/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index 14c28fa..6a1475b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -29,6 +29,13 @@ Container [GITHUB-1067] (johnnyWalnut) +DNS +~~~ + +- [LINODE] Add priority to the extra dictionary in record instances + [GITHUB-1088] + (@mete0r) + Storage ~~~
[10/20] libcloud git commit: FAM-690 Disk size fix
FAM-690 Disk size fix Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c0c6e561 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c0c6e561 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c0c6e561 Branch: refs/heads/trunk Commit: c0c6e56190f4286a1ea85f96e4d8c9449bc78a3c Parents: 4ab938a Author: mermoldyAuthored: Fri Mar 10 15:41:50 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c0c6e561/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index b85eb77..cc5f370 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -1105,7 +1105,9 @@ class AzureNodeDriver(NodeDriver): volume_name = volume_obj.get('name') extra = dict(volume_obj) properties = extra['properties'] -size = int(properties['diskSizeGB']) +size = properties.get('diskSizeGB') +if size is not None: +size = int(size) provisioning_state = properties.get('provisioningState', '').lower() disk_state = properties.get('diskState', '').lower()
[08/20] libcloud git commit: FAM-690 WIP
FAM-690 WIP Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c2343ad2 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c2343ad2 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c2343ad2 Branch: refs/heads/trunk Commit: c2343ad245d950f55df947bf28318b0ebc0cfe23 Parents: cbf1d5a Author: mermoldyAuthored: Thu Mar 2 23:31:56 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c2343ad2/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 632d9a7..d2f3c37 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -1118,7 +1118,7 @@ class AzureNodeDriver(NodeDriver): u'/providers/Microsoft.Compute/disks/{volume_name}' ).format( subscription_id=self.subscription_id, -resource_group=ex_resource_group.upper(), +resource_group=ex_resource_group, volume_name=name ) if volume_name is None and \ @@ -1186,7 +1186,7 @@ class AzureNodeDriver(NodeDriver): u'/providers/Microsoft.Compute/snapshots/{snapshot_name}' ).format( subscription_id=self.subscription_id, -resource_group=ex_resource_group.upper(), +resource_group=ex_resource_group, snapshot_name=name )
[05/20] libcloud git commit: FAM-690 Disks support for azure resource manager driver
FAM-690 Disks support for azure resource manager driver Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4bd4af92 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4bd4af92 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4bd4af92 Branch: refs/heads/trunk Commit: 4bd4af926e42f255296b0611dd7215a607633b91 Parents: 57fe733 Author: mermoldyAuthored: Mon Feb 20 17:32:15 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 377 ++--- 1 file changed, 344 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/4bd4af92/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 0340203..3f20b7e 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -27,9 +27,9 @@ import time from libcloud.common.azure_arm import AzureResourceManagementConnection from libcloud.compute.providers import Provider from libcloud.compute.base import Node, NodeDriver, NodeLocation, NodeSize -from libcloud.compute.base import NodeImage, NodeAuthSSHKey -from libcloud.compute.base import NodeAuthPassword -from libcloud.compute.types import NodeState +from libcloud.compute.base import NodeImage, StorageVolume +from libcloud.compute.base import NodeAuthPassword, NodeAuthSSHKey +from libcloud.compute.types import NodeState, StorageVolumeState from libcloud.common.types import LibcloudError from libcloud.storage.types import ObjectDoesNotExistError from libcloud.common.exceptions import BaseHTTPError @@ -37,6 +37,9 @@ from libcloud.storage.drivers.azure_blobs import AzureBlobsStorageDriver from libcloud.utils.py3 import basestring +RESOURCE_API_VERSION = '2016-04-30-preview' + + class AzureImage(NodeImage): """Represents a Marketplace node image that an Azure VM can boot from.""" @@ -164,6 +167,7 @@ class AzureNodeDriver(NodeDriver): type = Provider.AZURE_ARM features = {'create_node': ['ssh_key', 'password']} + # The API doesn't provide state or country information, so fill it in. # Information from https://azure.microsoft.com/en-us/regions/ _location_to_country = { @@ -390,7 +394,8 @@ class AzureNodeDriver(NodeDriver): ex_subnet=None, ex_nic=None, ex_tags={}, -ex_customdata=""): +ex_customdata="", +ex_use_managed_disks=False): """Create a new node instance. This instance will be started automatically. @@ -411,7 +416,7 @@ class AzureNodeDriver(NodeDriver): >>> node = driver.create_node("test_node", auth=auth, ...) If you don't provide the ``auth`` argument libcloud will assign -a password:: +a password: >>> driver = AzureNodeDriver(...) >>> node = driver.create_node("test_node", ...) @@ -481,9 +486,15 @@ class AzureNodeDriver(NodeDriver): articles/virtual-machines-how-to-inject-custom-data/ :type ex_customdata: ``str`` +:param ex_use_managed_disks: Enable this feature to have Azure +automatically manage the availability of disks to provide data +redundancy and fault tolerance, without creating and managing +storage accounts on your own. Managed disks may not be available +in all regions. +:type ex_use_managed_disks: ``bool`` + :return: The newly created node. :rtype: :class:`.Node` - """ if location is None: @@ -526,7 +537,7 @@ class AzureNodeDriver(NodeDriver): n += 1 if isinstance(image, AzureVhdImage): -storageProfile = { +storage_profile = { "osDisk": { "name": "virtualmachine-osDisk", "osType": "linux", @@ -541,7 +552,7 @@ class AzureNodeDriver(NodeDriver): } } elif isinstance(image, AzureImage): -storageProfile = { +storage_profile = { "imageReference": { "publisher": image.publisher, "offer": image.offer, @@ -557,6 +568,12 @@ class AzureNodeDriver(NodeDriver): "createOption": "FromImage" } } +if ex_use_managed_disks: +storage_profile["osDisk"] = { +"name": name, +"createOption": "FromImage", +"caching":
[14/20] libcloud git commit: FAM-902 Added attaching blob based disk
FAM-902 Added attaching blob based disk Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4004c0dd Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4004c0dd Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4004c0dd Branch: refs/heads/trunk Commit: 4004c0dd7bb047af5f96a8b8398a711bb0e5660d Parents: f4fa364 Author: mermoldyAuthored: Fri May 12 17:18:03 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 47 -- 1 file changed, 38 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/4004c0dd/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index a24368c..d5d56b7 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -21,6 +21,7 @@ http://azure.microsoft.com/en-us/services/virtual-machines/ import base64 import binascii +import uuid import os import time @@ -778,7 +779,7 @@ class AzureNodeDriver(NodeDriver): ex_resource_group=None, ex_account_type=None, ex_tags=None): """ -Create a new volume. +Create a new managed volume. :param size: Size of volume in gigabytes. :type size: ``int`` @@ -798,7 +799,7 @@ class AzureNodeDriver(NodeDriver): :param ex_account_type: The Storage Account type, ``Standard_LRS``(HDD disks) or ``Premium_LRS``(SSD disks). -:type ex_account_type: str +:type ex_account_type: ``str`` :param ex_tags: Optional tags to associate with this resource. :type ex_tags: ``dict`` @@ -885,7 +886,7 @@ class AzureNodeDriver(NodeDriver): ) return [self._to_volume(volume) for volume in response.object['value']] -def attach_volume(self, node, volume, ex_lun=None, **ex_kwargs): +def attach_volume(self, node, volume, ex_lun=None, ex_vhd_uri=None, **ex_kwargs): """ Attach a managed volume to node. @@ -900,6 +901,10 @@ class AzureNodeDriver(NodeDriver): a unique LUN. :type ex_lun: ``int`` +:param ex_vhd_uri: Attach old-style un-managed disk from VHD +blob. (optional) +:type ex_vhd_uri: ``str`` + :rtype: ``bool`` """ action = node.extra['id'] @@ -915,14 +920,26 @@ class AzureNodeDriver(NodeDriver): else: raise LibcloudError("No LUN available to attach new disk.") -disks.append({ -'lun': ex_lun, -'createOption': 'attach', -'managedDisk': { -'id': volume.id +if ex_vhd_uri is not None: +# attach new or existing unmanaged disk +resource_group = node.id.split('/')[4] +is_vhd_exists = self._ex_is_vhd_exists(resource_group, ex_vhd_uri) +new_disk = { +'lun': ex_lun, +'name': 'unmanaged-vol-{}'.format(str(uuid.uuid4())[0:8]), +'createOption': 'attach' if is_vhd_exists else 'empty', +'vhd': {'uri': ex_vhd_uri}, +'diskSizeGB': volume.size +} +else: +# attach existing managed disk +new_disk = { +'lun': ex_lun, +'createOption': 'attach', +'managedDisk': {'id': volume.id} } -}) +disks.append(new_disk) self.connection.request( action, method='PUT', @@ -1843,6 +1860,18 @@ class AzureNodeDriver(NodeDriver): except ObjectDoesNotExistError: return True +def _ex_is_vhd_exists(self, resource_group, uri): +try: +storage_account, blob_container, blob = _split_blob_uri(uri) +keys = self.ex_get_storage_account_keys( +resource_group, storage_account) +blob_driver = AzureBlobsStorageDriver( +storage_account, keys['key1']) +blob_driver.get_object(blob_container, blob) +return True +except ObjectDoesNotExistError: +return False + def _ex_connection_class_kwargs(self): kwargs = super(AzureNodeDriver, self)._ex_connection_class_kwargs() kwargs['tenant_id'] = self.tenant_id
[20/20] libcloud git commit: changes for #1087
changes for #1087 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c7e81a5f Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c7e81a5f Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c7e81a5f Branch: refs/heads/trunk Commit: c7e81a5f618586016a3b89994269312328370154 Parents: b3c411d Author: Anthony ShawAuthored: Fri Aug 11 15:00:33 2017 +1000 Committer: Anthony Shaw Committed: Fri Aug 11 15:00:33 2017 +1000 -- CHANGES.rst | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c7e81a5f/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index fa3ae62..14c28fa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,6 +18,10 @@ Compute [GITHUB-1066] (Francois Regnoult) +- [ARM] Add Storage support, volumes, snapshots + [GITHUB-1087] + (Sergey Babak) + Container ~
[03/20] libcloud git commit: FAM-902 Fixed api version
FAM-902 Fixed api version Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/439e4dc8 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/439e4dc8 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/439e4dc8 Branch: refs/heads/trunk Commit: 439e4dc878de430ca41a258e27abf121c5721e44 Parents: aba57d6 Author: mermoldyAuthored: Mon May 22 20:22:01 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/439e4dc8/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index da7596f..eed44d0 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -1544,7 +1544,8 @@ class AzureNodeDriver(NodeDriver): :rtype: :class:`.Node` """ -r = self.connection.request(id, params={"api-version": "2015-06-15"}) +r = self.connection.request( +id, params={"api-version": RESOURCE_API_VERSION}) return self._to_node(r.object) def ex_get_volume(self, id): @@ -1558,7 +1559,8 @@ class AzureNodeDriver(NodeDriver): :rtype: :class:`.StorageVolume` """ -r = self.connection.request(id, params={"api-version": "2015-06-15"}) +r = self.connection.request( +id, params={"api-version": RESOURCE_API_VERSION}) return self._to_volume(r.object) def ex_get_snapshot(self, id): @@ -1572,7 +1574,8 @@ class AzureNodeDriver(NodeDriver): :rtype: :class:`.VolumeSnapshot` """ -r = self.connection.request(id, params={"api-version": "2015-06-15"}) +r = self.connection.request( +id, params={"api-version": RESOURCE_API_VERSION}) return self._to_snapshot(r.object) def ex_get_public_ip(self, id):
[19/20] libcloud git commit: removed unused import Closes #1087
removed unused import Closes #1087 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b3c411d1 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b3c411d1 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b3c411d1 Branch: refs/heads/trunk Commit: b3c411d19eafddbd5ea480bcc1dfe932d16447e1 Parents: 39feeeb Author: mermoldyAuthored: Mon Jun 5 14:01:17 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:36 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/b3c411d1/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index bd36731..eb770ad 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -21,7 +21,6 @@ http://azure.microsoft.com/en-us/services/virtual-machines/ import base64 import binascii -import uuid import os import time
[02/20] libcloud git commit: FAM-902 Added vhd_resource_group parameter to 'attach_volume'
FAM-902 Added vhd_resource_group parameter to 'attach_volume' Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9866138a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9866138a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9866138a Branch: refs/heads/trunk Commit: 9866138af52eb2da8047bf8dc3e395ed0a355a45 Parents: 439e4dc Author: mermoldyAuthored: Wed May 24 13:03:58 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 52 -- 1 file changed, 35 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/9866138a/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index eed44d0..a225429 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -886,9 +886,10 @@ class AzureNodeDriver(NodeDriver): ) return [self._to_volume(volume) for volume in response.object['value']] -def attach_volume(self, node, volume, ex_lun=None, ex_vhd_uri=None, **ex_kwargs): +def attach_volume(self, node, volume, ex_lun=None, + ex_vhd_uri=None, ex_vhd_resource_group=None, **ex_kwargs): """ -Attach a managed volume to node. +Attach a volume to node. :param node: A node to attach volume. :type node: :class:`Node` @@ -905,6 +906,10 @@ class AzureNodeDriver(NodeDriver): blob. (optional) :type ex_vhd_uri: ``str`` +:param ex_vhd_resource_group: Storage account resource group name. +(required for ``ex_vhd_uri``) +:type ex_vhd_resource_group: ``str`` + :rtype: ``bool`` """ action = node.extra['id'] @@ -921,23 +926,26 @@ class AzureNodeDriver(NodeDriver): raise LibcloudError("No LUN available to attach new disk.") if ex_vhd_uri is not None: +if ex_vhd_resource_group is None: +raise AttributeError( +"'ex_vhd_resource_group' of the VHD blob is not specified.") + # attach new or existing unmanaged disk -resource_group = node.id.split('/')[4] -is_vhd_exists = self._ex_is_vhd_exists(resource_group, ex_vhd_uri) +is_vhd_exists = self._ex_is_vhd_exists( +ex_vhd_resource_group, +ex_vhd_uri) new_disk = { 'lun': ex_lun, 'name': 'unmanaged-vol-{}'.format(str(uuid.uuid4())[0:8]), 'createOption': 'attach' if is_vhd_exists else 'empty', 'vhd': {'uri': ex_vhd_uri}, -'diskSizeGB': volume.size -} +'diskSizeGB': volume.size} else: # attach existing managed disk new_disk = { 'lun': ex_lun, 'createOption': 'attach', -'managedDisk': {'id': volume.id} -} +'managedDisk': {'id': volume.id}} disks.append(new_disk) self.connection.request( @@ -953,8 +961,7 @@ class AzureNodeDriver(NodeDriver): } }, 'location': location -} -) +}) return True def detach_volume(self, volume, ex_node=None): @@ -1905,9 +1912,20 @@ class AzureNodeDriver(NodeDriver): except ObjectDoesNotExistError: return True -def _ex_is_vhd_exists(self, resource_group, uri): +def _ex_is_vhd_exists(self, resource_group, vhd_uri): +""" +Check if VHD by given ``vhd_uri`` exists + +:param resource_group: Storage account resource group name. +:type: ``str`` + +:param vhd_uri: Virtual hard disk's uri. +:type: ``str`` + +:rtype: ``bool`` +""" try: -storage_account, blob_container, blob = _split_blob_uri(uri) +storage_account, blob_container, blob = _split_blob_uri(vhd_uri) keys = self.ex_get_storage_account_keys( resource_group, storage_account) blob_driver = AzureBlobsStorageDriver( @@ -2018,8 +2036,8 @@ class AzureNodeDriver(NodeDriver): def _split_blob_uri(uri): -uri = uri.split("/") -storageAccount = uri[2].split(".")[0] -blobContainer = uri[3] -blob = '/'.join(uri[4:]) -return (storageAccount, blobContainer, blob) +uri = uri.split('/') +storage_account = uri[2].split('.')[0] +blob_container = uri[3] +blob_name = '/'.join(uri[4:])
[07/20] libcloud git commit: FAM-690 Fixes
FAM-690 Fixes Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cbf1d5a6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cbf1d5a6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cbf1d5a6 Branch: refs/heads/trunk Commit: cbf1d5a614d9b8a09f859cbe9a8dba140d8d117b Parents: 6078d85 Author: mermoldyAuthored: Wed Mar 1 19:33:04 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 45 +- 1 file changed, 20 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/cbf1d5a6/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 57117f3..632d9a7 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -36,7 +36,7 @@ from libcloud.storage.types import ObjectDoesNotExistError from libcloud.common.exceptions import BaseHTTPError from libcloud.storage.drivers.azure_blobs import AzureBlobsStorageDriver from libcloud.utils.py3 import basestring -from libcloud.utils.iso8601 import parse_date +from libcloud.utils import iso8601 RESOURCE_API_VERSION = '2016-04-30-preview' @@ -802,23 +802,21 @@ class AzureNodeDriver(NodeDriver): volume_name=name, ) tags = ex_tags if ex_tags is not None else {} + +creation_data = { +'createOption': 'Empty' +} if snapshot is None else { +'createOption': 'Copy', +'sourceUri': snapshot.id +} data = { 'location': location.id, 'tags': tags, 'properties': { -'creationData': { -'createOption': 'Empty' -}, +'creationData': creation_data, 'diskSizeGB': size } } -if snapshot is not None: -data['properties']['creationData'] = { -'createOption': 'Copy', -'sourceUri': { -'id': snapshot.id -} -} response = self.connection.request( action, @@ -868,7 +866,7 @@ class AzureNodeDriver(NodeDriver): def attach_volume(self, node, volume, device=None, ex_lun=None): """ -Attach volume to node. +Attach a managed volume to node. :param node: A node to attach volume. :type node: :class:`Node` @@ -906,7 +904,7 @@ class AzureNodeDriver(NodeDriver): } }) -response = self.connection.request( +self.connection.request( action, method='PUT', params={ @@ -921,13 +919,11 @@ class AzureNodeDriver(NodeDriver): 'location': location } ) - -disks = response.object['properties']['storageProfile']['dataDisks'] -return volume.id in [disk['managedDisk']['id'] for disk in disks] +return True def detach_volume(self, volume, ex_node=None): """ -Detach a volume from a node. +Detach a managed volume from a node. """ if ex_node is None: raise ValueError("Must provide `ex_node` value") @@ -938,10 +934,11 @@ class AzureNodeDriver(NodeDriver): # remove volume from `properties.storageProfile.dataDisks` for index, disk in enumerate(disks): -if volume.id == disk['managedDisk']['id']: -del disks[index] +if 'managedDisk' in disk: +if volume.id == disk['managedDisk'].get('id'): +del disks[index] -response = self.connection.request( +self.connection.request( action, method='PUT', params={ @@ -956,9 +953,7 @@ class AzureNodeDriver(NodeDriver): 'location': location } ) - -disks = response.object['properties']['storageProfile']['dataDisks'] -return volume.id not in [disk['managedDisk']['id'] for disk in disks] +return True def destroy_volume(self, volume): """ @@ -1178,8 +1173,8 @@ class AzureNodeDriver(NodeDriver): state = VolumeSnapshotState.UNKNOWN try: -created_at = parse_date(snapshot_obj['properties']['timeCreated']) -except ValueError: +created_at = iso8601.parse_date(properties.get('timeCreated')) +except (TypeError, ValueError, iso8601.ParseError): created_at = None if snapshot_id is None \
[17/20] libcloud git commit: FAM-902 Style fixes
FAM-902 Style fixes Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/23ec91f4 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/23ec91f4 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/23ec91f4 Branch: refs/heads/trunk Commit: 23ec91f455fee703b730099544a81cc8fb8d8557 Parents: 9866138 Author: mermoldyAuthored: Wed May 24 15:00:25 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/23ec91f4/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index a225429..37c8815 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -902,7 +902,7 @@ class AzureNodeDriver(NodeDriver): a unique LUN. :type ex_lun: ``int`` -:param ex_vhd_uri: Attach old-style un-managed disk from VHD +:param ex_vhd_uri: Attach old-style unmanaged disk from VHD blob. (optional) :type ex_vhd_uri: ``str`` @@ -931,15 +931,16 @@ class AzureNodeDriver(NodeDriver): "'ex_vhd_resource_group' of the VHD blob is not specified.") # attach new or existing unmanaged disk -is_vhd_exists = self._ex_is_vhd_exists( +vhd_exists = self._ex_vhd_exists( ex_vhd_resource_group, ex_vhd_uri) new_disk = { 'lun': ex_lun, 'name': 'unmanaged-vol-{}'.format(str(uuid.uuid4())[0:8]), -'createOption': 'attach' if is_vhd_exists else 'empty', +'createOption': 'attach' if vhd_exists else 'empty', 'vhd': {'uri': ex_vhd_uri}, -'diskSizeGB': volume.size} +'diskSizeGB': volume.size +} else: # attach existing managed disk new_disk = { @@ -1912,7 +1913,7 @@ class AzureNodeDriver(NodeDriver): except ObjectDoesNotExistError: return True -def _ex_is_vhd_exists(self, resource_group, vhd_uri): +def _ex_vhd_exists(self, resource_group, vhd_uri): """ Check if VHD by given ``vhd_uri`` exists
[15/20] libcloud git commit: FAM-690 WIP
FAM-690 WIP Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/774b0971 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/774b0971 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/774b0971 Branch: refs/heads/trunk Commit: 774b097106ff022e48688dd554ca2d402cfd1367 Parents: c2343ad Author: mermoldyAuthored: Mon Mar 6 20:18:07 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 32 ++ 1 file changed, 24 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/774b0971/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index d2f3c37..6a43d09 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -788,10 +788,10 @@ class AzureNodeDriver(NodeDriver): :rtype: :class:`StorageVolume` """ if location is None: -raise ValueError("Must provide `location` value") +raise ValueError("Must provide `location` value.") if ex_resource_group is None: -raise ValueError("Must provide `ex_resource_group` value") +raise ValueError("Must provide `ex_resource_group` value.") action = ( u'/subscriptions/{subscription_id}/resourceGroups/{resource_group}' @@ -926,17 +926,28 @@ class AzureNodeDriver(NodeDriver): Detach a managed volume from a node. """ if ex_node is None: -raise ValueError("Must provide `ex_node` value") +raise ValueError("Must provide `ex_node` value.") action = ex_node.extra['id'] location = ex_node.extra['location'] disks = ex_node.extra['properties']['storageProfile']['dataDisks'] # remove volume from `properties.storageProfile.dataDisks` +disk_index = None for index, disk in enumerate(disks): if 'managedDisk' in disk: if volume.id == disk['managedDisk'].get('id'): -del disks[index] +disk_index = index +elif 'name' in disk: +if volume.name == disk['name']: +disk_index = index +if disk_index is None: +raise LibcloudError(( +"A disk with id {} does not found among managed disks " +"attached to an instance ({})." +).format(volume.id, ex_node.id)) +else: +del disks[disk_index] self.connection.request( action, @@ -1656,14 +1667,16 @@ class AzureNodeDriver(NodeDriver): resource = resource.id r = self.connection.request( resource, -params={"api-version": "2015-06-15"}) +params={"api-version": RESOURCE_API_VERSION}) if replace: r.object["tags"] = tags else: r.object["tags"].update(tags) -r = self.connection.request(resource, data={"tags": r.object["tags"]}, -params={"api-version": "2015-06-15"}, -method="PATCH") +self.connection.request( +resource, +data={"tags": r.object["tags"]}, +params={"api-version": RESOURCE_API_VERSION}, +method="PATCH") def ex_start_node(self, node): """ @@ -1870,6 +1883,9 @@ class AzureNodeDriver(NodeDriver): elif status["code"].startswith("ProvisioningState/failed"): state = NodeState.ERROR break +elif status["code"] == "ProvisioningState/updating": +state = NodeState.RECONFIGURING +break elif status["code"] == "ProvisioningState/succeeded": pass
[16/20] libcloud git commit: FAM-928 CR fixes
FAM-928 CR fixes Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2ade41d8 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2ade41d8 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2ade41d8 Branch: refs/heads/trunk Commit: 2ade41d85e3666bf94892f9c72b6067aa86ddb02 Parents: 23ec91f Author: mermoldyAuthored: Mon May 29 18:43:03 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 45 +- 1 file changed, 7 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2ade41d8/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 37c8815..d0de32f 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -887,7 +887,7 @@ class AzureNodeDriver(NodeDriver): return [self._to_volume(volume) for volume in response.object['value']] def attach_volume(self, node, volume, ex_lun=None, - ex_vhd_uri=None, ex_vhd_resource_group=None, **ex_kwargs): + ex_vhd_uri=None, ex_vhd_new=False, **ex_kwargs): """ Attach a volume to node. @@ -906,9 +906,9 @@ class AzureNodeDriver(NodeDriver): blob. (optional) :type ex_vhd_uri: ``str`` -:param ex_vhd_resource_group: Storage account resource group name. -(required for ``ex_vhd_uri``) -:type ex_vhd_resource_group: ``str`` +:param ex_vhd_new: Create a new VHD blob for unmanaged disk. +(optional) +:type ex_vhd_new: ``bool`` :rtype: ``bool`` """ @@ -926,20 +926,12 @@ class AzureNodeDriver(NodeDriver): raise LibcloudError("No LUN available to attach new disk.") if ex_vhd_uri is not None: -if ex_vhd_resource_group is None: -raise AttributeError( -"'ex_vhd_resource_group' of the VHD blob is not specified.") - -# attach new or existing unmanaged disk -vhd_exists = self._ex_vhd_exists( -ex_vhd_resource_group, -ex_vhd_uri) new_disk = { +'name': volume.name, +'diskSizeGB': volume.size, 'lun': ex_lun, -'name': 'unmanaged-vol-{}'.format(str(uuid.uuid4())[0:8]), -'createOption': 'attach' if vhd_exists else 'empty', +'createOption': 'empty' if ex_vhd_new else 'attach', 'vhd': {'uri': ex_vhd_uri}, -'diskSizeGB': volume.size } else: # attach existing managed disk @@ -1913,29 +1905,6 @@ class AzureNodeDriver(NodeDriver): except ObjectDoesNotExistError: return True -def _ex_vhd_exists(self, resource_group, vhd_uri): -""" -Check if VHD by given ``vhd_uri`` exists - -:param resource_group: Storage account resource group name. -:type: ``str`` - -:param vhd_uri: Virtual hard disk's uri. -:type: ``str`` - -:rtype: ``bool`` -""" -try: -storage_account, blob_container, blob = _split_blob_uri(vhd_uri) -keys = self.ex_get_storage_account_keys( -resource_group, storage_account) -blob_driver = AzureBlobsStorageDriver( -storage_account, keys['key1']) -blob_driver.get_object(blob_container, blob) -return True -except ObjectDoesNotExistError: -return False - def _ex_connection_class_kwargs(self): kwargs = super(AzureNodeDriver, self)._ex_connection_class_kwargs() kwargs['tenant_id'] = self.tenant_id
[11/20] libcloud git commit: FAM-690 Added tests
FAM-690 Added tests Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4ab938a1 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4ab938a1 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4ab938a1 Branch: refs/heads/trunk Commit: 4ab938a19c24c964306e097e373fdb1a69136d3b Parents: 5352e71 Author: mermoldyAuthored: Thu Mar 9 20:33:26 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 33 +- ...999_providers_Microsoft_Compute.json | 2 +- ...9_providers_Microsoft_Compute_disks.json | 65 ...9_providers_Microsoft_Compute_snapshots.json | 75 ...iders_Microsoft_Compute_virtualMachines.json | 52 +++ ...ers_Microsoft_Compute_disks_test_disk_1.json | 22 ++ ...Microsoft_Compute_snapshots_test_snap_1.json | 20 ++ ...oft_Compute_virtualMachines_test_node_1.json | 48 +++ ...irtualMachines_test_node_1_InstanceView.json | 27 ++ ...twork_networkInterfaces_test_node_1_nic.json | 38 +++ ...1_providers_Microsoft_Compute_disks.json | 22 ++ ...1_providers_Microsoft_Compute_snapshots.json | 38 +++ libcloud/test/compute/test_azure_arm.py | 342 ++- 13 files changed, 752 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ab938a1/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 3326a74..b85eb77 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -492,7 +492,7 @@ class AzureNodeDriver(NodeDriver): automatically manage the availability of disks to provide data redundancy and fault tolerance, without creating and managing storage accounts on your own. Managed disks may not be available -in all regions. +in all regions (default False). :type ex_use_managed_disks: ``bool`` :param ex_storage_account_type: The Storage Account type, @@ -772,21 +772,20 @@ class AzureNodeDriver(NodeDriver): """ Create a new volume. -:param size: Size of volume in gigabytes (required) +:param size: Size of volume in gigabytes. :type size: ``int`` -:param name: Name of the volume to be created +:param name: Name of the volume to be created. :type name: ``str`` -:param location: Which data center to create a volume in. +:param location: Which data center to create a volume in. (required) :type location: :class:`NodeLocation` -:param snapshot: Snapshot from which to create the new -volume. (optional) +:param snapshot: Snapshot from which to create the new volume. :type snapshot: :class:`VolumeSnapshot` :param ex_resource_group: The name of resource group in which to -create the volume. +create the volume. (required) :type ex_resource_group: ``str`` :param ex_tags: Optional tags to associate with this resource. @@ -872,7 +871,7 @@ class AzureNodeDriver(NodeDriver): ) return [self._to_volume(volume) for volume in response.object['value']] -def attach_volume(self, node, volume, device=None, ex_lun=None): +def attach_volume(self, node, volume, ex_lun=None, **ex_kwargs): """ Attach a managed volume to node. @@ -882,9 +881,6 @@ class AzureNodeDriver(NodeDriver): :param volume: A volume to attach. :type volume: :class:`StorageVolume` -:param device: A node device to attach volume(not supported by Azure). -:type device: ``str`` - :param ex_lun: Specifies the logical unit number (LUN) location for the data drive in the virtual machine. Each data disk must have a unique LUN. @@ -989,14 +985,14 @@ class AzureNodeDriver(NodeDriver): :param volume: Instance of ``StorageVolume``. :type volume: :class`StorageVolume` -:param name: Name of snapshot (optional). +:param name: Name of snapshot. (required) :type name: ``str`` -:param location: Which data center to create a volume in. +:param location: Which data center to create a volume in. (required) :type location: :class:`NodeLocation` :param ex_resource_group: The name of resource group in which to -create the snapshot. +create the snapshot. (required) :type ex_resource_group: ``str`` :param ex_tags: Optional tags to associate with this resource. @@
[04/20] libcloud git commit: FAM-690 Added 'updating' state
FAM-690 Added 'updating' state Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/432145f6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/432145f6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/432145f6 Branch: refs/heads/trunk Commit: 432145f6d45b7a8886237ce0d29cd07e896e Parents: 774b097 Author: mermoldyAuthored: Tue Mar 7 19:37:11 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 11 --- libcloud/compute/types.py | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/432145f6/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 6a43d09..375d432 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -1108,8 +1108,11 @@ class AzureNodeDriver(NodeDriver): provisioning_state = properties.get('provisioningState', '').lower() disk_state = properties.get('diskState', '').lower() -if provisioning_state in ('creating', 'updating'): + +if provisioning_state == 'creating': state = StorageVolumeState.CREATING +elif provisioning_state == 'updating': +state = StorageVolumeState.UPDATING elif provisioning_state == 'succeeded': if disk_state in ('attached', 'reserved', 'activesas'): state = StorageVolumeState.INUSE @@ -1174,8 +1177,10 @@ class AzureNodeDriver(NodeDriver): extra['volume_id'] = extra['source_id'] provisioning_state = properties.get('provisioningState', '').lower() -if provisioning_state in ('creating', 'updating'): +if provisioning_state == 'creating': state = VolumeSnapshotState.CREATING +elif provisioning_state == 'updating': +state = VolumeSnapshotState.UPDATING elif provisioning_state == 'succeeded': state = VolumeSnapshotState.AVAILABLE elif provisioning_state == 'failed': @@ -1884,7 +1889,7 @@ class AzureNodeDriver(NodeDriver): state = NodeState.ERROR break elif status["code"] == "ProvisioningState/updating": -state = NodeState.RECONFIGURING +state = NodeState.UPDATING break elif status["code"] == "ProvisioningState/succeeded": pass http://git-wip-us.apache.org/repos/asf/libcloud/blob/432145f6/libcloud/compute/types.py -- diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py index 15205dc..deae506 100644 --- a/libcloud/compute/types.py +++ b/libcloud/compute/types.py @@ -286,6 +286,7 @@ class NodeState(Type): RECONFIGURING = 'reconfiguring' MIGRATING = 'migrating' NORMAL = 'normal' +UPDATING = 'updating' class StorageVolumeState(Type): @@ -302,6 +303,7 @@ class StorageVolumeState(Type): ATTACHING = 'attaching' UNKNOWN = 'unknown' MIGRATING = 'migrating' +UPDATING = 'updating' class VolumeSnapshotState(Type): @@ -314,6 +316,7 @@ class VolumeSnapshotState(Type): DELETING = 'deleting' RESTORING = 'restoring' UNKNOWN = 'unknown' +UPDATING = 'updating' class Architecture(object):
[18/20] libcloud git commit: FAM-895 added methods to directly request volume, node, snapshot objects from Azure
FAM-895 added methods to directly request volume, node, snapshot objects from Azure Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/aba57d66 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/aba57d66 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/aba57d66 Branch: refs/heads/trunk Commit: aba57d66f0c8d49549c52d95b4a3d560278d2db4 Parents: 4004c0d Author: Hennadii StasAuthored: Thu May 18 12:50:54 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 42 ++ libcloud/compute/drivers/ec2.py | 4 +-- 2 files changed, 44 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/aba57d66/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index d5d56b7..da7596f 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -1533,6 +1533,48 @@ class AzureNodeDriver(NodeDriver): r = self.connection.request(id, params={"api-version": "2015-06-15"}) return self._to_nic(r.object) +def ex_get_node(self, id): +""" +Fetch information about a node. + +:param id: The complete resource path to the node resource. +:type id: ``str`` + +:return: The Node object +:rtype: :class:`.Node` +""" + +r = self.connection.request(id, params={"api-version": "2015-06-15"}) +return self._to_node(r.object) + +def ex_get_volume(self, id): +""" +Fetch information about a volume. + +:param id: The complete resource path to the volume resource. +:type id: ``str`` + +:return: The StorageVolume object +:rtype: :class:`.StorageVolume` +""" + +r = self.connection.request(id, params={"api-version": "2015-06-15"}) +return self._to_volume(r.object) + +def ex_get_snapshot(self, id): +""" +Fetch information about a snapshot. + +:param id: The complete resource path to the snapshot resource. +:type id: ``str`` + +:return: The VolumeSnapshot object +:rtype: :class:`.VolumeSnapshot` +""" + +r = self.connection.request(id, params={"api-version": "2015-06-15"}) +return self._to_snapshot(r.object) + def ex_get_public_ip(self, id): """ Fetch information about a public IP resource. http://git-wip-us.apache.org/repos/asf/libcloud/blob/aba57d66/libcloud/compute/drivers/ec2.py -- diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index 26b789e..efb6275 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -6292,8 +6292,8 @@ class BaseEC2NodeDriver(NodeDriver): Modify volume parameters. A list of valid parameters can be found at https://goo.gl/N0rPEQ -:param Volume: Volume instance -:type Volume: :class:`Volume` +:param volume: Volume instance +:type volume: :class:`Volume` :param parameters: Dictionary with updated volume parameters :type parameters: ``dict``
[13/20] libcloud git commit: FAM-690 added disk accound type
FAM-690 added disk accound type Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f4fa3640 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f4fa3640 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f4fa3640 Branch: refs/heads/trunk Commit: f4fa3640e061793887dd3341b356a6e108078345 Parents: a3fd017 Author: mermoldyAuthored: Fri Mar 17 12:28:14 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f4fa3640/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 07fc28e..a24368c 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -775,7 +775,8 @@ class AzureNodeDriver(NodeDriver): return True def create_volume(self, size, name, location=None, snapshot=None, - ex_resource_group=None, ex_tags=None): + ex_resource_group=None, ex_account_type=None, + ex_tags=None): """ Create a new volume. @@ -795,6 +796,10 @@ class AzureNodeDriver(NodeDriver): create the volume. (required) :type ex_resource_group: ``str`` +:param ex_account_type: The Storage Account type, +``Standard_LRS``(HDD disks) or ``Premium_LRS``(SSD disks). +:type ex_account_type: str + :param ex_tags: Optional tags to associate with this resource. :type ex_tags: ``dict`` @@ -831,6 +836,8 @@ class AzureNodeDriver(NodeDriver): 'diskSizeGB': size } } +if ex_account_type is not None: +data['properties']['accountType'] = ex_account_type response = self.connection.request( action,
[12/20] libcloud git commit: FAM-690 Codereview fixes.
FAM-690 Codereview fixes. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a3fd0171 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a3fd0171 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a3fd0171 Branch: refs/heads/trunk Commit: a3fd017153e4885cee50f21e201c707a2db1f60c Parents: c0c6e56 Author: mermoldyAuthored: Mon Mar 13 12:12:45 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 67 +- 1 file changed, 29 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/a3fd0171/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index cc5f370..07fc28e 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -191,6 +191,13 @@ class AzureNodeDriver(NodeDriver): "australiasoutheast": "Victoria, Australia" } +SNAPSHOT_STATE_MAP = { +'creating': VolumeSnapshotState.CREATING, +'updating': VolumeSnapshotState.UPDATING, +'succeeded': VolumeSnapshotState.AVAILABLE, +'failed': VolumeSnapshotState.ERROR +} + def __init__(self, tenant_id, subscription_id, key, secret, secure=True, host=None, port=None, api_version=None, region=None, **kwargs): @@ -895,10 +902,11 @@ class AzureNodeDriver(NodeDriver): if ex_lun is None: # find the smallest unused logical unit number used_luns = [disk['lun'] for disk in disks] -for lun in range(0, 63): -if lun not in used_luns: -ex_lun = lun -break +free_luns = [lun for lun in range(0, 63) if lun not in used_luns] +if len(free_luns) > 0: +ex_lun = free_luns[0] +else: +raise LibcloudError("No LUN available to attach new disk.") disks.append({ 'lun': ex_lun, @@ -937,21 +945,11 @@ class AzureNodeDriver(NodeDriver): disks = ex_node.extra['properties']['storageProfile']['dataDisks'] # remove volume from `properties.storageProfile.dataDisks` -disk_index = None -for index, disk in enumerate(disks): -if 'managedDisk' in disk: -if volume.id == disk['managedDisk'].get('id'): -disk_index = index -elif 'name' in disk: -if volume.name == disk['name']: -disk_index = index -if disk_index is None: -raise LibcloudError(( -"A disk with id {} does not found among managed disks " -"attached to an instance ({})." -).format(volume.id, ex_node.id)) -else: -del disks[disk_index] +disks[:] = [ +disk for disk in disks if +disk.get('name') != volume.name and +disk.get('managedDisk', {}).get('id') != volume.id +] self.connection.request( action, @@ -1176,19 +1174,10 @@ class AzureNodeDriver(NodeDriver): extra['source_id'] = properties['creationData']['sourceUri'] if '/providers/Microsoft.Compute/disks/' in extra['source_id']: extra['volume_id'] = extra['source_id'] - -provisioning_state = properties.get('provisioningState', '').lower() -if provisioning_state == 'creating': -state = VolumeSnapshotState.CREATING -elif provisioning_state == 'updating': -state = VolumeSnapshotState.UPDATING -elif provisioning_state == 'succeeded': -state = VolumeSnapshotState.AVAILABLE -elif provisioning_state == 'failed': -state = VolumeSnapshotState.ERROR -else: -state = VolumeSnapshotState.UNKNOWN - +state = self.SNAPSHOT_STATE_MAP.get( +properties.get('provisioningState', '').lower(), +VolumeSnapshotState.UNKNOWN +) try: created_at = iso8601.parse_date(properties.get('timeCreated')) except (TypeError, ValueError, iso8601.ParseError): @@ -1221,8 +1210,10 @@ class AzureNodeDriver(NodeDriver): """ Delete a resource. """ +if not isinstance(resource, basestring): +resource = resource.id self.connection.request( -resource.id, +resource, method='DELETE', params={ 'api-version': RESOURCE_API_VERSION @@ -1480,25 +1471,25 @@ class
[09/20] libcloud git commit: FAM-690 WIP
FAM-690 WIP Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5352e710 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5352e710 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5352e710 Branch: refs/heads/trunk Commit: 5352e710350939539878aae879c2bd687f401c3d Parents: 432145f Author: mermoldyAuthored: Thu Mar 9 14:19:59 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 74 +- 1 file changed, 41 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/5352e710/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 375d432..3326a74 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -169,7 +169,6 @@ class AzureNodeDriver(NodeDriver): type = Provider.AZURE_ARM features = {'create_node': ['ssh_key', 'password']} - # The API doesn't provide state or country information, so fill it in. # Information from https://azure.microsoft.com/en-us/regions/ _location_to_country = { @@ -397,7 +396,8 @@ class AzureNodeDriver(NodeDriver): ex_nic=None, ex_tags={}, ex_customdata="", -ex_use_managed_disks=False): +ex_use_managed_disks=False, +ex_storage_account_type="Standard_LRS"): """Create a new node instance. This instance will be started automatically. @@ -495,6 +495,10 @@ class AzureNodeDriver(NodeDriver): in all regions. :type ex_use_managed_disks: ``bool`` +:param ex_storage_account_type: The Storage Account type, +``Standard_LRS``(HDD disks) or ``Premium_LRS``(SSD disks). +:type ex_storage_account_type: str + :return: The newly created node. :rtype: :class:`.Node` """ @@ -523,25 +527,25 @@ class AzureNodeDriver(NodeDriver): "/Microsoft.Compute/virtualMachines/%s" % \ (self.subscription_id, ex_resource_group, name) -n = 0 -while True: -try: -instance_vhd = "https://%s.blob%s; \ - "/%s/%s-os_%i.vhd" \ - % (ex_storage_account, - self.connection.storage_suffix, - ex_blob_container, - name, - n) -self._ex_delete_old_vhd(ex_resource_group, instance_vhd) -break -except LibcloudError: -n += 1 +def _get_instance_vhd(): +n = 0 +while True: +try: +instance_vhd = "https://%s.blob.core.windows.net; \ + "/%s/%s-os_%i.vhd" \ + % (ex_storage_account, + ex_blob_container, + name, + n) +self._ex_delete_old_vhd(ex_resource_group, instance_vhd) +return instance_vhd +except LibcloudError: +n += 1 if isinstance(image, AzureVhdImage): storage_profile = { "osDisk": { -"name": "virtualmachine-osDisk", +"name": name, "osType": "linux", "caching": "ReadWrite", "createOption": "FromImage", @@ -549,10 +553,14 @@ class AzureNodeDriver(NodeDriver): "uri": image.id }, "vhd": { -"uri": instance_vhd +"uri": _get_instance_vhd(), } } } +if ex_use_managed_disks: +raise LibcloudError( +"Creating managed OS disk from %s image " +"type is not supported." % type(image)) elif isinstance(image, AzureImage): storage_profile = { "imageReference": { @@ -562,25 +570,24 @@ class AzureNodeDriver(NodeDriver): "version": image.version }, "osDisk": { -"name": "virtualmachine-osDisk", -"vhd": { -"uri": instance_vhd -}, +
[06/20] libcloud git commit: FAM-690 Snapshots support for azure resource manager driver
FAM-690 Snapshots support for azure resource manager driver Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6078d854 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6078d854 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6078d854 Branch: refs/heads/trunk Commit: 6078d854685c8e2114bdef840425828505e19ba8 Parents: 4bd4af9 Author: mermoldyAuthored: Mon Feb 27 18:55:30 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 229 + 1 file changed, 199 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/6078d854/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index 3f20b7e..57117f3 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -27,14 +27,16 @@ import time from libcloud.common.azure_arm import AzureResourceManagementConnection from libcloud.compute.providers import Provider from libcloud.compute.base import Node, NodeDriver, NodeLocation, NodeSize -from libcloud.compute.base import NodeImage, StorageVolume +from libcloud.compute.base import NodeImage, StorageVolume, VolumeSnapshot from libcloud.compute.base import NodeAuthPassword, NodeAuthSSHKey -from libcloud.compute.types import NodeState, StorageVolumeState +from libcloud.compute.types import (NodeState, StorageVolumeState, +VolumeSnapshotState) from libcloud.common.types import LibcloudError from libcloud.storage.types import ObjectDoesNotExistError from libcloud.common.exceptions import BaseHTTPError from libcloud.storage.drivers.azure_blobs import AzureBlobsStorageDriver from libcloud.utils.py3 import basestring +from libcloud.utils.iso8601 import parse_date RESOURCE_API_VERSION = '2016-04-30-preview' @@ -769,14 +771,14 @@ class AzureNodeDriver(NodeDriver): :type name: ``str`` :param location: Which data center to create a volume in. -:type location: :class:`.NodeLocation` +:type location: :class:`NodeLocation` :param snapshot: Snapshot from which to create the new volume. (optional) -:type snapshot: :class:`.VolumeSnapshot` +:type snapshot: :class:`VolumeSnapshot` :param ex_resource_group: The name of resource group in which to -create the node. +create the volume. :type ex_resource_group: ``str`` :param ex_tags: Optional tags to associate with this resource. @@ -785,7 +787,6 @@ class AzureNodeDriver(NodeDriver): :return: The newly created volume. :rtype: :class:`StorageVolume` """ - if location is None: raise ValueError("Must provide `location` value") @@ -811,6 +812,13 @@ class AzureNodeDriver(NodeDriver): 'diskSizeGB': size } } +if snapshot is not None: +data['properties']['creationData'] = { +'createOption': 'Copy', +'sourceUri': { +'id': snapshot.id +} +} response = self.connection.request( action, @@ -892,7 +900,6 @@ class AzureNodeDriver(NodeDriver): disks.append({ 'lun': ex_lun, -'name': volume.name, 'createOption': 'attach', 'managedDisk': { 'id': volume.id @@ -957,29 +964,117 @@ class AzureNodeDriver(NodeDriver): """ Delete a volume. """ -self.connection.request( -volume.id, -method='DELETE', -params={ -'api-version': RESOURCE_API_VERSION -}, -) +self.ex_delete_resource(volume) return True -def create_volume_snapshot(self, volume, name=None): +def create_volume_snapshot(self, volume, name=None, location=None, + ex_resource_group=None, ex_tags=None): """ Create snapshot from volume. -:param volume: Instance of ``StorageVolume`` +:param volume: Instance of ``StorageVolume``. :type volume: :class`StorageVolume` -:param name: Name of snapshot (optional) +:param name: Name of snapshot (optional). :type name: ``str`` +:param location: Which data center to create a volume in. +:type location: :class:`NodeLocation` + +:param ex_resource_group: The name of resource group in which to +create the snapshot. +
[01/20] libcloud git commit: FAM-928 renamings
Repository: libcloud Updated Branches: refs/heads/trunk 57fe73347 -> c7e81a5f6 FAM-928 renamings Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/39feeebc Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/39feeebc Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/39feeebc Branch: refs/heads/trunk Commit: 39feeebc4f03dde4cd32db20fe3bdc63310103be Parents: 2ade41d Author: mermoldyAuthored: Wed May 31 16:00:51 2017 +0300 Committer: Anthony Shaw Committed: Fri Aug 11 14:59:31 2017 +1000 -- libcloud/compute/drivers/azure_arm.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/39feeebc/libcloud/compute/drivers/azure_arm.py -- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index d0de32f..bd36731 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -887,7 +887,7 @@ class AzureNodeDriver(NodeDriver): return [self._to_volume(volume) for volume in response.object['value']] def attach_volume(self, node, volume, ex_lun=None, - ex_vhd_uri=None, ex_vhd_new=False, **ex_kwargs): + ex_vhd_uri=None, ex_vhd_create=False, **ex_kwargs): """ Attach a volume to node. @@ -906,9 +906,9 @@ class AzureNodeDriver(NodeDriver): blob. (optional) :type ex_vhd_uri: ``str`` -:param ex_vhd_new: Create a new VHD blob for unmanaged disk. +:param ex_vhd_create: Create a new VHD blob for unmanaged disk. (optional) -:type ex_vhd_new: ``bool`` +:type ex_vhd_create: ``bool`` :rtype: ``bool`` """ @@ -930,7 +930,7 @@ class AzureNodeDriver(NodeDriver): 'name': volume.name, 'diskSizeGB': volume.size, 'lun': ex_lun, -'createOption': 'empty' if ex_vhd_new else 'attach', +'createOption': 'empty' if ex_vhd_create else 'attach', 'vhd': {'uri': ex_vhd_uri}, } else:
[jira] [Commented] (LIBCLOUD-840) libcloud crashs when accessing Swift based object store using Keystone auth API v3
[ https://issues.apache.org/jira/browse/LIBCLOUD-840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16122844#comment-16122844 ] ASF GitHub Bot commented on LIBCLOUD-840: - Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1068 > libcloud crashs when accessing Swift based object store using Keystone auth > API v3 > -- > > Key: LIBCLOUD-840 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-840 > Project: Libcloud > Issue Type: Bug > Components: Storage > Environment: ANY >Reporter: Mario Oschwald >Priority: Critical > Attachments: LIBCLOUD-840-fix.patch > > > libcloud crashs when accessing Swift based object store using Keystone auth > API v3 > Code to reproduce: > {code} > from libcloud.storage.types import Provider > from libcloud.storage.providers import get_driver > cls = get_driver(Provider.OPENSTACK_SWIFT) > driver = cls('USER', 'PASSWORD', ex_force_auth_version='3.x_password', > ex_force_auth_url='https://keystone.cst.de:5001', > ex_tenant_name='signing_service', ex_domain_name='AD', > ex_force_service_name='ceph') > container = driver.create_container(container_name='fnord') > {code} > This produces the following stack trace: > {code} > Traceback (most recent call last): > File "D:/DEV/MAIN/Release Management/bin/cstutil/cloudtools.py", line 18, > in > main() > File "D:/DEV/MAIN/Release Management/bin/cstutil/cloudtools.py", line 14, > in main > container = driver.create_container(container_name='fnord') > File > "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", line > 358, in create_container > '/%s' % (container_name_encoded), method='PUT') > File > "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", line > 163, in request > raw=raw) > File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line > 227, in request > raw=raw) > File "C:\Python27\lib\site-packages\libcloud\common\base.py", line 753, in > request > action = self.morph_action_hook(action) > File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line > 294, in morph_action_hook > self._populate_hosts_and_request_paths() > File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line > 338, in _populate_hosts_and_request_paths > url = self._ex_force_base_url or self.get_endpoint() > File > "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", line > 141, in get_endpoint > if endpoint: > UnboundLocalError: local variable 'endpoint' referenced before assignment > {code} > Please see attached patch for a trivial fix. Using the 2.0 endpoint locator > mechanism works fine with 3.x -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[2/3] libcloud git commit: Update cloudfiles.py
Update cloudfiles.py Remove trailing whitespace Closes #1068 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6055a82b Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6055a82b Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6055a82b Branch: refs/heads/trunk Commit: 6055a82ba4499921175b8f5ab82cd5c06f16d344 Parents: 0378495 Author: Hakan CarlssonAuthored: Mon Jun 26 10:01:44 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:54:41 2017 +1000 -- libcloud/storage/drivers/cloudfiles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/6055a82b/libcloud/storage/drivers/cloudfiles.py -- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index 06ccf2a..195570a 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -137,8 +137,8 @@ class OpenStackSwiftConnection(OpenStackBaseConnection): elif ('1.1' in self._auth_version) or ('1.0' in self._auth_version): endpoint = self.service_catalog.get_endpoint( name=self._service_name, region=self._service_region) -else: -endpoint = None +else: +endpoint = None if endpoint: return endpoint.url
[GitHub] libcloud pull request #1068: Fix #LIBCLOUD-840
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1068 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (LIBCLOUD-840) libcloud crashs when accessing Swift based object store using Keystone auth API v3
[ https://issues.apache.org/jira/browse/LIBCLOUD-840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16122843#comment-16122843 ] ASF subversion and git services commented on LIBCLOUD-840: -- Commit 0378495ab879fb33f493d6c67164d39202bf7849 in libcloud's branch refs/heads/trunk from [~hakanc] [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=0378495 ] Fix #LIBCLOUD-840 Update OpenStackSwiftConnection to work with auth version 3.0 > libcloud crashs when accessing Swift based object store using Keystone auth > API v3 > -- > > Key: LIBCLOUD-840 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-840 > Project: Libcloud > Issue Type: Bug > Components: Storage > Environment: ANY >Reporter: Mario Oschwald >Priority: Critical > Attachments: LIBCLOUD-840-fix.patch > > > libcloud crashs when accessing Swift based object store using Keystone auth > API v3 > Code to reproduce: > {code} > from libcloud.storage.types import Provider > from libcloud.storage.providers import get_driver > cls = get_driver(Provider.OPENSTACK_SWIFT) > driver = cls('USER', 'PASSWORD', ex_force_auth_version='3.x_password', > ex_force_auth_url='https://keystone.cst.de:5001', > ex_tenant_name='signing_service', ex_domain_name='AD', > ex_force_service_name='ceph') > container = driver.create_container(container_name='fnord') > {code} > This produces the following stack trace: > {code} > Traceback (most recent call last): > File "D:/DEV/MAIN/Release Management/bin/cstutil/cloudtools.py", line 18, > in > main() > File "D:/DEV/MAIN/Release Management/bin/cstutil/cloudtools.py", line 14, > in main > container = driver.create_container(container_name='fnord') > File > "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", line > 358, in create_container > '/%s' % (container_name_encoded), method='PUT') > File > "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", line > 163, in request > raw=raw) > File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line > 227, in request > raw=raw) > File "C:\Python27\lib\site-packages\libcloud\common\base.py", line 753, in > request > action = self.morph_action_hook(action) > File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line > 294, in morph_action_hook > self._populate_hosts_and_request_paths() > File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line > 338, in _populate_hosts_and_request_paths > url = self._ex_force_base_url or self.get_endpoint() > File > "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", line > 141, in get_endpoint > if endpoint: > UnboundLocalError: local variable 'endpoint' referenced before assignment > {code} > Please see attached patch for a trivial fix. Using the 2.0 endpoint locator > mechanism works fine with 3.x -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[3/3] libcloud git commit: changes for #1068
changes for #1068 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/57fe7334 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/57fe7334 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/57fe7334 Branch: refs/heads/trunk Commit: 57fe7334767c56eb7dbf61773d6e2f76c4655823 Parents: 6055a82 Author: Anthony ShawAuthored: Fri Aug 11 14:55:39 2017 +1000 Committer: Anthony Shaw Committed: Fri Aug 11 14:55:39 2017 +1000 -- CHANGES.rst | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/57fe7334/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index 0729aee..fa3ae62 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -28,6 +28,10 @@ Container Storage ~~~ +- [CLOUDFILES] Update OpenStackSwiftConnection to work with auth version 3.0 + [GITHUB-1068] + (Hakan Carlsson) + - [CLOUDFILES] Add SSL URI support [GITHUB-1076, LIBCLOUD-458] (@ayleph)
[1/3] libcloud git commit: Fix #LIBCLOUD-840
Repository: libcloud Updated Branches: refs/heads/trunk 1fdb4df1c -> 57fe73347 Fix #LIBCLOUD-840 Update OpenStackSwiftConnection to work with auth version 3.0 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0378495a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0378495a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0378495a Branch: refs/heads/trunk Commit: 0378495ab879fb33f493d6c67164d39202bf7849 Parents: 1fdb4df Author: Hakan CarlssonAuthored: Wed Jun 7 13:22:40 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:54:20 2017 +1000 -- libcloud/storage/drivers/cloudfiles.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/0378495a/libcloud/storage/drivers/cloudfiles.py -- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index ba2ed76..06ccf2a 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -129,7 +129,7 @@ class OpenStackSwiftConnection(OpenStackBaseConnection): self._service_region = None def get_endpoint(self, *args, **kwargs): -if '2.0' in self._auth_version: +if ('2.0' in self._auth_version) or ('3.x' in self._auth_version): endpoint = self.service_catalog.get_endpoint( service_type=self._service_type, name=self._service_name, @@ -137,6 +137,8 @@ class OpenStackSwiftConnection(OpenStackBaseConnection): elif ('1.1' in self._auth_version) or ('1.0' in self._auth_version): endpoint = self.service_catalog.get_endpoint( name=self._service_name, region=self._service_region) +else: +endpoint = None if endpoint: return endpoint.url
[GitHub] libcloud pull request #1067: Fix docker tls
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1067 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[3/9] libcloud git commit: change key, secret default values from None to '' otherwise you cannot call driver(host='https://198.61.239.128', port=4243, key_file='key.pem', cert_file='cert.pem')
change key,secret default values from None to '' otherwise you cannot call driver(host='https://198.61.239.128', port=4243, key_file='key.pem', cert_file='cert.pem') Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5496a0a1 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5496a0a1 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5496a0a1 Branch: refs/heads/trunk Commit: 5496a0a1ca81062a60930d0abb7e02e43b69b938 Parents: 2272c93 Author: johnnyWalnutAuthored: Fri Jun 2 13:59:38 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:43:39 2017 +1000 -- libcloud/container/drivers/docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/5496a0a1/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index 7b9d28b..e258c42 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -179,7 +179,7 @@ class DockerContainerDriver(ContainerDriver): supports_clusters = False version = '1.24' -def __init__(self, key=None, secret=None, secure=False, host='localhost', +def __init__(self, key='', secret='', secure=False, host='localhost', port=4243, key_file=None, cert_file=None): """ :paramkey: API key or username to used (required)
[4/9] libcloud git commit: add class KeyCertificateConnection which accepts both key_file and cert_file. It can be used for tls connection.
add class KeyCertificateConnection which accepts both key_file and cert_file. It can be used for tls connection. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/48d80637 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/48d80637 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/48d80637 Branch: refs/heads/trunk Commit: 48d80637fb5bb1ea60ee605884ed1baf2fb6fdc4 Parents: 873f776 Author: johnnyWalnutAuthored: Fri Jun 2 13:21:44 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:43:39 2017 +1000 -- libcloud/common/base.py | 27 +++ 1 file changed, 27 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/48d80637/libcloud/common/base.py -- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index 063f52b..f860a23 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -865,6 +865,33 @@ class CertificateConnection(Connection): self.cert_file = cert_file +class KeyCertificateConnection(CertificateConnection): +""" +Base connection class which accepts both ``key_file`` and ``cert_file`` +argument. +""" + +key_file=None + +def __init__(self, key_file, cert_file, secure=True, host=None, port=None, + url=None, proxy_url=None, timeout=None, backoff=None, + retry_delay=None): +""" +Initialize `cert_file`; set `secure` to an ``int`` based on +passed value. +""" +super(KeyCertificateConnection, self).__init__(cert_file, + secure=secure, + host=host, + port=port, url=url, + timeout=timeout, + backoff=backoff, + retry_delay=retry_delay, + proxy_url=proxy_url) + +self.key_file = key_file + + class ConnectionUserAndKey(ConnectionKey): """ Base connection class which accepts a ``user_id`` and ``key`` argument.
[2/9] libcloud git commit: pass ca_cert at DockerContainerDriver if a user wants to not change the environmental variables
pass ca_cert at DockerContainerDriver if a user wants to not change the environmental variables Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/26670ab0 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/26670ab0 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/26670ab0 Branch: refs/heads/trunk Commit: 26670ab00a738480388c8661c6c4597b37f52d4e Parents: 5496a0a Author: johnnyWalnutAuthored: Fri Jun 2 14:02:45 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:43:39 2017 +1000 -- libcloud/container/drivers/docker.py | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/26670ab0/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index e258c42..5b9536b 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -180,7 +180,7 @@ class DockerContainerDriver(ContainerDriver): version = '1.24' def __init__(self, key='', secret='', secure=False, host='localhost', - port=4243, key_file=None, cert_file=None): + port=4243, key_file=None, cert_file=None, ca_cert=None): """ :paramkey: API key or username to used (required) :type key: ``str`` @@ -237,11 +237,12 @@ class DockerContainerDriver(ContainerDriver): raise Exception( 'Needs both private key file and ' 'certificate file for tls authentication') -self.connection.key_file = key_file -self.connection.cert_file = cert_file -self.connection.secure = True + +if ca_cert: +self.connection.connection.ca_cert = ca_cert else: -self.connection.secure = secure +# do not verify SSL certificate +self.connection.connection.ca_cert = False self.connection.secure = secure self.connection.host = host
[5/9] libcloud git commit: pass the real version and not a default one
pass the real version and not a default one Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/03f5d803 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/03f5d803 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/03f5d803 Branch: refs/heads/trunk Commit: 03f5d80393b3a005514d06be7fc50a2683923a4e Parents: 26670ab Author: johnnyWalnutAuthored: Fri Jun 2 14:05:19 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:43:39 2017 +1000 -- libcloud/container/drivers/docker.py | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/03f5d803/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index 5b9536b..b69b1ee 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -247,6 +247,8 @@ class DockerContainerDriver(ContainerDriver): self.connection.secure = secure self.connection.host = host self.connection.port = port +# set API version +self.version = self._get_api_version() def _ex_connection_class_kwargs(self): kwargs = {}
[1/9] libcloud git commit: in case of ca_cert has been already set by libcloud.security.CA_CERT_PATH
Repository: libcloud Updated Branches: refs/heads/trunk 873f776cd -> 1fdb4df1c in case of ca_cert has been already set by libcloud.security.CA_CERT_PATH Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2b3c2e0a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2b3c2e0a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2b3c2e0a Branch: refs/heads/trunk Commit: 2b3c2e0aefa6a5b4e6f52d61e1b0153adf8eb99d Parents: 03f5d80 Author: johnnyWalnutAuthored: Fri Jun 2 15:29:32 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:43:39 2017 +1000 -- libcloud/container/drivers/docker.py | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b3c2e0a/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index b69b1ee..37c8eb2 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -240,6 +240,9 @@ class DockerContainerDriver(ContainerDriver): if ca_cert: self.connection.connection.ca_cert = ca_cert +elif hasattr(self.connection.connection, 'ca_cert'): +# already set by libcloud.security.CA_CERTS_PATH +pass else: # do not verify SSL certificate self.connection.connection.ca_cert = False
[7/9] libcloud git commit: pep8 fixies Closes #1067
pep8 fixies Closes #1067 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6fea2faa Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6fea2faa Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6fea2faa Branch: refs/heads/trunk Commit: 6fea2faa71d50078101fdae30c5a7023017ead42 Parents: 2b3c2e0 Author: johnnyWalnutAuthored: Fri Jun 2 16:23:54 2017 +0200 Committer: Anthony Shaw Committed: Fri Aug 11 14:43:43 2017 +1000 -- libcloud/common/base.py | 2 +- libcloud/container/drivers/docker.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/6fea2faa/libcloud/common/base.py -- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index f860a23..d90e1c5 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -871,7 +871,7 @@ class KeyCertificateConnection(CertificateConnection): argument. """ -key_file=None +key_file = None def __init__(self, key_file, cert_file, secure=True, host=None, port=None, url=None, proxy_url=None, timeout=None, backoff=None, http://git-wip-us.apache.org/repos/asf/libcloud/blob/6fea2faa/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index 37c8eb2..caf7e15 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -141,7 +141,8 @@ class DockertlsConnection(KeyCertificateConnection): self.key_file = key_file certpath = os.path.expanduser(cert_file) -is_file_path = os.path.exists(certpath) and os.path.isfile(certpath) +is_file_path = os.path.exists( +certpath) and os.path.isfile(certpath) if not is_file_path: raise InvalidCredsError( 'You need an certificate PEM file to authenticate with '
[9/9] libcloud git commit: changes for #1067
changes for #1067 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1fdb4df1 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1fdb4df1 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1fdb4df1 Branch: refs/heads/trunk Commit: 1fdb4df1c1e052a3ba2b159b52b8731ffb5e3bda Parents: 3c6b7eb Author: Anthony ShawAuthored: Fri Aug 11 14:53:09 2017 +1000 Committer: Anthony Shaw Committed: Fri Aug 11 14:53:09 2017 +1000 -- CHANGES.rst | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/1fdb4df1/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index fb0fa64..0729aee 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,6 +18,13 @@ Compute [GITHUB-1066] (Francois Regnoult) +Container +~ + +- [DOCKER] Fixes to support TLS connection + [GITHUB-1067] + (johnnyWalnut) + Storage ~~~
[jira] [Commented] (LIBCLOUD-458) Use HTTPS CDN URIs for Rackspace Cloud Files
[ https://issues.apache.org/jira/browse/LIBCLOUD-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16122826#comment-16122826 ] ASF GitHub Bot commented on LIBCLOUD-458: - Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1076 > Use HTTPS CDN URIs for Rackspace Cloud Files > > > Key: LIBCLOUD-458 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-458 > Project: Libcloud > Issue Type: Improvement > Components: Storage >Affects Versions: 0.14.0-beta3 >Reporter: Michael Farrell > > I found another patch in my collection, where I had patched the Rackspace > storage driver to use the HTTPS CDN URI. > I'm unsure if it may be best to have this as an option for storage drivers, > but if this option is added, it will also need to be implemented for the > other storage drivers. I would like some advice on this. > The patch that hard codes it to use HTTPS URIs always for the CDN, as a > 1-line change (ie: without the settings proposed above): > {code} > libcloud/storage/drivers/cloudfiles.py > > index 1502a33..6e7f931 100644 > @@ -273,7 +273,7 @@ class CloudFilesStorageDriver(StorageDriver, > OpenStackDriverMixin): > cdn_request=True) > > if response.status == httplib.NO_CONTENT: > -cdn_url = response.headers['x-cdn-uri'] > +cdn_url = response.headers['x-cdn-ssl-uri'] > return cdn_url > elif response.status == httplib.NOT_FOUND: > raise ContainerDoesNotExistError(value='', > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (LIBCLOUD-458) Use HTTPS CDN URIs for Rackspace Cloud Files
[ https://issues.apache.org/jira/browse/LIBCLOUD-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16122825#comment-16122825 ] ASF subversion and git services commented on LIBCLOUD-458: -- Commit b21787bd4f500bee9e61f700bb21b2e88bf21d1a in libcloud's branch refs/heads/trunk from [~ayleph] [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=b21787b ] Add SSL URI support for LIBCLOUD-458 Add an optional argument to retrieve the x-cdn-ssl-uri of a Cloud Files container. > Use HTTPS CDN URIs for Rackspace Cloud Files > > > Key: LIBCLOUD-458 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-458 > Project: Libcloud > Issue Type: Improvement > Components: Storage >Affects Versions: 0.14.0-beta3 >Reporter: Michael Farrell > > I found another patch in my collection, where I had patched the Rackspace > storage driver to use the HTTPS CDN URI. > I'm unsure if it may be best to have this as an option for storage drivers, > but if this option is added, it will also need to be implemented for the > other storage drivers. I would like some advice on this. > The patch that hard codes it to use HTTPS URIs always for the CDN, as a > 1-line change (ie: without the settings proposed above): > {code} > libcloud/storage/drivers/cloudfiles.py > > index 1502a33..6e7f931 100644 > @@ -273,7 +273,7 @@ class CloudFilesStorageDriver(StorageDriver, > OpenStackDriverMixin): > cdn_request=True) > > if response.status == httplib.NO_CONTENT: > -cdn_url = response.headers['x-cdn-uri'] > +cdn_url = response.headers['x-cdn-ssl-uri'] > return cdn_url > elif response.status == httplib.NOT_FOUND: > raise ContainerDoesNotExistError(value='', > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[1/8] libcloud git commit: Change syntax per flake8 recommendation
Repository: libcloud Updated Branches: refs/heads/trunk acce7791f -> 873f776cd Change syntax per flake8 recommendation Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2e8da9bb Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2e8da9bb Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2e8da9bb Branch: refs/heads/trunk Commit: 2e8da9bbd7da5add99dd0e948b3142bb12706eaf Parents: b21787b Author: aylephAuthored: Wed Jun 21 22:23:45 2017 -0700 Committer: Anthony Shaw Committed: Fri Aug 11 14:30:41 2017 +1000 -- libcloud/storage/drivers/cloudfiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2e8da9bb/libcloud/storage/drivers/cloudfiles.py -- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index 33d8301..12b2332 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -318,7 +318,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): cdn_request=True) if response.status == httplib.NO_CONTENT: -if ssl_uri == True: +if ssl_uri: cdn_url = response.headers['x-cdn-ssl-uri'] else: cdn_url = response.headers['x-cdn-uri']
[5/8] libcloud git commit: Implement get_image function for softlayer
Implement get_image function for softlayer Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/32d54fd4 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/32d54fd4 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/32d54fd4 Branch: refs/heads/trunk Commit: 32d54fd4f98ed441f224ffc9b03588e88d587558 Parents: ceffe6e Author: Francois RegnoultAuthored: Tue May 30 17:31:49 2017 +0100 Committer: Anthony Shaw Committed: Fri Aug 11 14:33:43 2017 +1000 -- libcloud/compute/drivers/softlayer.py | 19 +++ 1 file changed, 19 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/32d54fd4/libcloud/compute/drivers/softlayer.py -- diff --git a/libcloud/compute/drivers/softlayer.py b/libcloud/compute/drivers/softlayer.py index 5243d0b..f2b9db1 100644 --- a/libcloud/compute/drivers/softlayer.py +++ b/libcloud/compute/drivers/softlayer.py @@ -24,6 +24,7 @@ except ImportError: crypto = False from libcloud.common.softlayer import SoftLayerConnection, SoftLayerException +from libcloud.common.types import LibcloudError from libcloud.compute.types import Provider, NodeState from libcloud.compute.base import NodeDriver, Node, NodeLocation, NodeSize, \ NodeImage, KeyPair @@ -432,6 +433,24 @@ class SoftLayerNodeDriver(NodeDriver): ).object return [self._to_image(i) for i in result['operatingSystems']] +def get_image(self, image_id): +""" +Gets an image based on an image_id. + +:param image_id: Image identifier +:type image_id: ``str`` + +:return: A NodeImage object +:rtype: :class:`NodeImage` + +""" +images = self.list_images() +images = [image for image in images if image.id == image_id] +if len(images) < 1: +raise LibcloudError('could not find the image with id %s' % image_id) +image = images[0] +return image + def _to_size(self, id, size): return NodeSize( id=id,
[GitHub] libcloud pull request #1066: Implement get_image function for softlayer
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1066 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[6/8] libcloud git commit: Softlayer driver: Add get_image tests + change exception raised to SoftLayerException
Softlayer driver: Add get_image tests + change exception raised to SoftLayerException Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/42317090 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/42317090 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/42317090 Branch: refs/heads/trunk Commit: 4231709070f073e63f673f612b873e0f7a5c6f7c Parents: 32d54fd Author: Francois RegnoultAuthored: Thu Aug 3 12:41:15 2017 +0100 Committer: Anthony Shaw Committed: Fri Aug 11 14:33:43 2017 +1000 -- libcloud/compute/drivers/softlayer.py | 3 ++- libcloud/test/compute/test_softlayer.py | 10 ++ 2 files changed, 12 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/42317090/libcloud/compute/drivers/softlayer.py -- diff --git a/libcloud/compute/drivers/softlayer.py b/libcloud/compute/drivers/softlayer.py index f2b9db1..f5b9b15 100644 --- a/libcloud/compute/drivers/softlayer.py +++ b/libcloud/compute/drivers/softlayer.py @@ -447,7 +447,8 @@ class SoftLayerNodeDriver(NodeDriver): images = self.list_images() images = [image for image in images if image.id == image_id] if len(images) < 1: -raise LibcloudError('could not find the image with id %s' % image_id) +raise SoftLayerException('could not find the image with id %s'\ +% image_id) image = images[0] return image http://git-wip-us.apache.org/repos/asf/libcloud/blob/42317090/libcloud/test/compute/test_softlayer.py -- diff --git a/libcloud/test/compute/test_softlayer.py b/libcloud/test/compute/test_softlayer.py index 72de0df..262b2ab 100644 --- a/libcloud/test/compute/test_softlayer.py +++ b/libcloud/test/compute/test_softlayer.py @@ -73,6 +73,16 @@ class SoftLayerTests(unittest.TestCase): image = images[0] self.assertEqual(image.id, 'CENTOS_6_64') +def test_get_image(self): +image = self.driver.get_image('CENTOS_6_64') +self.assertEqual(image.id, 'CENTOS_6_64') + +def test_fail_get_image(self): +self.assertRaises( +SoftLayerException, +self.driver.get_image, +'NOT_IMAGE') + def test_list_sizes(self): sizes = self.driver.list_sizes() self.assertEqual(len(sizes), 13)
[2/8] libcloud git commit: Add SSL URI support for LIBCLOUD-458
Add SSL URI support for LIBCLOUD-458 Add an optional argument to retrieve the x-cdn-ssl-uri of a Cloud Files container. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b21787bd Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b21787bd Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b21787bd Branch: refs/heads/trunk Commit: b21787bd4f500bee9e61f700bb21b2e88bf21d1a Parents: acce779 Author: aylephAuthored: Wed Jun 21 22:13:17 2017 -0700 Committer: Anthony Shaw Committed: Fri Aug 11 14:30:41 2017 +1000 -- libcloud/storage/drivers/cloudfiles.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/b21787bd/libcloud/storage/drivers/cloudfiles.py -- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index 1a249a1..33d8301 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -310,7 +310,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): raise LibcloudError('Unexpected status code: %s' % (response.status)) -def get_container_cdn_url(self, container): +def get_container_cdn_url(self, container, ssl_uri=False): # pylint: disable=unexpected-keyword-arg container_name_encoded = self._encode_container_name(container.name) response = self.connection.request('/%s' % (container_name_encoded), @@ -318,7 +318,10 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): cdn_request=True) if response.status == httplib.NO_CONTENT: -cdn_url = response.headers['x-cdn-uri'] +if ssl_uri == True: +cdn_url = response.headers['x-cdn-ssl-uri'] +else: +cdn_url = response.headers['x-cdn-uri'] return cdn_url elif response.status == httplib.NOT_FOUND: raise ContainerDoesNotExistError(value='',
[GitHub] libcloud pull request #1076: Add SSL URI support for LIBCLOUD-458
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1076 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[3/8] libcloud git commit: Prefix non-base-class kw arg with ex_ Closes #1076
Prefix non-base-class kw arg with ex_ Closes #1076 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/29810d7a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/29810d7a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/29810d7a Branch: refs/heads/trunk Commit: 29810d7add4ec3b5530a9750e7a094033aeee7bd Parents: 2e8da9b Author: aylephAuthored: Sat Jun 24 13:34:16 2017 -0700 Committer: Anthony Shaw Committed: Fri Aug 11 14:30:43 2017 +1000 -- libcloud/storage/drivers/cloudfiles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/29810d7a/libcloud/storage/drivers/cloudfiles.py -- diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py index 12b2332..ba2ed76 100644 --- a/libcloud/storage/drivers/cloudfiles.py +++ b/libcloud/storage/drivers/cloudfiles.py @@ -310,7 +310,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): raise LibcloudError('Unexpected status code: %s' % (response.status)) -def get_container_cdn_url(self, container, ssl_uri=False): +def get_container_cdn_url(self, container, ex_ssl_uri=False): # pylint: disable=unexpected-keyword-arg container_name_encoded = self._encode_container_name(container.name) response = self.connection.request('/%s' % (container_name_encoded), @@ -318,7 +318,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin): cdn_request=True) if response.status == httplib.NO_CONTENT: -if ssl_uri: +if ex_ssl_uri: cdn_url = response.headers['x-cdn-ssl-uri'] else: cdn_url = response.headers['x-cdn-uri']
[8/8] libcloud git commit: changes for #1066
changes for #1066 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/873f776c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/873f776c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/873f776c Branch: refs/heads/trunk Commit: 873f776cd2b956fcdc3424ff887dcaa779dbb469 Parents: cb21d01 Author: Anthony ShawAuthored: Fri Aug 11 14:34:42 2017 +1000 Committer: Anthony Shaw Committed: Fri Aug 11 14:34:42 2017 +1000 -- CHANGES.rst | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/873f776c/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index 4e94d6d..fb0fa64 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,13 @@ Common [GITHUB-1085] (Francisco Ros) +Compute +~~~ + +- [SOFTLAYER] Add `get_image` method to class + [GITHUB-1066] + (Francois Regnoult) + Storage ~~~
[7/8] libcloud git commit: Softlayer driver: fix flake8 styling Closes #1066
Softlayer driver: fix flake8 styling Closes #1066 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cb21d010 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cb21d010 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cb21d010 Branch: refs/heads/trunk Commit: cb21d010dddaf482200c3f8b6fef482b938a53ac Parents: 4231709 Author: Francois RegnoultAuthored: Thu Aug 3 12:56:11 2017 +0100 Committer: Anthony Shaw Committed: Fri Aug 11 14:33:46 2017 +1000 -- libcloud/compute/drivers/softlayer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/cb21d010/libcloud/compute/drivers/softlayer.py -- diff --git a/libcloud/compute/drivers/softlayer.py b/libcloud/compute/drivers/softlayer.py index f5b9b15..3d8dbb5 100644 --- a/libcloud/compute/drivers/softlayer.py +++ b/libcloud/compute/drivers/softlayer.py @@ -24,7 +24,6 @@ except ImportError: crypto = False from libcloud.common.softlayer import SoftLayerConnection, SoftLayerException -from libcloud.common.types import LibcloudError from libcloud.compute.types import Provider, NodeState from libcloud.compute.base import NodeDriver, Node, NodeLocation, NodeSize, \ NodeImage, KeyPair @@ -447,8 +446,8 @@ class SoftLayerNodeDriver(NodeDriver): images = self.list_images() images = [image for image in images if image.id == image_id] if len(images) < 1: -raise SoftLayerException('could not find the image with id %s'\ -% image_id) +raise SoftLayerException('could not find the image with id %s' + % image_id) image = images[0] return image
[4/8] libcloud git commit: changes for #1076
changes for #1076 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ceffe6e5 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ceffe6e5 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ceffe6e5 Branch: refs/heads/trunk Commit: ceffe6e5441b6784c21f0620c3c0f53aca536e03 Parents: 29810d7 Author: Anthony ShawAuthored: Fri Aug 11 14:32:25 2017 +1000 Committer: Anthony Shaw Committed: Fri Aug 11 14:32:25 2017 +1000 -- CHANGES.rst | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ceffe6e5/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index 544a4eb..4e94d6d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,13 @@ Common [GITHUB-1085] (Francisco Ros) +Storage +~~~ + +- [CLOUDFILES] Add SSL URI support + [GITHUB-1076, LIBCLOUD-458] + (@ayleph) + Changes in Apache Libcloud 2.1.0
libcloud git commit: Add missing test_requirement "requests_mock" to setup.py Closes #1086
Repository: libcloud Updated Branches: refs/heads/trunk 3dbf50b07 -> acce7791f Add missing test_requirement "requests_mock" to setup.py Closes #1086 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/acce7791 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/acce7791 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/acce7791 Branch: refs/heads/trunk Commit: acce7791fe0bd7c7c5940e07dbfcec05b5e88a5c Parents: 3dbf50b Author: Felix YanAuthored: Thu Jul 20 14:34:30 2017 +0800 Committer: Anthony Shaw Committed: Fri Aug 11 14:28:23 2017 +1000 -- setup.py | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/acce7791/setup.py -- diff --git a/setup.py b/setup.py index 218f4f8..f9be490 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ SUPPORTED_VERSIONS = ['2.6', '2.7', 'PyPy', '3.x'] TEST_REQUIREMENTS = [ 'mock', 'requests', +'requests_mock', 'pytest', 'pytest-runner' ]
[GitHub] libcloud pull request #1086: Add missing test_requirement "requests_mock" to...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1086 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---