libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Reategui (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LIBCLOUD-439) Cloudstack list_nodes does not fill in image field
Date Thu, 14 Nov 2013 14:41:21 GMT

    [ https://issues.apache.org/jira/browse/LIBCLOUD-439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13822485#comment-13822485
] 

Carlos Reategui commented on LIBCLOUD-439:
------------------------------------------

Ah ok.  Looking at the list_images code for the Cloudstack driver we have most of the data
to recreate the NodeImage in the native listVirtualMachines api that is use to fulfill list_nodes.
 So how about something like this:

    image = NodeImage(
                id=vm['templateid'],
                name=vm['templatename'],
                driver=self.connection.driver,
                extra={
                    'hypervisor': vm['hypervisor']})

The only things missing would be format and os in extra.  Otherwise the right way is probably
to query the list of images before looping through the node with:
        if location is not None:
            args['zoneid'] = location.id
        imgs = self._sync_request('listTemplates', **args)

then create a map with the NodeImages
        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']})

and finally assign it to the image with
    image=img_map[vm['templateid']]

Let me know which option you prefer and I can send a patch.

Also thinking of adding size to the node extra with the name of the size that the node is.

> 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)

Mime
View raw message