

def _to_sizes(self, object):
    '\n        Request a list of instance types and convert that list to a list of\n        OpenNebulaNodeSize objects.\n\n        Request a list of instance types from the OpenNebula web interface,\n        and issue a request to convert each XML object representation of an\n        instance type to an OpenNebulaNodeSize object.\n\n        :return: List of instance types.\n        :rtype:  ``list`` of :class:`OpenNebulaNodeSize`\n        '
    sizes = []
    size_id = 1
    attributes = [('name', str, None), ('ram', int, 'MEMORY'), ('cpu', float, None), ('vcpu', float, None), ('disk', str, None), ('bandwidth', float, None), ('price', float, None)]
    for element in object.findall('INSTANCE_TYPE'):
        size_kwargs = {
            'id': size_id,
            'driver': self,
        }
        values = self._get_attributes_values(attributes=attributes, element=element)
        size_kwargs.update(values)
        size = OpenNebulaNodeSize(**size_kwargs)
        sizes.append(size)
        size_id += 1
    return sizes

dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/opennebula.py OpenNebula_3_2_NodeDriver._to_sizes/original