You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by qu...@apache.org on 2018/01/25 06:56:09 UTC
[1/3] libcloud git commit: Add restore and resize/scale to Cloudstack
compute driver
Repository: libcloud
Updated Branches:
refs/heads/trunk fd1162844 -> 91257d533
Add restore and resize/scale to Cloudstack compute driver
Signed-off-by: Quentin Pradet <qu...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f38a9e30
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f38a9e30
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f38a9e30
Branch: refs/heads/trunk
Commit: f38a9e30847bcfa8e806d4bd402e26a5248567f6
Parents: fd11628
Author: otherpirate <ma...@hotmail.com>
Authored: Tue Jan 23 17:17:50 2018 -0200
Committer: Quentin Pradet <qu...@apache.org>
Committed: Thu Jan 25 10:46:33 2018 +0400
----------------------------------------------------------------------
libcloud/common/cloudstack.py | 5 +-
libcloud/compute/drivers/cloudstack.py | 53 ++++++++++++++++++++
.../cloudstack/queryAsyncJobResult_88776.json | 1 +
.../cloudstack/queryAsyncJobResult_88777.json | 1 +
.../restoreVirtualMachine_default.json | 1 +
.../cloudstack/scaleVirtualMachine_default.json | 1 +
libcloud/test/compute/test_cloudstack.py | 18 ++++++-
7 files changed, 78 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/common/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/cloudstack.py b/libcloud/common/cloudstack.py
index ee16dfd..1cb63fe 100644
--- a/libcloud/common/cloudstack.py
+++ b/libcloud/common/cloudstack.py
@@ -162,12 +162,15 @@ class CloudStackConnection(ConnectionUserAndKey, PollingConnection):
if (command == 'revokesecuritygroupingress' and
'revokesecuritygroupingressresponse' not in result.object):
command = command
+ elif (command == 'restorevirtualmachine' and
+ 'restorevmresponse' in result.object):
+ command = "restorevmresponse"
else:
command = command + 'response'
if command not in result.object:
raise MalformedResponseError(
- "Unknown response format",
+ "Unknown response format {}".format(command),
body=result.body,
driver=self.driver)
result = result.object[command]
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index a97758c..1fd0ab2 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -486,6 +486,18 @@ class CloudStackNode(Node):
"""
return self.driver.ex_delete_port_forwarding_rule(node=self, rule=rule)
+ def ex_restore(self, template=None):
+ """
+ Restore virtual machine
+ """
+ return self.driver.ex_restore(node=self, template=template)
+
+ def ex_change_node_size(self, offering):
+ """
+ Change virtual machine offering/size
+ """
+ return self.driver.ex_change_node_size(node=self, offering=offering)
+
def ex_start(self):
"""
Starts a stopped virtual machine.
@@ -1693,6 +1705,47 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
method='GET')
return True
+ def ex_restore(self, node, template=None):
+ """
+ Restore virtual machine
+
+ :param node: Node to restore
+ :type node: :class:`CloudStackNode`
+
+ :param template: Optional new template
+ :type template: :class:`NodeImage`
+
+ :rtype ``str``
+ """
+ params = {'virtualmachineid': node.id}
+ if template:
+ params['templateid'] = template.id
+
+ res = self._async_request(command='restoreVirtualMachine',
+ params=params,
+ method='GET')
+ return res['virtualmachine']['templateid']
+
+ def ex_change_node_size(self, node, offering):
+ """
+ Change offering/size of a virtual machine
+
+ :param node: Node to change size
+ :type node: :class:`CloudStackNode`
+
+ :param offering: The new offering
+ :type offering: :class:`NodeSize`
+
+ :rtype ``str``
+ """
+ res = self._async_request(command='scaleVirtualMachine',
+ params={
+ 'id': node.id,
+ 'serviceofferingid': offering.id
+ },
+ method='GET')
+ return res['virtualmachine']['serviceofferingid']
+
def ex_start(self, node):
"""
Starts/Resumes a stopped virtual machine
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88776.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88776.json b/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88776.json
new file mode 100644
index 0000000..a01c3a3
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88776.json
@@ -0,0 +1 @@
+{ "queryasyncjobresultresponse": {"jobprocstatus": 0, "jobstatus": 1, "jobresult": {"virtualmachine": {"serviceofferingid": "eee-fff-ggg-hhh"}}}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88777.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88777.json b/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88777.json
new file mode 100644
index 0000000..8e0685e
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_88777.json
@@ -0,0 +1 @@
+{ "queryasyncjobresultresponse": {"jobprocstatus": 0, "jobstatus": 1, "jobresult": {"virtualmachine": {"templateid": "aaa-bbb-ccc-ddd"}}}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/test/compute/fixtures/cloudstack/restoreVirtualMachine_default.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/restoreVirtualMachine_default.json b/libcloud/test/compute/fixtures/cloudstack/restoreVirtualMachine_default.json
new file mode 100644
index 0000000..0586809
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/restoreVirtualMachine_default.json
@@ -0,0 +1 @@
+{ "restorevirtualmachineresponse" : { "jobid" : 88777} }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/test/compute/fixtures/cloudstack/scaleVirtualMachine_default.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/scaleVirtualMachine_default.json b/libcloud/test/compute/fixtures/cloudstack/scaleVirtualMachine_default.json
new file mode 100644
index 0000000..bdab77b
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/scaleVirtualMachine_default.json
@@ -0,0 +1 @@
+{ "scalevirtualmachineresponse" : { "jobid" : 88776} }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f38a9e30/libcloud/test/compute/test_cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py
index 356cd94..78b1a95 100644
--- a/libcloud/test/compute/test_cloudstack.py
+++ b/libcloud/test/compute/test_cloudstack.py
@@ -25,7 +25,7 @@ try:
except ImportError:
import json
-from libcloud.compute.base import NodeLocation
+from libcloud.compute.base import NodeLocation, NodeSize, NodeImage
from libcloud.common.types import ProviderError
from libcloud.compute.drivers.cloudstack import CloudStackNodeDriver, \
CloudStackAffinityGroupType
@@ -1276,6 +1276,22 @@ class CloudStackTestCase(CloudStackCommonTestCase, unittest.TestCase):
except Exception:
self.fail('url provided but driver raised an exception')
+ def test_restore(self):
+ template = NodeImage("aaa-bbb-ccc-ddd", "fake-img", None)
+
+ node = self.driver.list_nodes()[0]
+ res = node.ex_restore(template=template)
+
+ self.assertEqual(res, template.id)
+
+ def test_change_offerings(self):
+ offering = NodeSize("eee-fff-ggg-hhh", "fake-size", 1, 4, 5, 0.1, None)
+
+ node = self.driver.list_nodes()[0]
+ res = node.ex_change_node_size(offering=offering)
+
+ self.assertEqual(res, offering.id)
+
class CloudStackMockHttp(MockHttp, unittest.TestCase):
fixtures = ComputeFileFixtures('cloudstack')
[3/3] libcloud git commit: CHANGES.rst: Order "Compute" changes by
driver
Posted by qu...@apache.org.
CHANGES.rst: Order "Compute" changes by driver
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/91257d53
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/91257d53
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/91257d53
Branch: refs/heads/trunk
Commit: 91257d53383a9afaef8645b4d88402c7f138e5dd
Parents: f2fbe31
Author: Quentin Pradet <qu...@apache.org>
Authored: Thu Jan 25 10:54:54 2018 +0400
Committer: Quentin Pradet <qu...@apache.org>
Committed: Thu Jan 25 10:55:28 2018 +0400
----------------------------------------------------------------------
CHANGES.rst | 135 ++++++++++++++++++++++++++++---------------------------
1 file changed, 68 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/91257d53/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 0c89220..84581e6 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -24,35 +24,10 @@ Common
Compute
~~~~~~~
-- [GCE] Allow adding labels to images (GITHUB-1138)
- [Katriel Traum, Eric Johnson]
-
-- [GCE] Allow adding license strings to images (GITHUB-1136)
- [Katriel Traum, Eric Johnson]
-
-- [UpCloud] New driver for UpCloud (LIBCLOUD-938, GITHUB-1102)
- [Mika Lackman, Ilari Mäkelä]
-
-- [EC2] Add new x1.16xlarge and x1e.32xlarge instance type. (GITHUB-1101)
- [Anthony Monthe]
-
-- [EC2] Add AWS EC2 c5 series (GITHUB-1147)
- [Anthony Monthe]
-
-- [EC2] Add AWS EC2 M5 sizes (GITHUB-1159)
- [Anthony Monthe]
-
-- [EC2] Update pricing information for EC2 instances.
- [Tomaz Muraus]
-
-- Update ProfitBricks driver and add support for the new API v4. (GITHUB-1103)
- [Nurfet Becirevic]
-
-- [GCE] Support GCE node labels. (LIBCLOUD-934, GITHUB-1115)
- [@maxlip]
-
-- [GCE] Fix `GCEList` pagination. (GITHUB-1095)
- [Yap Sok Ann]
+- Fix "wait_until_running() method so it also works correctly and doesn't
+ append "None" to the addresses list if node has no IP address.
+ (GITHUB-1156, LIBCLOUD-971)
+ [Tobias Paepke]
- [ARM] Fix checking for "location is None" in several functions (LIBCLOUD-926, GITHUB-1098)
[Sameh Elsharkawy]
@@ -60,23 +35,9 @@ Compute
- [ARM] Fix error when using SSH key auth with Python 3 (GITHUB-1098)
[Sameh Elsharkawy]
-- [GCE] Allow setting service account in instance templates (LIBCLOUD-947, GITHUB-1108)
- [Evan Carter]
-
- [ARM] Fix API call on powerOff, understand PAUSED state (GITHUB-1003)
[Markos Gogoulos]
-- [UpCloud] Use disk size and storage tier also when creating node from template
- (LIBCLOUD-952, GITHUB-1124)
- [Mika Lackman]
-
-- [UpCloud] Allow to define hostname and username
- (LIBCLOUD-951, LIBCLOUD-953, GITHUB-1123, GITHUB-1125)
- [Mika Lackman]
-
-- [UpCloud] Add pricing information to list_sizes (LIBCLOUD-969, GITHUB-1152)
- [Mika Lackman]
-
- [ARM] Delete VHDs more reliably in destroy_node(), raise exception on unhandled errors
(GITHUB-1120)
[Lucas Di Pentima]
@@ -88,21 +49,6 @@ Compute
(GITHUB-1126)
[Peter Amstutz, Lucas Di Pentima]
-- [EC2] Allow cn-north-1 even without pricing information
- (LIBCLOUD-954, GITHUB-1127)
- [Quentin Pradet]
-
-- [Digital Ocean] Add ex_enable_ipv6 in DigitalOcean_v2 driver
- (GITHUB-1130)
- [Rick van de Loo]
-
-- [EC2] Fix EBS volume encryption (GITHUB-1008)
- [Sergey Babak]
-
-- [GCE] Add support for private IP addresses in GCE instance creation
- (LIBCLOUD-944, GITHUB-1107)
- [Gareth Mcfarlane]
-
- [ARM] Fix delete_old_vhd (GITHUB-1137)
[Peter Amstutz, Lucas Di Pentima]
@@ -115,26 +61,81 @@ Compute
- [CloudStack] Handle NICs without addresses (GITHUB-1141)
[Pierre-Yves Ritschard]
-- Fix "wait_until_running() method so it also works correctly and doesn't
- append "None" to the addresses list if node has no IP address.
- (GITHUB-1156, LIBCLOUD-971)
- [Tobias Paepke]
+- [CloudStack] Add change size and restore (LIBCLOUD-975, GITHUB-1166)
+ [Mauro Murari]
+
+- [Digital Ocean] Add ex_enable_ipv6 in DigitalOcean_v2 driver
+ (GITHUB-1130)
+ [Rick van de Loo]
+
+- [Digital Ocean] Add support for tags in list_nodes()
+ (LIBCLOUD-967, GITHUB-1149)
+ [Mike Fischer]
+
+- [EC2] Add new x1.16xlarge and x1e.32xlarge instance type. (GITHUB-1101)
+ [Anthony Monthe]
+
+- [EC2] Add AWS EC2 c5 series (GITHUB-1147)
+ [Anthony Monthe]
+
+- [EC2] Add AWS EC2 M5 sizes (GITHUB-1159)
+ [Anthony Monthe]
+
+- [EC2] Update pricing information for EC2 instances.
+ [Tomaz Muraus]
+
+- [EC2] Allow cn-north-1 even without pricing information
+ (LIBCLOUD-954, GITHUB-1127)
+ [Quentin Pradet]
+
+- [EC2] Fix EBS volume encryption (GITHUB-1008)
+ [Sergey Babak]
- [ECS Aliyun] Support modify_security_group_attributes (GITHUB-1157)
[Zhang Yiming]
+- [GCE] Allow adding labels to images (GITHUB-1138)
+ [Katriel Traum, Eric Johnson]
+
+- [GCE] Allow adding license strings to images (GITHUB-1136)
+ [Katriel Traum, Eric Johnson]
+
+- [GCE] Support GCE node labels. (LIBCLOUD-934, GITHUB-1115)
+ [@maxlip]
+
+- [GCE] Fix `GCEList` pagination. (GITHUB-1095)
+ [Yap Sok Ann]
+
+- [GCE] Allow setting service account in instance templates (LIBCLOUD-947, GITHUB-1108)
+ [Evan Carter]
+
+- [GCE] Add support for private IP addresses in GCE instance creation
+ (LIBCLOUD-944, GITHUB-1107)
+ [Gareth Mcfarlane]
+
- [GCE] Allow for use of shared network (VPC) and subnetwork (GITHUB-1165)
[Boris Chazalet]
- [GCE] Add support for accelerators (LIBCLOUD-963, GITHUB-1163)
[Michael Johnson]
-- [Digital Ocean] Add support for tags in list_nodes()
- (LIBCLOUD-967, GITHUB-1149)
- [Mike Fischer]
+- [ProfitBricks] Update driver and add support for the new API v4. (GITHUB-1103)
+ [Nurfet Becirevic]
+
+- [UpCloud] New driver for UpCloud (LIBCLOUD-938, GITHUB-1102)
+ [Mika Lackman, Ilari Mäkelä]
+
+- [UpCloud] Use disk size and storage tier also when creating node from template
+ (LIBCLOUD-952, GITHUB-1124)
+ [Mika Lackman]
+
+- [UpCloud] Allow to define hostname and username
+ (LIBCLOUD-951, LIBCLOUD-953, GITHUB-1123, GITHUB-1125)
+ [Mika Lackman]
+
+- [UpCloud] Add pricing information to list_sizes (LIBCLOUD-969, GITHUB-1152)
+ [Mika Lackman]
-- [CloudStack] Add change size and restore (LIBCLOUD-975, GITHUB-1166)
- [Mauro Murari]
Storage
~~~~~~~
[2/3] libcloud git commit: Add changes for #1166
Posted by qu...@apache.org.
Add changes for #1166
Closes #1166
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f2fbe313
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f2fbe313
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f2fbe313
Branch: refs/heads/trunk
Commit: f2fbe313f7fca93b03788945ecb3c65e729b51b4
Parents: f38a9e3
Author: Quentin Pradet <qu...@apache.org>
Authored: Thu Jan 25 10:49:17 2018 +0400
Committer: Quentin Pradet <qu...@apache.org>
Committed: Thu Jan 25 10:49:17 2018 +0400
----------------------------------------------------------------------
CHANGES.rst | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f2fbe313/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 1e4a19a..0c89220 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -133,6 +133,9 @@ Compute
(LIBCLOUD-967, GITHUB-1149)
[Mike Fischer]
+- [CloudStack] Add change size and restore (LIBCLOUD-975, GITHUB-1166)
+ [Mauro Murari]
+
Storage
~~~~~~~