libcloud-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Kashaba <skash...@mirantis.com>
Subject Unable to get sizes using OpenStack provider
Date Thu, 27 Oct 2011 14:52:47 GMT
Hi,

I recently started to work with OpenCloud using libcloud as a high
level wrapper.
I started with the examples and almost immediately got a problem -
after creating driver (using OpenStack provider) I wasn't able to
perform list_sizes. The same time list_images works fine.
The error - it can't get any parameter - RackspaceNodeDriver._to_size
gets None instead of all the parameters.
Looks that the reason can be in the response from nova-api
I fixed the problem by changing this function to:

    def _to_size(self, el):
        def get_node_value(elem, name):
            childs = list(elem)

            for child in childs:
                if child.tag.endswith(name):
                    val = re.sub("\n[ ]+", "", child.text)
                    return val

        s = NodeSize(id=get_node_value(el, 'id'),
                     name=get_node_value(el, 'name'),
                     ram=int(get_node_value(el, 'ram')),
                     disk=int(get_node_value(el, 'disk')),
                     bandwidth=None,  # XXX: needs hardcode
                     price=self._get_size_price(get_node_value(el,
'id')),  # Hardcoded,
                     driver=self.connection.driver)
        return s


Libvirt version - 0.5.2
Nova version 2011.3
I expect that something can be missed in packets installed or wrong
configuration, would be great to get any help.

Thanks in advance
--
Sergii Kashaba
Senior developer, Mirantis, Kharkiv
SkypeID: sergii_kashaba

Mime
View raw message