libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [6/7] git commit: * add to node['extra']['block_device_mapping'] volume_id\n* fix in volume['extra'] parameter device (was incorrect xpath)\n* fix tests for coverage this
Date Wed, 29 Jan 2014 16:01:00 GMT
* add to node['extra']['block_device_mapping'] volume_id\n* fix in volume['extra'] parameter
device (was incorrect xpath)\n* fix tests for coverage this

Signed-off-by: Tomaz Muraus <tomaz@apache.org>


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

Branch: refs/heads/trunk
Commit: 050de41aaf490421af9d253642130e083b57e417
Parents: d7bf122
Author: gigimon <gigimon4ik@gmail.com>
Authored: Wed Jan 29 16:57:26 2014 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Wed Jan 29 16:55:58 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py   | 7 +++++--
 libcloud/test/compute/test_ec2.py | 4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/050de41a/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 1eef018..f138f3d 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -527,6 +527,10 @@ RESOURCE_EXTRA_ATTRIBUTES_MAP = {
             'xpath': 'ebs/snapshotId',
             'transform_func': str
         },
+        'volume_id': {
+            'xpath': 'ebs/volumeId',
+            'transform_func': str
+        },
         'volume_size': {
             'xpath': 'ebs/volumeSize',
             'transform_func': int
@@ -908,7 +912,7 @@ RESOURCE_EXTRA_ATTRIBUTES_MAP = {
     },
     'volume': {
         'device': {
-            'xpath': 'device',
+            'xpath': 'attachmentSet/item/device',
             'transform_func': str
         },
         'iops': {
@@ -3519,7 +3523,6 @@ class BaseEC2NodeDriver(NodeDriver):
             value = findattr(element=element,
                              xpath=values['xpath'],
                              namespace=NAMESPACE)
-
             if value is not None:
                 extra[attribute] = transform_func(value)
             else:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/050de41a/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 1dbd809..4d28faa 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -183,6 +183,9 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
         self.assertEqual(node.extra['image_id'], 'ami-3215fe5a')
         self.assertEqual(len(node.extra['groups']), 2)
         self.assertEqual(len(node.extra['block_device_mapping']), 1)
+        self.assertEqual(node.extra['block_device_mapping'][0]['device_name'], '/dev/sda1')
+        self.assertEqual(node.extra['block_device_mapping'][0]['ebs']['volume_id'], 'vol-5e312311')
+        self.assertTrue(node.extra['block_device_mapping'][0]['ebs']['delete'])
 
         self.assertEqual(public_ips[0], '1.2.3.4')
 
@@ -741,6 +744,7 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
         self.assertEqual(8, volumes[2].size)
         self.assertEqual('in-use', volumes[2].extra['state'])
         self.assertEqual('i-d334b4b3', volumes[2].extra['instance_id'])
+        self.assertEqual('/dev/sda1', volumes[2].extra['device'])
 
     def test_create_volume(self):
         location = self.driver.list_locations()[0]


Mime
View raw message