libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiroshi Yoshikawa (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LIBCLOUD-704) CloudStack's drvier does not consider 'Unlimited'.
Date Thu, 30 Apr 2015 04:18:05 GMT

     [ https://issues.apache.org/jira/browse/LIBCLOUD-704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hiroshi Yoshikawa updated LIBCLOUD-704:
---------------------------------------
    Description: 
CloudStack's drvier does not consider 'Unlimited'.

When I tested ex_list_projects() method in cloudstack compute driver, I encountered an error
shown below:

{color:red}
{quote}
Traceback (most recent call last):
  File "libcloudtest.py", line 11, in <module>
    projs = driver.ex_list_projects()
  File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/cloudstack.py", line 1652,
in ex_list_projects
    extra = self._get_extra_dict(proj, extra_map)
  File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/cloudstack.py", line 3350,
in _get_extra_dict
    extra[attribute] = transform_func(value)
ValueError: invalid literal for int() with base 10: 'Unlimited'
{quote}
{color}

The ex_list_projects() receives strings from CloudStack and convert it into integers with
buit-in function 'int()'. The built-in function int() can only accept strings which represent
integers (e.g. '3', '-1'). However CloudStack may return a string 'Unlimited', which int()
can not deal with.


I modified a source 'site-packages/libcloud/compute/drivers/cloudstack.py' in order to treat
'Unlimited' as -1. Then the error disappeared.

{quote}
{noformat}
def ex_cs_int(z):
    if z == 'Unlimited':
        _val = -1
    else:
        _val = int(z)
    return _val

<< snipped >>

 'project': {
        'account': {'key_name': 'account', 'transform_func': str},
        'cpuavailable': {'key_name': 'cpuavailable', 'transform_func': ex_cs_int},
{noformat}
{quote}


  was:
CloudStack's drvier does not consider 'Unlimited'.

When I tested ex_list_projects() method in cloudstack compute driver, I encountered an error
shown below:

{color:red}
{quote}
Traceback (most recent call last):
  File "libcloudtest.py", line 11, in <module>
    projs = driver.ex_list_projects()
  File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/cloudstack.py", line 1652,
in ex_list_projects
    extra = self._get_extra_dict(proj, extra_map)
  File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/cloudstack.py", line 3350,
in _get_extra_dict
    extra[attribute] = transform_func(value)
ValueError: invalid literal for int() with base 10: 'Unlimited'
{quote}
{color}

The ex_list_projects() receives strings from CloudStack and convert it into integers with
buit-in function 'int()'. The built-in function int() can only accept strings which represent
integers (e.g. '3', '-1'). However CloudStack may return a string 'Unlimited', which int()
can not deal with.


I modified a source 'site-packages/libcloud/compute/drivers/cloudstack.py' in order to treat
'Unlimited' as -1. Then the error disappeared.

{quote}
def ex_cs_int(z):
    if z == 'Unlimited':
        _val = -1
    else:
        _val = int(z)
    return _val

<< snipped >>

 'project': {
        'account': {'key_name': 'account', 'transform_func': str},
        'cpuavailable': {'key_name': 'cpuavailable', 'transform_func': ex_cs_int},
{quote}



> CloudStack's drvier does not consider 'Unlimited'.
> --------------------------------------------------
>
>                 Key: LIBCLOUD-704
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-704
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Compute
>         Environment: CloudStack 4.3.0.2
>            Reporter: Hiroshi Yoshikawa
>
> CloudStack's drvier does not consider 'Unlimited'.
> When I tested ex_list_projects() method in cloudstack compute driver, I encountered an
error shown below:
> {color:red}
> {quote}
> Traceback (most recent call last):
>   File "libcloudtest.py", line 11, in <module>
>     projs = driver.ex_list_projects()
>   File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/cloudstack.py", line
1652, in ex_list_projects
>     extra = self._get_extra_dict(proj, extra_map)
>   File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/cloudstack.py", line
3350, in _get_extra_dict
>     extra[attribute] = transform_func(value)
> ValueError: invalid literal for int() with base 10: 'Unlimited'
> {quote}
> {color}
> The ex_list_projects() receives strings from CloudStack and convert it into integers
with buit-in function 'int()'. The built-in function int() can only accept strings which represent
integers (e.g. '3', '-1'). However CloudStack may return a string 'Unlimited', which int()
can not deal with.
> I modified a source 'site-packages/libcloud/compute/drivers/cloudstack.py' in order to
treat 'Unlimited' as -1. Then the error disappeared.
> {quote}
> {noformat}
> def ex_cs_int(z):
>     if z == 'Unlimited':
>         _val = -1
>     else:
>         _val = int(z)
>     return _val
> << snipped >>
>  'project': {
>         'account': {'key_name': 'account', 'transform_func': str},
>         'cpuavailable': {'key_name': 'cpuavailable', 'transform_func': ex_cs_int},
> {noformat}
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message