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 2014/01/30 18:27:41 UTC
[1/2] git commit: docs: Add info on how to use
ex__list_availability_groups method.
Updated Branches:
refs/heads/trunk f7a95f8cf -> ec2bff134
docs: Add info on how to use ex__list_availability_groups method.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/62a23d39
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/62a23d39
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/62a23d39
Branch: refs/heads/trunk
Commit: 62a23d39bd47e6f6bd857b1940c35a8b5056049c
Parents: f7a95f8
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Jan 30 18:11:51 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Jan 30 18:11:51 2014 +0100
----------------------------------------------------------------------
docs/compute/drivers/cloudsigma.rst | 12 ++++++++++++
docs/examples/compute/cloudsigma/check_avail_groups.py | 11 +++++++++++
2 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62a23d39/docs/compute/drivers/cloudsigma.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudsigma.rst b/docs/compute/drivers/cloudsigma.rst
index 241349c..e6d3581 100644
--- a/docs/compute/drivers/cloudsigma.rst
+++ b/docs/compute/drivers/cloudsigma.rst
@@ -171,6 +171,18 @@ in the same availability group as an avoid resource.
.. literalinclude:: /examples/compute/cloudsigma/create_node_ex_avoid.py
:language: python
+To check which servers and drives share the same physical compute / storage
+host, you can use the
+:meth:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.ex_list_servers_availability_groups`
+and :meth:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.ex_list_drives_availability_groups`
+method as displayed bellow.
+
+.. literalinclude:: /examples/compute/cloudsigma/check_avail_groups.py
+ :language: python
+
+Both of those methods return a ``list``. Servers and drives which share the same
+physical host will be stored under the same index in the returned list.
+
10. Retrieving the account balance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://git-wip-us.apache.org/repos/asf/libcloud/blob/62a23d39/docs/examples/compute/cloudsigma/check_avail_groups.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudsigma/check_avail_groups.py b/docs/examples/compute/cloudsigma/check_avail_groups.py
new file mode 100644
index 0000000..c770007
--- /dev/null
+++ b/docs/examples/compute/cloudsigma/check_avail_groups.py
@@ -0,0 +1,11 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.CLOUDSIGMA)
+driver = cls('username', 'password', region='zrh', api_version='2.0')
+
+servers_groups = driver.ex_list_servers_availability_groups()
+drives_groups = driver.ex_list_drives_availability_groups()
+
+print(servers_groups)
+print(drives_groups)
[2/2] git commit: Allow user to pass ex_avoid argument to
ex_create_drive and ex_clone_drive method.
Posted by to...@apache.org.
Allow user to pass ex_avoid argument to ex_create_drive and ex_clone_drive
method.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ec2bff13
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ec2bff13
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ec2bff13
Branch: refs/heads/trunk
Commit: ec2bff134a602d7dacd02303f455ee7dcdf2268f
Parents: 62a23d3
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Jan 30 18:18:41 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Jan 30 18:18:41 2014 +0100
----------------------------------------------------------------------
libcloud/compute/drivers/cloudsigma.py | 34 +++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ec2bff13/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index acdb6ca..266708e 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1294,7 +1294,7 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
drives = [self._to_drive(data=item) for item in response['objects']]
return drives
- def ex_create_drive(self, name, size, media='disk'):
+ def ex_create_drive(self, name, size, media='disk', ex_avoid=None):
"""
Create a new drive.
@@ -1306,20 +1306,34 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
:param media: Drive media type (cdrom, disk).
:type media: ``str``
+
+ :param ex_avoid: A list of other drive uuids to avoid when
+ creating this drive. If provided, drive will
+ attempt to be created on a different
+ physical infrastructure from other drives
+ specified using this argument. (optional)
+ :type ex_avoid: ``list``
+
+ :return: Created drive object.
+ :rtype: :class:`.CloudSigmaDrive`
"""
+ params = {}
data = {
'name': name,
'size': size,
'media': media
}
+ if ex_avoid:
+ params['avoid'] = ','.join(ex_avoid)
+
action = '/drives/'
response = self.connection.request(action=action, method='POST',
- data=data).object
+ params=params, data=data).object
drive = self._to_drive(data=response['objects'][0])
return drive
- def ex_clone_drive(self, drive, name=None):
+ def ex_clone_drive(self, drive, name=None, ex_avoid=None):
"""
Clone a library or a standard drive.
@@ -1330,17 +1344,29 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
:param name: Optional name for the cloned drive.
:type name: ``str``
+ :param ex_avoid: A list of other drive uuids to avoid when
+ creating this drive. If provided, drive will
+ attempt to be created on a different
+ physical infrastructure from other drives
+ specified using this argument. (optional)
+ :type ex_avoid: ``list``
+
:return: New cloned drive.
:rtype: :class:`.CloudSigmaDrive`
"""
+ params = {}
data = {}
+ if ex_avoid:
+ params['avoid'] = ','.join(ex_avoid)
+
if name:
data['name'] = name
path = '/drives/%s/action/' % (drive.id)
response = self._perform_action(path=path, action='clone',
- method='POST', data=data)
+ params=params, data=data,
+ method='POST')
drive = self._to_drive(data=response.object['objects'][0])
return drive