[
https://issues.apache.org/jira/browse/LIBCLOUD-439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13823387#comment-13823387
]
Carlos Reategui commented on LIBCLOUD-439:
------------------------------------------
I decided to go ahead and patch my cloudstack.py because I need to display the
image name and instance size when listing nodes. Here is the diff for my
changes. [~kami], [~sebgoa] Let me know what you think:
{code}
--- apache-libcloud-0.13.2/libcloud/compute/drivers/cloudstack.py
2013-09-15 08:40:43.000000000 -0700
+++ cloudstack.py 2013-11-14 23:38:56.075049400 -0800
@@ -198,7 +198,21 @@
"""
vms = self._sync_request('listVirtualMachines')
addrs = self._sync_request('listPublicIpAddresses')
+ args = {
+ 'templatefilter': 'executable'
+ }
+ imgs = self._sync_request('listTemplates', **args)
+ img_map={}
+ for img in imgs.get('template', []):
+ img_map[img['id']]=NodeImage(
+ id=img['id'],
+ name=img['name'],
+ driver=self.connection.driver,
+ extra={'hypervisor': img['hypervisor'],
+ 'format': img['format'],
+ 'os': img['ostypename']})
+
public_ips_map = {}
for addr in addrs.get('publicipaddress', []):
if 'virtualmachineid' not in addr:
@@ -229,7 +243,9 @@
public_ips=public_ips,
private_ips=private_ips,
driver=self,
- extra={'zoneid': vm['zoneid'], }
+ image=img_map[vm['templateid']],
+ extra={'zoneid': vm['zoneid'],
+ 'size': NodeSize(vm['serviceofferingid'],
+ vm['serviceofferingname'],
+ vm['memory'], 0, 0, 0, self), }
)
addrs = public_ips_map.get(vm['id'], {}).items()
{code}
> Cloudstack list_nodes does not fill in image field
> --------------------------------------------------
>
> Key: LIBCLOUD-439
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-439
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Affects Versions: 0.13.2
> Environment: python 2.6
> Reporter: Carlos Reategui
> Priority: Trivial
>
> I made the following change but not sure if it is consistent with what other
> drivers put in the image field:
> --- apache-libcloud-0.13.2/libcloud/compute/drivers/cloudstack.py
> 2013-09-15 15:40:43.000000000 +0000
> +++ cloudstack.py 2013-11-14 04:05:26.000000000 +0000
> @@ -229,6 +229,7 @@
> public_ips=public_ips,
> private_ips=private_ips,
> driver=self,
> + image=vm.get('templatename', None),
> extra={'zoneid': vm['zoneid'], }
> )
> Another alternative could be templateid instead of templatename
--
This message was sent by Atlassian JIRA
(v6.1#6144)