You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/10/11 21:10:42 UTC
[1/3] git commit: Issue LIBCLOUD-408: Pass kwargs to ex_rebuild to
create node args
Updated Branches:
refs/heads/trunk 8a4c4a80f -> 50abaf173
Issue LIBCLOUD-408: Pass kwargs to ex_rebuild to create node args
Added test that verifies this does the expected thing for the
disk configuration option.
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/89afb61d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/89afb61d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/89afb61d
Branch: refs/heads/trunk
Commit: 89afb61dab127a41840ca5d3493954ff090fd092
Parents: 8a4c4a8
Author: dave.king <da...@mailtrust.com>
Authored: Fri Oct 11 13:50:28 2013 -0400
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 11 20:55:33 2013 +0200
----------------------------------------------------------------------
libcloud/compute/drivers/openstack.py | 29 +++++++++++++++++++++++++--
libcloud/test/compute/test_openstack.py | 30 ++++++++++++++++++++++++++--
2 files changed, 55 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/89afb61d/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py
index f2a6b4f..5337852 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1351,7 +1351,7 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
node.extra['password'] = password
return resp.status == httplib.ACCEPTED
- def ex_rebuild(self, node, image):
+ def ex_rebuild(self, node, image, **kwargs):
"""
Rebuild a Node.
@@ -1361,9 +1361,34 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
:param image: New image to use.
:type image: :class:`NodeImage`
+ :keyword ex_metadata: Key/Value metadata to associate with a node
+ :type ex_metadata: ``dict``
+
+ :keyword ex_files: File Path => File contents to create on
+ the no de
+ :type ex_files: ``dict``
+
+ :keyword ex_keyname: Name of existing public key to inject into
+ instance
+ :type ex_keyname: ``str``
+
+ :keyword ex_userdata: String containing user data
+ see
+ https://help.ubuntu.com/community/CloudInit
+ :type ex_userdata: ``str``
+
+ :keyword ex_security_groups: List of security groups to assign to
+ the node
+ :type ex_security_groups: ``list`` of
+ :class:`OpenStackSecurityGroup`
+
+ :keyword ex_disk_config: Name of the disk configuration.
+ Can be either ``AUTO`` or ``MANUAL``.
+ :type ex_disk_config: ``str``
+
:rtype: ``bool``
"""
- server_params = self._create_args_to_params(node, image=image)
+ server_params = self._create_args_to_params(node, image=image, **kwargs)
resp = self._node_action(node, 'rebuild', **server_params)
return resp.status == httplib.ACCEPTED
http://git-wip-us.apache.org/repos/asf/libcloud/blob/89afb61d/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index a35baea..288e40a 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -955,9 +955,24 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
self.fail('An error was raised: ' + repr(e))
def test_ex_rebuild(self):
- image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)', driver=self.driver)
+ image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)',
+ driver=self.driver)
+ try:
+ success = self.driver.ex_rebuild(self.node, image=image)
+ self.assertTrue(success)
+ except Exception:
+ e = sys.exc_info()[1]
+ self.fail('An error was raised: ' + repr(e))
+
+ def test_ex_rebuild_with_ex_disk_config(self):
+ image = NodeImage(id=58, name='Ubuntu 10.10 (intrepid)',
+ driver=self.driver)
+ node = Node(id=12066, name=None, state=None, public_ips=None,
+ private_ips=None, driver=self.driver)
try:
- self.driver.ex_rebuild(self.node, image=image)
+ success = self.driver.ex_rebuild(node, image=image,
+ ex_disk_config='MANUAL')
+ self.assertTrue(success)
except Exception:
e = sys.exc_info()[1]
self.fail('An error was raised: ' + repr(e))
@@ -1361,6 +1376,17 @@ class OpenStack_1_1_MockHttp(MockHttpTestCase):
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
+ def _v1_1_slug_servers_12066_action(self, method, url, body, headers):
+ if method != "POST":
+ self.fail('HTTP method other than POST to action URL')
+ if "rebuild" not in json.loads(body):
+ self.fail("Did not get expected action (rebuild) in action URL")
+
+ self.assertTrue('\"OS-DCF:diskConfig\": \"MANUAL\"' in body,
+ msg="Manual disk configuration option was not specified in rebuild body: " + body)
+
+ return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
+
def _v1_1_slug_servers_12065(self, method, url, body, headers):
if method == "DELETE":
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
[3/3] git commit: Update changes.
Posted by to...@apache.org.
Update changes.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/50abaf17
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/50abaf17
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/50abaf17
Branch: refs/heads/trunk
Commit: 50abaf173d790fe3714bcb2dd1b7d383f0354dcf
Parents: ccf8f4b
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Oct 11 21:07:56 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 11 21:07:56 2013 +0200
----------------------------------------------------------------------
CHANGES | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/50abaf17/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 2f90ca1..324e7b4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -97,6 +97,10 @@ Changes with Apache Libcloud in development
driver.
[Tomaz Muraus]
+ - Allow user to pass all supported extension arguments to ex_rebuild_server
+ method in the OpenStack driver. (LIBCLOUD-408)
+ [Dave King]
+
*) Storage
- Allow users to filter objects starting with a prefix by passing ex_prefix
[2/3] git commit: Remove unnecessary try / except blocks.
Posted by to...@apache.org.
Remove unnecessary try / except blocks.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ccf8f4bc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ccf8f4bc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ccf8f4bc
Branch: refs/heads/trunk
Commit: ccf8f4bcd24f6b8cc3ef0d8098ce069e2da94189
Parents: 89afb61
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Oct 11 20:58:36 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 11 20:58:36 2013 +0200
----------------------------------------------------------------------
libcloud/test/compute/test_openstack.py | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ccf8f4bc/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 288e40a..32dc91e 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -948,34 +948,22 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
self.assertEqual(self.driver.detach_volume(volume), True)
def test_ex_set_password(self):
- try:
- self.driver.ex_set_password(self.node, 'New1&53jPass')
- except Exception:
- e = sys.exc_info()[1]
- self.fail('An error was raised: ' + repr(e))
+ self.assertTrue(self.driver.ex_set_password(self.node, 'New1&53jPass'))
def test_ex_rebuild(self):
image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)',
driver=self.driver)
- try:
- success = self.driver.ex_rebuild(self.node, image=image)
- self.assertTrue(success)
- except Exception:
- e = sys.exc_info()[1]
- self.fail('An error was raised: ' + repr(e))
+ success = self.driver.ex_rebuild(self.node, image=image)
+ self.assertTrue(success)
def test_ex_rebuild_with_ex_disk_config(self):
image = NodeImage(id=58, name='Ubuntu 10.10 (intrepid)',
driver=self.driver)
node = Node(id=12066, name=None, state=None, public_ips=None,
private_ips=None, driver=self.driver)
- try:
- success = self.driver.ex_rebuild(node, image=image,
- ex_disk_config='MANUAL')
- self.assertTrue(success)
- except Exception:
- e = sys.exc_info()[1]
- self.fail('An error was raised: ' + repr(e))
+ success = self.driver.ex_rebuild(node, image=image,
+ ex_disk_config='MANUAL')
+ self.assertTrue(success)
def test_ex_resize(self):
size = NodeSize(1, '256 slice', None, None, None, None,