[GitHub] libcloud pull request #1266: Dummy Node ID doesn't allow 0

2018-12-04 Thread utam0k
GitHub user utam0k opened a pull request:

https://github.com/apache/libcloud/pull/1266

Dummy Node ID doesn't allow 0

## Dummy Node ID doesn't allow 0

### Description

If Dummy Node ID is `0`, it sets `None` when Node init.
Refs: 
https://github.com/apache/libcloud/blob/v2.4.0/libcloud/compute/base.py#L205
I think this is not the expected behavior.
So, I did not to allow it is `0`.

Before
```
[(None, 'dummy-0'), ('1', 'dummy-1'), ('2', 'dummy-2')]
```
After
```
[('1', 'dummy-1'), ('2', 'dummy-2')]
```

### Status
- done, ready for review

### Checklist (tick everything that applies)

- [x] [Code 
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
 (required, can be done after the PR checks)
- [x] Documentation
- [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
- [x] 
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
 (required for bigger changes)


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/utam0k/libcloud trunk

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/libcloud/pull/1266.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1266


commit beb4de39a763cdcd018ce2cef06407ccb8f67ec7
Author: utam0k 
Date:   2018-12-05T05:17:36Z

Dummy Node ID doesn't allow 0




---


[GitHub] libcloud pull request #1265: Override the auth header for the VCloud 5.5 Con...

2018-12-04 Thread cheald
GitHub user cheald opened a pull request:

https://github.com/apache/libcloud/pull/1265

Override the auth header for the VCloud 5.5 Connection

## Override the auth header for the VCloud 5.5 Connection

### Description

Newer VCD installs (I'm working against API level 30.0, for reference) 
enforce a minimum API level on authentication. This simply causes the 
authentication payload to send a version 5.5 header rather than a version 1.5 
header, so our auth request isn't rejected.

### Status

done, ready for review

### Checklist (tick everything that applies)

- [x] [Code 
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
 (required, can be done after the PR checks)
- [ ] Documentation
- [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
- [ ] 
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
 (required for bigger changes)


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cheald/libcloud vcloud-5-5-auth-header

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/libcloud/pull/1265.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1265


commit 508cc3c0baaa7320193e3c4c74aa91407594f983
Author: Chris Heald 
Date:   2018-12-04T16:50:43Z

Override the auth header for the VCloud 5.5 Connection

Newer VCD installs enforce a minimum API level on authentication. This
simply causes the authentication payload to send a version 5.5 header
rather than a version 1.5 header, so our auth request isn't rejected.




---


[1/2] libcloud git commit: list calls paginate in OpenStackNodeDriver

2018-12-04 Thread vdloo
Repository: libcloud
Updated Branches:
  refs/heads/trunk a4d0081b2 -> 1a3ebe5d6


list calls paginate in OpenStackNodeDriver

the default max_limits for OpenStack is 1000. If you have more than 1000
resources (i.e. snapshots) then everything but the newest 1000 will not be
listed. If you set the max_limits lower even less will not be returned, etc.
This change implements pagination for ex_list_snapshots, ex_list_ports,
list_volumes and list_nodes in the OpenStack_2_NodeDriver.

Signed-off-by: Rick van de Loo 


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

Branch: refs/heads/trunk
Commit: 1aaeff4537dbe23886cff505ef3f5c708d823995
Parents: a4d0081
Author: Rick van de Loo 
Authored: Wed Nov 28 17:29:45 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 10:49:30 2018 +0100

--
 libcloud/compute/drivers/openstack.py   | 84 ++--
 .../openstack_v1.1/_v2_0__snapshots.json|  2 +-
 .../_v2_0__snapshots_paginate_start.json| 52 
 libcloud/test/compute/test_openstack.py | 36 -
 4 files changed, 163 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1aaeff45/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 5affde6..1d2ba4b 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -31,6 +31,7 @@ from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import b
 from libcloud.utils.py3 import next
 from libcloud.utils.py3 import urlparse
+from libcloud.utils.py3 import parse_qs
 
 
 from libcloud.common.openstack import OpenStackBaseConnection
@@ -70,6 +71,8 @@ ATOM_NAMESPACE = "http://www.w3.org/2005/Atom;
 
 DEFAULT_API_VERSION = '1.1'
 
+PAGINATION_LIMIT = 1000
+
 
 class OpenStackComputeConnection(OpenStackBaseConnection):
 # default config for http://devstack.org/
@@ -169,6 +172,57 @@ class OpenStackNodeDriver(NodeDriver, 
OpenStackDriverMixin):
 OpenStackDriverMixin.__init__(self, **kwargs)
 super(OpenStackNodeDriver, self).__init__(*args, **kwargs)
 
+@staticmethod
+def _paginated_request(url, obj, connection, params=None):
+"""
+Perform multiple calls in order to have a full list of elements when
+the API responses are paginated.
+
+:param url: API endpoint
+:type url: ``str``
+
+:param obj: Result object key
+:type obj: ``str``
+
+:param connection: The API connection to use to perform the request
+:type connection: ``obj``
+
+:param params: Any request parameters
+:type params: ``dict``
+
+:return: ``list`` of API response objects
+:rtype: ``list``
+"""
+params = params or {}
+objects = list()
+loop_count = 0
+while True:
+data = connection.request(url, params=params)
+values = data.object.get(obj, list())
+objects.extend(values)
+links = data.object.get('%s_links' % obj, list())
+next_links = [n for n in links if n['rel'] == 'next']
+if next_links:
+next_link = next_links[0]
+query = urlparse.urlparse(next_link['href'])
+# The query[4] references the query parameters from the url
+params.update(parse_qs(query[4]))
+else:
+break
+
+# Prevent the pagination from looping indefinitely in case
+# the API returns a loop for some reason.
+loop_count += 1
+if loop_count > PAGINATION_LIMIT:
+raise OpenStackException(
+'Pagination limit reached for %s, the limit is %d. '
+'This might indicate that your API is returning a '
+'looping next target for pagination!' % (
+url, PAGINATION_LIMIT
+), None
+)
+return {obj: objects}
+
 def destroy_node(self, node):
 uri = '/servers/%s' % (node.id)
 resp = self.connection.request(uri, method='DELETE')
@@ -2699,6 +2753,21 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 )
 )
 
+def list_nodes(self, ex_all_tenants=False):
+"""
+List the nodes in a tenant
+
+:param ex_all_tenants: List nodes for all the tenants. Note: Your user
+   must have admin privileges for this
+  

[GitHub] libcloud pull request #1263: Pagination in various OpenStack_2_NodeDriver me...

2018-12-04 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/libcloud/pull/1263


---


[2/2] libcloud git commit: Add changes for #1263

2018-12-04 Thread vdloo
Add changes for #1263

Closes #1263


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

Branch: refs/heads/trunk
Commit: 1a3ebe5d60de6475a8a2384d864475de0abd73cf
Parents: 1aaeff4
Author: Rick van de Loo 
Authored: Tue Dec 4 10:50:38 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 10:50:38 2018 +0100

--
 CHANGES.rst | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a3ebe5d/CHANGES.rst
--
diff --git a/CHANGES.rst b/CHANGES.rst
index 904dc9b..952d4c7 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -25,6 +25,9 @@ Compute
 - [OpenStack] Implement OpenStack_1_1_NodeDriver ex_get_snapshot (GITHUB-1257)
   [Rick van de Loo]
 
+- [OpenStack] Pagination in various OpenStack_2_NodeDriver methods 
(GITHUB-1263)
+  [Rick van de Loo]
+
 - [OpenStack] Implement OpenStack_2_NodeDriver ex_create_subnet (LIBCLOUD-874, 
GITHUB-1242)
   [Miguel Caballer]
 



[11/23] libcloud git commit: Move sec groups to neutron api LIBCLOUD-874

2018-12-04 Thread vdloo
Move sec groups to neutron api LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: f05ff35bfcf021cc12cf613a3927fcc2d764d16d
Parents: d66638a
Author: micafer 
Authored: Mon Sep 24 17:13:29 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py   | 44 +++-
 .../openstack_v1.1/_v2_0__security_group.json   | 20 +
 .../openstack_v1.1/_v2_0__security_groups.json  | 29 +
 libcloud/test/compute/test_openstack.py | 13 --
 4 files changed, 102 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f05ff35b/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index df42acd..20826dc 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1816,7 +1816,8 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 security_groups]
 
 def _to_security_group(self, obj):
-rules = self._to_security_group_rules(obj.get('rules', []))
+rules = self._to_security_group_rules(obj.get('security_group_rules',
+  obj.get('rules', [])))
 return OpenStackSecurityGroup(id=obj['id'],
   tenant_id=obj['tenant_id'],
   name=obj['name'],
@@ -3118,6 +3119,47 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 return resp.status == httplib.ACCEPTED
 
 
+def ex_list_security_groups(self):
+"""
+Get a list of Security Groups that are available.
+
+:rtype: ``list`` of :class:`OpenStackSecurityGroup`
+"""
+return self._to_security_groups(
+self.network_connection.request('/v2.0/security-groups').object)
+
+def ex_create_security_group(self, name, description):
+"""
+Create a new Security Group
+
+:param name: Name of the new Security Group
+:type  name: ``str``
+
+:param description: Description of the new Security Group
+:type  description: ``str``
+
+:rtype: :class:`OpenStackSecurityGroup`
+"""
+return self._to_security_group(self.network_connection .request(
+'/v2.0/security-groups', method='POST',
+data={'security_group': {'name': name, 'description': description}}
+).object['security_group'])
+
+def ex_delete_security_group(self, security_group):
+"""
+Delete a Security Group.
+
+:param security_group: Security Group should be deleted
+:type  security_group: :class:`OpenStackSecurityGroup`
+
+:rtype: ``bool``
+"""
+resp = self.network_connection.request('/v2.0/security-groups/%s' %
+   (security_group.id),
+   method='DELETE')
+return resp.status==httplib.NO_CONTENT
+
+
 class OpenStack_1_1_FloatingIpPool(object):
 """
 Floating IP Pool info.

http://git-wip-us.apache.org/repos/asf/libcloud/blob/f05ff35b/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__security_group.json
--
diff --git 
a/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__security_group.json 
b/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__security_group.json
new file mode 100644
index 000..df20ef4
--- /dev/null
+++ b/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__security_group.json
@@ -0,0 +1,20 @@
+{
+"security_group":
+{
+"description": "FTP Client-Server - Open 20-21 ports", 
+"id": 4, 
+"name": "ftp", 
+"security_group_rules": [
+{
+"security_group_id": "4",
+"direction": "ingress",
+"port_range_max": 21, 
+"port_range_min": 20, 
+"remote_ip_prefix": "0.0.0.0/0", 
+"id": 1, 
+"protocol": "tcp"
+}
+], 
+"tenant_id": "68"
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/f05ff35b/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__security_groups.json
--
diff --git 

[22/23] libcloud git commit: Fix error in ex_list_ports if created_at is not in result

2018-12-04 Thread vdloo
Fix error in ex_list_ports if created_at is not in result

Signed-off-by: Rick van de Loo 


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

Branch: refs/heads/trunk
Commit: 23e8d08439f430d74524fdafd4a67f5fff84f339
Parents: 85b6f4a
Author: micafer 
Authored: Thu Nov 29 16:47:54 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:47:53 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/23e8d084/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 5a64f26..5affde6 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2668,7 +2668,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 super(OpenStack_2_NodeDriver, self).__init__(*args, **kwargs)
 
 def _to_port(self, element):
-created = element['created_at']
+created = element.get('created_at')
 updated = element.get('updated_at')
 return OpenStack_2_PortInterface(
 id=element['id'],



[23/23] libcloud git commit: Add changes for #1241

2018-12-04 Thread vdloo
Add changes for #1241

Closes #1242


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

Branch: refs/heads/trunk
Commit: a4d0081b2a6a79917d493fcfd52eb6497635a1f8
Parents: 23e8d08
Author: Rick van de Loo 
Authored: Tue Dec 4 09:49:19 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:49:19 2018 +0100

--
 CHANGES.rst | 51 +++
 1 file changed, 51 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a4d0081b/CHANGES.rst
--
diff --git a/CHANGES.rst b/CHANGES.rst
index de08d85..904dc9b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -25,6 +25,57 @@ Compute
 - [OpenStack] Implement OpenStack_1_1_NodeDriver ex_get_snapshot (GITHUB-1257)
   [Rick van de Loo]
 
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_create_subnet (LIBCLOUD-874, 
GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_delete_subnet (LIBCLOUD-874, 
GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver list_volumes (LIBCLOUD-874, 
GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_get_volume (LIBCLOUD-874, 
GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver create_volume (LIBCLOUD-874, 
GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver destroy_volume (LIBCLOUD-874, 
GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_list_snapshots 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver create_volume_snapshot 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver destroy_volume_snapshot 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_list_security_groups 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_create_security_group 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_delete_security_group 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_create_security_group_rule 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_delete_security_group_rule 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Implement OpenStack_2_NodeDriver ex_list_floating_ip_pools 
(LIBCLOUD-874, GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Fix parse_error if 'code' not in API response message 
(GITHUB-1242)
+  [Miguel Caballer]
+
+- [OpenStack] Adapt _to_port function to work with old OpenStack versions 
(GITHUB-1242)
+  [Miguel Caballer]
+
 - [UpCloud] Update documentation for UpCloud driver (LIBCLOUD-1026, 
GITHUB-1259)
   [Ilari Mäkelä]
 



[14/23] libcloud git commit: Remove print

2018-12-04 Thread vdloo
Remove print


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

Branch: refs/heads/trunk
Commit: 119cfa83f61419da5cade80ec9f63fb9f54601b6
Parents: d34b3f0
Author: micafer 
Authored: Tue Sep 25 16:38:45 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/common/openstack.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/119cfa83/libcloud/common/openstack.py
--
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index db9f43f..6e7d5b5 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -390,7 +390,7 @@ class OpenStackResponse(Response):
 context = self.connection.context
 driver = self.connection.driver
 key_pair_name = context.get('key_pair_name', None)
-print(values)
+
 if len(values) > 0 and 'code' in values[0] and \
 values[0]['code'] == 404 and key_pair_name:
 raise KeyPairDoesNotExistError(name=key_pair_name,



[19/23] libcloud git commit: Improve comment

2018-12-04 Thread vdloo
Improve comment


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

Branch: refs/heads/trunk
Commit: 6df2a52572b27d7efb1d8ae85220cc8ca46ccf88
Parents: e5a6986
Author: micafer 
Authored: Wed Nov 28 16:37:19 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6df2a525/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 3aebda3..71bef6a 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2600,10 +2600,9 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 network_connectionCls = OpenStack_2_NetworkConnection
 network_connection = None
 
-# Similarly not all node-related operations are exposed through the
-# compute API
-# See https://developer.openstack.org/api-ref/compute/
-# For example, volume management are made in the cinder service
+# Similarly all image operations are noe exposed through the block-storage
+# API of the cinde service:
+# https://developer.openstack.org/api-ref/block-storage/
 volumev2_connectionCls = OpenStack_2_VolumeV2Connection
 volumev2_connection = None
 



[21/23] libcloud git commit: Solve PR issues

2018-12-04 Thread vdloo
Solve PR issues


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

Branch: refs/heads/trunk
Commit: 9c0da3dd4655ee7c58fee2c709670bec518c6354
Parents: a2faa55
Author: micafer 
Authored: Tue Oct 23 13:05:07 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9c0da3dd/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index b5914ff..868ae09 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2220,27 +2220,26 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 
 return StorageVolume(
 id=api_node['id'],
-name=api_node.get('name', api_node.get('displayName', None)),
+name=api_node.get('name', api_node.get('displayName')),
 size=api_node['size'],
 state=state,
 driver=self,
 extra={
 'description': api_node.get('description',
-api_node.get('displayDescription',
- None)),
+api_node.get('displayDescription')
+),
 'attachments': [att for att in api_node['attachments'] if att],
 # TODO: remove in 1.18.0
 'state': api_node.get('status', None),
 'snapshot_id': api_node.get('snapshot_id',
-api_node.get('snapshotId', None)),
+api_node.get('snapshotId')),
 'location': api_node.get('availability_zone',
- api_node.get('availabilityZone',
-  None)),
+ api_node.get('availabilityZone')),
 'volume_type': api_node.get('volume_type',
-api_node.get('volumeType', None)),
+api_node.get('volumeType')),
 'metadata': api_node.get('metadata', None),
 'created_at': api_node.get('created_at',
-   api_node.get('createdAt', None))
+   api_node.get('createdAt'))
 }
 )
 
@@ -3166,6 +3165,14 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
  data=data).object)
 
 def destroy_volume_snapshot(self, snapshot):
+"""
+Delete a Volume Snapshot.
+
+:param snapshot: Snapshot to be deleted
+:type  snapshot: :class:`VolumeSnapshot`
+
+:rtype: ``bool``
+"""
 resp = self.volumev2_connection.request('/snapshots/%s' % snapshot.id,
 method='DELETE')
 return resp.status in (httplib.NO_CONTENT, httplib.ACCEPTED)
@@ -3423,7 +3430,7 @@ class OpenStack_1_1_FloatingIpAddress(object):
 % (self.id, self.ip_address, self.pool, self.driver))
 
 
-class OpenStack_2_FloatingIpPool(OpenStack_1_1_FloatingIpPool):
+class OpenStack_2_FloatingIpPool(object):
 """
 Floating IP Pool info.
 """



[12/23] libcloud git commit: Fix _to_port to make it work with old versions

2018-12-04 Thread vdloo
Fix _to_port to make it work with old versions


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

Branch: refs/heads/trunk
Commit: d34b3f0734befd1dfd8b7c044af5cf911bcd69b9
Parents: 84aa986
Author: micafer 
Authored: Tue Sep 25 16:24:14 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/d34b3f07/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index fb92dab..ebcefc2 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2692,11 +2692,12 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 mac_address=element['mac_address'],
 name=element['name'],
 network_id=element['network_id'],
-project_id=element['project_id'],
-port_security_enabled=element['port_security_enabled'],
-revision_number=element['revision_number'],
+project_id=element.get('project_id', None),
+port_security_enabled=element.get('port_security_enabled',
+  None),
+revision_number=element.get('revision_number', None),
 security_groups=element['security_groups'],
-tags=element['tags'],
+tags=element.get('tags', None),
 tenant_id=element['tenant_id'],
 updated=updated,
 )
@@ -3402,8 +3403,9 @@ class 
OpenStack_2_FloatingIpPool(OpenStack_1_1_FloatingIpPool):
 def _to_floating_ip(self, obj):
 instance_id = None
 
+print(obj)
 # In neutron version prior to 13.0.0 port_details does not exists
-if 'port_details' not in obj and 'port_id' in obj:
+if 'port_details' not in obj and 'port_id' in obj and obj['port_id']:
 port = self.connection.driver.ex_get_port(obj['port_id'])
 if port:
 obj['port_details'] = {"device_id": port.extra["device_id"],



[20/23] libcloud git commit: Complete docstring

2018-12-04 Thread vdloo
Complete docstring


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

Branch: refs/heads/trunk
Commit: e5a69865a0f00d545158a2e593e6c034ea153337
Parents: 33728b2
Author: micafer 
Authored: Wed Nov 28 16:03:39 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 26 ++
 1 file changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e5a69865/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index f244f91..3aebda3 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -3064,10 +3064,23 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 return self._to_port(response.object['port'])
 
 def list_volumes(self):
+"""
+Get a list of Volumes that are available.
+
+:rtype: ``list`` of :class:`StorageVolume`
+"""
 return self._to_volumes(
 self.volumev2_connection.request('/volumes/detail').object)
 
 def ex_get_volume(self, volumeId):
+"""
+Retrieve the StorageVolume with the given ID
+
+:param volumeId: ID of the volume
+:type volumeId: ``string``
+
+:return: :class:`StorageVolume`
+"""
 return self._to_volume(
 self.volumev2_connection.request('/volumes/%s' % volumeId).object)
 
@@ -3122,10 +3135,23 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 return self._to_volume(resp.object)
 
 def destroy_volume(self, volume):
+"""
+Delete a Volume.
+
+:param volume: Volume to be deleted
+:type  volume: :class:`StorageVolume`
+
+:rtype: ``bool``
+"""
 return self.volumev2_connection.request('/volumes/%s' % volume.id,
 method='DELETE').success()
 
 def ex_list_snapshots(self):
+"""
+Get a list of Snapshot that are available.
+
+:rtype: ``list`` of :class:`VolumeSnapshot`
+"""
 return self._to_snapshots(
 self.volumev2_connection.request('/snapshots/detail').object)
 



[13/23] libcloud git commit: Update comment

2018-12-04 Thread vdloo
Update comment


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

Branch: refs/heads/trunk
Commit: 830a0f83742b40226790f021cd15b8e19893b75f
Parents: 119cfa8
Author: micafer 
Authored: Tue Sep 25 16:54:01 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/830a0f83/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index ebcefc2..7e78d42 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -3273,7 +3273,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 """
 List available floating IP pools
 
-:rtype: ``list`` of :class:`OpenStack_1_1_FloatingIpPool`
+:rtype: ``list`` of :class:`OpenStack_2_FloatingIpPool`
 """
 return self._to_floating_ip_pools(
 self.network_connection.request('/v2.0/networks?router:external'



[15/23] libcloud git commit: add direction in security_group_rule creation

2018-12-04 Thread vdloo
add direction in security_group_rule creation

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

Branch: refs/heads/trunk
Commit: 33e694f37876693ec2bcb772684900f1ef3d38a1
Parents: 830a0f8
Author: Miguel Caballer 
Authored: Fri Sep 28 08:44:55 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/33e694f3/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 7e78d42..0de0ab3 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -3240,6 +3240,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 return self._to_security_group_rule(self.network_connection.request(
 '/v2.0/security-group-rules', method='POST',
 data={'security_group_rule': {
+'direction': 'ingress',
 'protocol': ip_protocol,
 'port_range_min': from_port,
 'port_range_max': to_port,



[18/23] libcloud git commit: Move sec groups to neutron api LIBCLOUD-874

2018-12-04 Thread vdloo
Move sec groups to neutron api LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: 2b2e1f1a4570b2e36f621062389f1cc521dd4ea3
Parents: f05ff35
Author: micafer 
Authored: Tue Sep 25 08:57:05 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py   | 114 +--
 .../openstack_v1.1/_v2_0__security_group.json   |  18 +--
 .../_v2_0__security_group_rule.json |  13 +++
 .../openstack_v1.1/_v2_0__security_groups.json  |   2 +-
 libcloud/test/compute/test_openstack.py |  24 +++-
 5 files changed, 146 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b2e1f1a/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 20826dc..de6d445 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1112,7 +1112,7 @@ class OpenStackSecurityGroupRule(object):
 
 def __init__(self, id, parent_group_id, ip_protocol, from_port, to_port,
  driver, ip_range=None, group=None, tenant_id=None,
- extra=None):
+ direction=None, extra=None):
 """
 Constructor.
 
@@ -1140,6 +1140,9 @@ class OpenStackSecurityGroupRule(object):
 :keywordtenant_id: Owner of the security group.
 :type   tenant_id: ``str``
 
+:keyworddirection: Security group Direction (ingress or egress).
+:type   direction: ``str``
+
 :keywordextra: Extra attributes associated with this rule.
 :type   extra: ``dict``
 """
@@ -1151,12 +1154,21 @@ class OpenStackSecurityGroupRule(object):
 self.driver = driver
 self.ip_range = ''
 self.group = {}
+self.direction = 'ingress'
 
 if group is None:
 self.ip_range = ip_range
 else:
 self.group = {'name': group, 'tenant_id': tenant_id}
 
+# by default in old versions only ingress was used
+if direction is not None:
+if direction in ['ingress', 'egress']:
+self.direction = direction
+else:
+raise OpenStackException("Security group direction incorrect "
+ "value: ingress or egress.")
+
 self.tenant_id = tenant_id
 self.extra = extra or {}
 
@@ -1678,7 +1690,7 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 resp = self.connection.request('%s/%s' % (self._networks_url_prefix,
   network.id),
method='DELETE')
-return resp.status == httplib.ACCEPTED
+return resp.status in (httplib.NO_CONTENT, httplib.ACCEPTED)
 
 def ex_get_console_output(self, node, length=None):
 """
@@ -1840,6 +1852,8 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 
 :rtype: ``list`` of :class:`OpenStackSecurityGroup`
 """
+print(vars(self.connection.request(
+'/servers/%s/os-security-groups' % (node.id
 return self._to_security_groups(
 self.connection.request('/servers/%s/os-security-groups' %
 (node.id)).object)
@@ -3116,8 +3130,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 def destroy_volume_snapshot(self, snapshot):
 resp = self.volumev2_connection.request('/snapshots/%s' % snapshot.id,
 method='DELETE')
-return resp.status == httplib.ACCEPTED
-
+return resp.status in (httplib.NO_CONTENT, httplib.ACCEPTED)
 
 def ex_list_security_groups(self):
 """
@@ -3155,9 +3168,96 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 :rtype: ``bool``
 """
 resp = self.network_connection.request('/v2.0/security-groups/%s' %
-   (security_group.id),
-   method='DELETE')
-return resp.status==httplib.NO_CONTENT
+   (security_group.id),
+   method='DELETE')
+return resp.status == httplib.NO_CONTENT
+
+def _to_security_group_rule(self, obj):
+ip_range = group = tenant_id = parent_id = None
+protocol = from_port = to_port = direction = None
+
+if 

[jira] [Commented] (LIBCLOUD-874) Does Libcloud have plans to support new versions of OpenStack?

2018-12-04 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/LIBCLOUD-874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708414#comment-16708414
 ] 

ASF GitHub Bot commented on LIBCLOUD-874:
-

Github user asfgit closed the pull request at:

https://github.com/apache/libcloud/pull/1242


> Does Libcloud have plans to support new versions of OpenStack?
> --
>
> Key: LIBCLOUD-874
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-874
> Project: Libcloud
>  Issue Type: Improvement
>Reporter: Jim
>Priority: Blocker
>
> In the latest version 1.3.0, Libcloud still use Nova API to provide the 
> image, network and volume functions, which are deprecated in current 
> OpenStack verison. Does Libcloud have plans to support Glance v2, Neutron 
> v2.0 and Cinder v2 API for OpenStack?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[01/23] libcloud git commit: Fix OpenStackException issue

2018-12-04 Thread vdloo
Repository: libcloud
Updated Branches:
  refs/heads/trunk cd2faa7f9 -> a4d0081b2


Fix OpenStackException issue


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

Branch: refs/heads/trunk
Commit: 85b6f4a29c91dca6631dbff7cc25225f60cb70ba
Parents: 6df2a52
Author: micafer 
Authored: Thu Nov 29 08:16:38 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/85b6f4a2/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 71bef6a..5a64f26 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1168,7 +1168,8 @@ class OpenStackSecurityGroupRule(object):
 self.direction = direction
 else:
 raise OpenStackException("Security group direction incorrect "
- "value: ingress or egress.")
+ "value: ingress or egress.", 500,
+ driver)
 
 self.tenant_id = tenant_id
 self.extra = extra or {}



[08/23] libcloud git commit: Add cinder support LIBCLOUD-874

2018-12-04 Thread vdloo
Add cinder support LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: 2d9e862382735e6818c01b0972758b12a6297f31
Parents: 3c93d26
Author: micafer 
Authored: Mon Sep 24 16:10:39 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py   | 14 +++
 libcloud/test/common/test_openstack_identity.py |  9 +++--
 .../compute/fixtures/openstack/_v2_0__auth.json | 22 ++
 libcloud/test/compute/test_openstack.py | 42 
 4 files changed, 76 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2d9e8623/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index fba9a8a..9bd80cc 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -3015,11 +3015,11 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 
 def list_volumes(self):
 return self._to_volumes(
-self.connection.request('/volumes/detail').object)
+self.volumev2_connection.request('/volumes/detail').object)
 
 def ex_get_volume(self, volumeId):
 return self._to_volume(
-self.connection.request('/volumes/%s' % volumeId).object)
+self.volumev2_connection.request('/volumes/%s' % volumeId).object)
 
 def create_volume(self, size, name, location=None, snapshot=None,
   ex_volume_type=None):
@@ -3066,18 +3066,18 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 if snapshot:
 volume['snapshot_id'] = snapshot.id
 
-resp = self.connection.request('/volumes',
+resp = self.volumev2_connection.request('/volumes',
method='POST',
data={'volume': volume})
 return self._to_volume(resp.object)
 
 def destroy_volume(self, volume):
-return self.connection.request('/volumes/%s' % volume.id,
+return self.volumev2_connection.request('/volumes/%s' % volume.id,
method='DELETE').success()
 
 def ex_list_snapshots(self):
 return self._to_snapshots(
-self.connection.request('/snapshots/detail').object)
+self.volumev2_connection.request('/snapshots/detail').object)
 
 def create_volume_snapshot(self, volume, name=None, ex_description=None,
ex_force=True):
@@ -3108,12 +3108,12 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 if ex_description is not None:
 data['snapshot']['description'] = ex_description
 
-return self._to_snapshot(self.connection.request('/snapshots',
+return self._to_snapshot(self.volumev2_connection.request('/snapshots',
  method='POST',
  data=data).object)
 
 def destroy_volume_snapshot(self, snapshot):
-resp = self.connection.request('/snapshots/%s' % snapshot.id,
+resp = self.volumev2_connection.request('/snapshots/%s' % snapshot.id,
method='DELETE')
 return resp.status == httplib.ACCEPTED
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2d9e8623/libcloud/test/common/test_openstack_identity.py
--
diff --git a/libcloud/test/common/test_openstack_identity.py 
b/libcloud/test/common/test_openstack_identity.py
index 3ed77bb..c93cee3 100644
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -544,7 +544,7 @@ class OpenStackServiceCatalogTestCase(unittest.TestCase):
 catalog = OpenStackServiceCatalog(service_catalog=service_catalog,
   auth_version='2.0')
 entries = catalog.get_entries()
-self.assertEqual(len(entries), 8)
+self.assertEqual(len(entries), 9)
 
 entry = [e for e in entries if e.service_name == 'cloudServers'][0]
 self.assertEqual(entry.service_type, 'compute')
@@ -611,7 +611,8 @@ class OpenStackServiceCatalogTestCase(unittest.TestCase):
   auth_version='2.0')
 service_types = catalog.get_service_types()
 self.assertEqual(service_types, ['compute', 'image', 'network',
-  

[04/23] libcloud git commit: Move floatingips to neutron api LIBCLOUD-874

2018-12-04 Thread vdloo
Move floatingips to neutron api LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: 84aa986ff8c21db2e547b22c117cbff3795204dd
Parents: 2b2e1f1
Author: micafer 
Authored: Tue Sep 25 15:35:28 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/common/openstack.py|   5 +-
 libcloud/compute/drivers/openstack.py   | 122 ++-
 .../openstack_v1.1/_v2_0__floatingip.json   |  23 
 .../openstack_v1.1/_v2_0__floatingips.json  |  52 
 .../openstack_v1.1/_v2_0__networks_public.json  |  64 ++
 libcloud/test/compute/test_openstack.py |  70 ++-
 6 files changed, 329 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/84aa986f/libcloud/common/openstack.py
--
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index b64f669..db9f43f 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -390,8 +390,9 @@ class OpenStackResponse(Response):
 context = self.connection.context
 driver = self.connection.driver
 key_pair_name = context.get('key_pair_name', None)
-
-if len(values) > 0 and values[0]['code'] == 404 and key_pair_name:
+print(values)
+if len(values) > 0 and 'code' in values[0] and \
+values[0]['code'] == 404 and key_pair_name:
 raise KeyPairDoesNotExistError(name=key_pair_name,
driver=driver)
 elif len(values) > 0 and 'message' in values[0]:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/84aa986f/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index de6d445..fb92dab 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -59,6 +59,7 @@ __all__ = [
 'OpenStack_1_1_Connection',
 'OpenStack_1_1_NodeDriver',
 'OpenStack_1_1_FloatingIpPool',
+'OpenStack_2_FloatingIpPool',
 'OpenStack_1_1_FloatingIpAddress',
 'OpenStack_2_PortInterfaceState',
 'OpenStack_2_PortInterface',
@@ -3255,10 +3256,29 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 
 :rtype: ``bool``
 """
-resp = self.connection.request('/v2.0/security-group-rules/%s' %
-   (rule.id), method='DELETE')
+resp = self.network_connection.request(
+'/v2.0/security-group-rules/%s' % (rule.id), method='DELETE')
 return resp.status == httplib.NO_CONTENT
 
+def _to_floating_ip_pool(self, obj):
+return OpenStack_2_FloatingIpPool(obj['id'], obj['name'],
+  self.network_connection)
+
+def _to_floating_ip_pools(self, obj):
+pool_elements = obj['networks']
+return [self._to_floating_ip_pool(pool) for pool in pool_elements]
+
+def ex_list_floating_ip_pools(self):
+"""
+List available floating IP pools
+
+:rtype: ``list`` of :class:`OpenStack_1_1_FloatingIpPool`
+"""
+return self._to_floating_ip_pools(
+self.network_connection.request('/v2.0/networks?router:external'
+'=True=id='
+'name').object)
+
 
 class OpenStack_1_1_FloatingIpPool(object):
 """
@@ -3365,6 +3385,104 @@ class OpenStack_1_1_FloatingIpAddress(object):
 % (self.id, self.ip_address, self.pool, self.driver))
 
 
+class OpenStack_2_FloatingIpPool(OpenStack_1_1_FloatingIpPool):
+"""
+Floating IP Pool info.
+"""
+
+def __init__(self, id, name, connection):
+self.id = id
+self.name = name
+self.connection = connection
+
+def _to_floating_ips(self, obj):
+ip_elements = obj['floatingips']
+return [self._to_floating_ip(ip) for ip in ip_elements]
+
+def _to_floating_ip(self, obj):
+instance_id = None
+
+# In neutron version prior to 13.0.0 port_details does not exists
+if 'port_details' not in obj and 'port_id' in obj:
+port = self.connection.driver.ex_get_port(obj['port_id'])
+if port:
+obj['port_details'] = {"device_id": port.extra["device_id"],
+   "device_owner":
+  

[03/23] libcloud git commit: Fix conn issues

2018-12-04 Thread vdloo
Fix conn issues


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

Branch: refs/heads/trunk
Commit: 8b19d31ab53595014c0791b85663478767ad0f82
Parents: 9c0da3d
Author: micafer 
Authored: Tue Oct 23 16:34:43 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8b19d31a/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 868ae09..da17e6c 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2931,8 +2931,8 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 """
 data = {'subnet': {'cidr': cidr, 'network_id': network.id,
'ip_version': ip_version, 'name': name}}
-response = self.connection.request(self._subnets_url_prefix,
-   method='POST', data=data).object
+response = self.network_connection.request(
+self._subnets_url_prefix, method='POST', data=data).object
 return self._to_subnet(response['subnet'])
 
 def ex_delete_subnet(self, subnet):
@@ -2944,9 +2944,8 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 
 :rtype: ``bool``
 """
-resp = self.connection.request('%s/%s' % (self._subnets_url_prefix,
-  subnet.id),
-   method='DELETE')
+resp = self.network_connection.request('%s/%s' % (
+self._subnets_url_prefix, subnet.id), method='DELETE')
 return resp.status in (httplib.NO_CONTENT, httplib.ACCEPTED)
 
 def ex_list_ports(self):



[16/23] libcloud git commit: Add create and delete subnets

2018-12-04 Thread vdloo
Add create and delete subnets


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

Branch: refs/heads/trunk
Commit: ca5430d689e621e6f1fb6d4231352471b9a7a91e
Parents: 33e694f
Author: micafer 
Authored: Tue Oct 23 12:19:50 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py   | 40 +++-
 .../fixtures/openstack_v1.1/_v2_0__subnet.json  | 32 
 libcloud/test/compute/test_openstack.py | 27 -
 3 files changed, 96 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ca5430d6/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 0de0ab3..ec71091 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1681,7 +1681,7 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 
 def ex_delete_network(self, network):
 """
-Get a list of NodeNetorks that are available.
+Delete a Network
 
 :param network: Network which should be used
 :type network: :class:`OpenStackNetwork`
@@ -2914,6 +2914,44 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 self._subnets_url_prefix).object
 return self._to_subnets(response)
 
+def ex_create_subnet(self, name, network, cidr, ip_version=4):
+"""
+Create a new Subnet
+
+:param name: Name of subnet which should be used
+:type name: ``str``
+
+:param network: Parent network of the subnet
+:type network: ``OpenStackNetwork``
+
+:param cidr: cidr of network which should be used
+:type cidr: ``str``
+
+:param ip_version: ip_version of subnet which should be used
+:type ip_version: ``int``
+
+:rtype: :class:`OpenStack_2_SubNet`
+"""
+data = {'subnet': {'cidr': cidr, 'network_id': network.id,
+   'ip_version': ip_version, 'name': name}}
+response = self.connection.request(self._subnets_url_prefix,
+   method='POST', data=data).object
+return self._to_subnet(response['subnet'])
+
+def ex_delete_subnet(self, subnet):
+"""
+Delete a Subnet
+
+:param subnet: Subnet which should be deleted
+:type subnet: :class:`OpenStack_2_SubNet`
+
+:rtype: ``bool``
+"""
+resp = self.connection.request('%s/%s' % (self._subnets_url_prefix,
+  subnet.id),
+   method='DELETE')
+return resp.status in (httplib.NO_CONTENT, httplib.ACCEPTED)
+
 def ex_list_ports(self):
 """
 List all OpenStack_2_PortInterfaces

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ca5430d6/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__subnet.json
--
diff --git a/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__subnet.json 
b/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__subnet.json
new file mode 100644
index 000..dba344a
--- /dev/null
+++ b/libcloud/test/compute/fixtures/openstack_v1.1/_v2_0__subnet.json
@@ -0,0 +1,32 @@
+{
+"subnet":
+{
+"name": "name",
+"enable_dhcp": true,
+"network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
+"segment_id": null,
+"project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
+"tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
+"dns_nameservers": [],
+"allocation_pools": [
+{
+"start": "10.0.0.2",
+"end": "10.0.0.254"
+}
+],
+"host_routes": [],
+"ip_version": 4,
+"gateway_ip": "10.0.0.1",
+"cidr": "10.0.0.0/24",
+"id": "08eae331-0402-425a-923c-34f7cfe39c1b",
+"created_at": "2016-10-10T14:35:34Z",
+"description": "",
+"ipv6_address_mode": null,
+"ipv6_ra_mode": null,
+"revision_number": 2,
+"service_types": [],
+"subnetpool_id": null,
+"tags": ["tag1,tag2"],
+"updated_at": "2016-10-10T14:35:34Z"
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ca5430d6/libcloud/test/compute/test_openstack.py

[17/23] libcloud git commit: Remove prints

2018-12-04 Thread vdloo
Remove prints


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

Branch: refs/heads/trunk
Commit: a2faa5566af5e1fb896c09271c69ec6ce7eef68d
Parents: ca5430d
Author: micafer 
Authored: Tue Oct 23 12:20:16 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 3 ---
 1 file changed, 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a2faa556/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index ec71091..b5914ff 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1853,8 +1853,6 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 
 :rtype: ``list`` of :class:`OpenStackSecurityGroup`
 """
-print(vars(self.connection.request(
-'/servers/%s/os-security-groups' % (node.id
 return self._to_security_groups(
 self.connection.request('/servers/%s/os-security-groups' %
 (node.id)).object)
@@ -3442,7 +3440,6 @@ class 
OpenStack_2_FloatingIpPool(OpenStack_1_1_FloatingIpPool):
 def _to_floating_ip(self, obj):
 instance_id = None
 
-print(obj)
 # In neutron version prior to 13.0.0 port_details does not exists
 if 'port_details' not in obj and 'port_id' in obj and obj['port_id']:
 port = self.connection.driver.ex_get_port(obj['port_id'])



[09/23] libcloud git commit: Add cinder support LIBCLOUD-874

2018-12-04 Thread vdloo
Add cinder support LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: c8d253f7c8e566aa29589b78236264946a3cade3
Parents: 2d9e862
Author: micafer 
Authored: Mon Sep 24 16:20:20 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c8d253f7/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 9bd80cc..4fcdda6 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -3067,13 +3067,13 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 volume['snapshot_id'] = snapshot.id
 
 resp = self.volumev2_connection.request('/volumes',
-   method='POST',
-   data={'volume': volume})
+method='POST',
+data={'volume': volume})
 return self._to_volume(resp.object)
 
 def destroy_volume(self, volume):
 return self.volumev2_connection.request('/volumes/%s' % volume.id,
-   method='DELETE').success()
+method='DELETE').success()
 
 def ex_list_snapshots(self):
 return self._to_snapshots(
@@ -3108,13 +3108,13 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 if ex_description is not None:
 data['snapshot']['description'] = ex_description
 
-return self._to_snapshot(self.volumev2_connection.request('/snapshots',
- method='POST',
- data=data).object)
+return self._to_snapshot(
+self.volumev2_connection.request('/snapshots', method='POST',
+ data=data).object)
 
 def destroy_volume_snapshot(self, snapshot):
 resp = self.volumev2_connection.request('/snapshots/%s' % snapshot.id,
-   method='DELETE')
+method='DELETE')
 return resp.status == httplib.ACCEPTED
 
 



[05/23] libcloud git commit: Add cinder support LIBCLOUD-874

2018-12-04 Thread vdloo
Add cinder support LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: e9dcb93e4f8591e0980399563e53424215c6fd86
Parents: cd2faa7
Author: micafer 
Authored: Mon Sep 24 12:54:47 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py   | 167 +--
 .../openstack_v1.1/_v2_0__snapshot.json |  14 ++
 .../openstack_v1.1/_v2_0__snapshots.json|  46 +
 .../fixtures/openstack_v1.1/_v2_0__volume.json  |  18 ++
 .../fixtures/openstack_v1.1/_v2_0__volumes.json |  44 +
 libcloud/test/compute/test_openstack.py |  78 +
 6 files changed, 357 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e9dcb93e/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 75106f1..bfdf082 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -89,6 +89,12 @@ class OpenStackNetworkConnection(OpenStackBaseConnection):
 service_region = 'RegionOne'
 
 
+class OpenStackVolumeConnection(OpenStackBaseConnection):
+service_type = 'volume'
+service_name = 'cinder'
+service_region = 'RegionOne'
+
+
 class OpenStackNodeDriver(NodeDriver, OpenStackDriverMixin):
 """
 Base OpenStack node driver. Should not be used directly.
@@ -2200,20 +2206,27 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 
 return StorageVolume(
 id=api_node['id'],
-name=api_node['displayName'],
+name=api_node.get('name', api_node.get('displayName', None)),
 size=api_node['size'],
 state=state,
 driver=self,
 extra={
-'description': api_node['displayDescription'],
+'description': api_node.get('description',
+api_node.get('displayDescription',
+ None)),
 'attachments': [att for att in api_node['attachments'] if att],
 # TODO: remove in 1.18.0
 'state': api_node.get('status', None),
-'snapshot_id': api_node.get('snapshotId', None),
-'location': api_node.get('availabilityZone', None),
-'volume_type': api_node.get('volumeType', None),
+'snapshot_id': api_node.get('snapshot_id',
+api_node.get('snapshotId', None)),
+'location': api_node.get('availability_zone',
+ api_node.get('availabilityZone',
+  None)),
+'volume_type': api_node.get('volume_type',
+api_node.get('volumeType', None)),
 'metadata': api_node.get('metadata', None),
-'created_at': api_node.get('createdAt', None)
+'created_at': api_node.get('created_at',
+   api_node.get('createdAt', None))
 }
 )
 
@@ -,10 +2235,13 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 data = data['snapshot']
 
 volume_id = data.get('volume_id', data.get('volumeId', None))
-display_name = data.get('display_name', data.get('displayName', None))
+display_name = data.get('name',
+data.get('display_name',
+ data.get('displayName', None)))
 created_at = data.get('created_at', data.get('createdAt', None))
-description = data.get('display_description',
-   data.get('displayDescription', None))
+description = data.get('description',
+   data.get('display_description',
+data.get('displayDescription', None)))
 status = data.get('status', None)
 
 extra = {'volume_id': volume_id,
@@ -2514,6 +2530,15 @@ class 
OpenStack_2_NetworkConnection(OpenStackNetworkConnection):
 return json.dumps(data)
 
 
+class OpenStack_2_VolumeConnection(OpenStackVolumeConnection):
+responseCls = OpenStack_1_1_Response
+accept_format = 'application/json'
+default_content_type = 'application/json; charset=UTF-8'
+
+def encode_data(self, data):
+return json.dumps(data)
+
+
 

[02/23] libcloud git commit: Change order in gets

2018-12-04 Thread vdloo
Change order in gets


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

Branch: refs/heads/trunk
Commit: 33728b26d4937ba9bd4336ead1ea8d077a0af660
Parents: 8b19d31
Author: micafer 
Authored: Wed Nov 28 12:10:50 2018 +0100
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/33728b26/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index da17e6c..f244f91 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2220,14 +2220,13 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
 
 return StorageVolume(
 id=api_node['id'],
-name=api_node.get('name', api_node.get('displayName')),
+name=api_node.get('displayName', api_node.get('name')),
 size=api_node['size'],
 state=state,
 driver=self,
 extra={
-'description': api_node.get('description',
-api_node.get('displayDescription')
-),
+'description': api_node.get('displayDescription',
+api_node.get('description')),
 'attachments': [att for att in api_node['attachments'] if att],
 # TODO: remove in 1.18.0
 'state': api_node.get('status', None),



[10/23] libcloud git commit: Add cinder support LIBCLOUD-874

2018-12-04 Thread vdloo
Add cinder support LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: d66638a0db0549353ff7c2856458127283ca5529
Parents: c8d253f
Author: micafer 
Authored: Mon Sep 24 16:32:58 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 2 +-
 libcloud/test/common/test_openstack_identity.py   | 2 +-
 libcloud/test/compute/fixtures/openstack/_v2_0__auth.json | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/d66638a0/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index 4fcdda6..df42acd 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -91,7 +91,7 @@ class OpenStackNetworkConnection(OpenStackBaseConnection):
 
 class OpenStackVolumeV2Connection(OpenStackBaseConnection):
 service_type = 'volumev2'
-service_name = 'cinder'
+service_name = 'cinderv2'
 service_region = 'RegionOne'
 
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/d66638a0/libcloud/test/common/test_openstack_identity.py
--
diff --git a/libcloud/test/common/test_openstack_identity.py 
b/libcloud/test/common/test_openstack_identity.py
index c93cee3..3d7d074 100644
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -626,7 +626,7 @@ class OpenStackServiceCatalogTestCase(unittest.TestCase):
   auth_version='2.0')
 
 service_names = catalog.get_service_names()
-self.assertEqual(service_names, ['cinder', 'cloudFiles',
+self.assertEqual(service_names, ['cinderv2', 'cloudFiles',
  'cloudFilesCDN', 'cloudServers',
  'cloudServersOpenStack',
  'cloudServersPreprod',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/d66638a0/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
--
diff --git a/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json 
b/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
index d2bd3c3..3727df8 100644
--- a/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
+++ b/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
@@ -139,7 +139,7 @@
 "versionId": "2"
 }
 ],
-"name": "cinder",
+"name": "cinderv2",
 "type": "volumev2"
 },
 {



[07/23] libcloud git commit: Add cinder support LIBCLOUD-874

2018-12-04 Thread vdloo
Add cinder support LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: 3c93d267e055c04f7a5f7274358fa64bcf5e5313
Parents: c4b5cfa
Author: micafer 
Authored: Mon Sep 24 15:19:43 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 docs/compute/drivers/openstack.rst | 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/3c93d267/docs/compute/drivers/openstack.rst
--
diff --git a/docs/compute/drivers/openstack.rst 
b/docs/compute/drivers/openstack.rst
index 887057a..24dd839 100644
--- a/docs/compute/drivers/openstack.rst
+++ b/docs/compute/drivers/openstack.rst
@@ -99,6 +99,10 @@ Available arguments:
   driver obtains API endpoint URL from the server catalog, but if this argument
   is provided, this step is skipped and the provided value is used directly. 
Only valid 
   in case of api_version >= 2.0.
+  * ``ex_force_volume_url`` - Base URL to the OpenStack cinder API endpoint. 
By default,
+  driver obtains API endpoint URL from the server catalog, but if this argument
+  is provided, this step is skipped and the provided value is used directly. 
Only valid 
+  in case of api_version >= 2.0.
 
 Some examples which show how to use this arguments can be found in the section
 below.



[06/23] libcloud git commit: Add cinder support LIBCLOUD-874

2018-12-04 Thread vdloo
Add cinder support LIBCLOUD-874


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

Branch: refs/heads/trunk
Commit: c4b5cfa6a25e8f9fe373650b60e770c2b9b51235
Parents: e9dcb93
Author: micafer 
Authored: Mon Sep 24 13:03:38 2018 +0200
Committer: Rick van de Loo 
Committed: Tue Dec 4 09:45:48 2018 +0100

--
 libcloud/compute/drivers/openstack.py | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c4b5cfa6/libcloud/compute/drivers/openstack.py
--
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index bfdf082..fba9a8a 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -89,8 +89,8 @@ class OpenStackNetworkConnection(OpenStackBaseConnection):
 service_region = 'RegionOne'
 
 
-class OpenStackVolumeConnection(OpenStackBaseConnection):
-service_type = 'volume'
+class OpenStackVolumeV2Connection(OpenStackBaseConnection):
+service_type = 'volumev2'
 service_name = 'cinder'
 service_region = 'RegionOne'
 
@@ -2530,7 +2530,7 @@ class 
OpenStack_2_NetworkConnection(OpenStackNetworkConnection):
 return json.dumps(data)
 
 
-class OpenStack_2_VolumeConnection(OpenStackVolumeConnection):
+class OpenStack_2_VolumeV2Connection(OpenStackVolumeV2Connection):
 responseCls = OpenStack_1_1_Response
 accept_format = 'application/json'
 default_content_type = 'application/json; charset=UTF-8'
@@ -2592,8 +2592,8 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 # compute API
 # See https://developer.openstack.org/api-ref/compute/
 # For example, volume management are made in the cinder service
-volume_connectionCls = OpenStack_2_VolumeConnection
-volume_connection = None
+volumev2_connectionCls = OpenStack_2_VolumeV2Connection
+volumev2_connection = None
 
 type = Provider.OPENSTACK
 
@@ -2628,14 +2628,14 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
 self.image_connection = self.connection
 
 # We run the init once to get the Cinder V2 API connection
-# and put that on the object under self.volume_connection.
+# and put that on the object under self.volumev2_connection.
 if original_ex_force_base_url or kwargs.get('ex_force_volume_url'):
 kwargs['ex_force_base_url'] = \
 str(kwargs.pop('ex_force_volume_url',
original_ex_force_base_url))
-self.connectionCls = self.volume_connectionCls
+self.connectionCls = self.volumev2_connectionCls
 super(OpenStack_2_NodeDriver, self).__init__(*args, **kwargs)
-self.volume_connection = self.connection
+self.volumev2_connection = self.connection
 
 # We run the init once to get the Neutron V2 API connection
 # and put that on the object under self.network_connection.