You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by er...@apache.org on 2015/05/14 00:06:56 UTC

libcloud git commit: [google compute] LIBCLOUD-696: improve node image detection

Repository: libcloud
Updated Branches:
  refs/heads/trunk aaa8e9e3a -> 1e3d3cbc6


[google compute] LIBCLOUD-696: improve node image detection

Closes #522

Signed-off-by: Eric Johnson <er...@google.com>


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

Branch: refs/heads/trunk
Commit: 1e3d3cbc6fcc6f3cc862da31b9e17ca5450b95f6
Parents: aaa8e9e
Author: Eric Johnson <er...@google.com>
Authored: Wed May 13 21:52:39 2015 +0000
Committer: Eric Johnson <er...@google.com>
Committed: Wed May 13 22:06:31 2015 +0000

----------------------------------------------------------------------
 libcloud/compute/drivers/gce.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1e3d3cbc/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 90c1e05..ec5b6f4 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -5262,6 +5262,7 @@ n
         extra['canIpForward'] = node.get('canIpForward')
         extra['serviceAccounts'] = node.get('serviceAccounts', [])
         extra['scheduling'] = node.get('scheduling', {})
+        extra['boot_disk'] = None
 
         for disk in extra['disks']:
             if disk.get('boot') and disk.get('type') == 'PERSISTENT':
@@ -5281,10 +5282,17 @@ n
 
         # For the node attributes, use just machine and image names, not full
         # paths.  Full paths are available in the "extra" dict.
+        image = None
         if extra['image']:
             image = self._get_components_from_path(extra['image'])['name']
         else:
-            image = None
+            if extra['boot_disk'] and \
+                    hasattr(extra['boot_disk'], 'extra') and \
+                    'sourceImage' in extra['boot_disk'].extra and \
+                    extra['boot_disk'].extra['sourceImage'] is not None:
+                src_image = extra['boot_disk'].extra['sourceImage']
+                image = self._get_components_from_path(src_image)['name']
+            extra['image'] = image
         size = self._get_components_from_path(node['machineType'])['name']
 
         return Node(id=node['id'], name=node['name'],
@@ -5422,6 +5430,15 @@ n
         extra['status'] = volume.get('status')
         extra['creationTimestamp'] = volume.get('creationTimestamp')
         extra['description'] = volume.get('description')
+        extra['sourceImage'] = volume.get('sourceImage')
+        extra['sourceImageId'] = volume.get('sourceImageId')
+        extra['sourceSnapshot'] = volume.get('sourceSnapshot')
+        extra['sourceSnapshotId'] = volume.get('sourceSnapshotId')
+        extra['options'] = volume.get('options')
+        if 'licenses' in volume:
+            lic_objs = self._licenses_from_urls(licenses=volume['licenses'])
+            extra['licenses'] = lic_objs
+
         extra['type'] = volume.get('type', 'pd-standard').split('/')[-1]
 
         return StorageVolume(id=volume['id'], name=volume['name'],