You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/09/26 06:03:56 UTC
[1/2] libcloud git commit: OS create_snapshot posts optional keywords
only when needed
Repository: libcloud
Updated Branches:
refs/heads/trunk a29f8fba6 -> 93c467c3e
OS create_snapshot posts optional keywords only when needed
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/46647ea4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/46647ea4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/46647ea4
Branch: refs/heads/trunk
Commit: 46647ea4af9d72e140cf3e4577ea9b08296eaba2
Parents: a29f8fb
Author: Allard Hoeve <al...@gmail.com>
Authored: Fri Sep 23 12:23:52 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Sep 26 16:02:22 2016 +1000
----------------------------------------------------------------------
libcloud/compute/drivers/openstack.py | 15 +++++++++------
libcloud/test/compute/test_openstack.py | 13 +++++++++++++
2 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/46647ea4/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py
index 0c17774..0a34866 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1672,10 +1672,10 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
:type volume: `StorageVolume`
:param name: Name of snapshot (optional)
- :type name: `str`
+ :type name: `str` | `NoneType`
:param ex_description: Description of the snapshot (optional)
- :type ex_description: `str`
+ :type ex_description: `str` | `NoneType`
:param ex_force: Specifies if we create a snapshot that is not in
state `available`. For example `in-use`. Defaults
@@ -1684,10 +1684,13 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
:rtype: :class:`VolumeSnapshot`
"""
- data = {'snapshot': {'display_name': name,
- 'display_description': ex_description,
- 'volume_id': volume.id,
- 'force': ex_force}}
+ data = {'snapshot': {'volume_id': volume.id, 'force': ex_force}}
+
+ if name is not None:
+ data['snapshot']['display_name'] = name
+
+ if ex_description is not None:
+ data['snapshot']['display_description'] = ex_description
return self._to_snapshot(self.connection.request('/os-snapshots',
method='POST',
http://git-wip-us.apache.org/repos/asf/libcloud/blob/46647ea4/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index ec6a00e..71a2fab 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -1521,6 +1521,19 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
force=True)
self.assertEqual(ret.id, '3fbbcccf-d058-4502-8844-6feeffdf4cb5')
+ def test_ex_create_snapshot_does_not_post_optional_parameters_if_none(self):
+ volume = self.driver.list_volumes()[0]
+ with patch.object(self.driver, '_to_snapshot'):
+ with patch.object(self.driver.connection, 'request') as mock_request:
+ self.driver.create_volume_snapshot(volume,
+ name=None,
+ ex_description=None,
+ ex_force=True)
+
+ name, args, kwargs = mock_request.mock_calls[0]
+ self.assertFalse("display_name" in kwargs["data"]["snapshot"])
+ self.assertFalse("display_description" in kwargs["data"]["snapshot"])
+
def test_destroy_volume_snapshot(self):
if self.driver_type.type == 'rackspace':
self.conn_classes[0].type = 'RACKSPACE'
[2/2] libcloud git commit: Docs for #866 Closes #866
Posted by an...@apache.org.
Docs for #866
Closes #866
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/93c467c3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/93c467c3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/93c467c3
Branch: refs/heads/trunk
Commit: 93c467c3e121ab7678f0d939d1276a4cd6b05781
Parents: 46647ea
Author: Allard Hoeve <al...@gmail.com>
Authored: Fri Sep 23 12:26:29 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Sep 26 16:03:03 2016 +1000
----------------------------------------------------------------------
CHANGES.rst | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/93c467c3/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 15cdf78..764ae7d 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -19,6 +19,11 @@ Compute
- Added `ex_stop_node` to the OpenStack driver.
(GITHUB-865)
+
+- When creating volume snapshot, the arguments `name` and `description` are truely
+ optional when working with newer OpenStack versions. The OpenStack driver will now
+ only post thost arguments if they are non-`NoneType`.
+ (GITHUB-866)
[Allard Hoeve]
Container