cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanna Santhanam <...@apache.org>
Subject Re: Marvin listPortForwardingRules API
Date Mon, 20 May 2013 10:58:38 GMT
On Mon, May 20, 2013 at 03:13:34PM +0530, Prasanna Santhanam wrote:
> On Mon, May 20, 2013 at 02:57:39PM +0530, Girish Shilamkar wrote:
> > Hello Prasanna,
> > 
> > Tests using listportforwardingrules are failing with latest marvin.
> > 
> > listportforwardingrules failed, due to: errorCode: 431, errorText:Unable to
> > execute API command listportforwardingrules due to invalid value. Invalid
> > parameter id value=c9373d55-3d01-480d-98dc-2365d3927378 due to incorrect
> > long value format, or entity does not exist or due to incorrect parameter
> > annotation for the field in api cmd class.
> > 
> > I checked the  listPortForwardingRules.py and found that "class tags" was
> > added to this file resulting in the above failure.
> > 
> > Marvin APIs are built from serverside API not sure how this "class tags"
> > got added here.
> > 
> > I have filed a bug: https://issues.apache.org/jira/browse/CLOUDSTACK-2577
> > 
> 
> That is the correct definition for listPortForwardingRules. The tags
> are additional attributes to CloudStack resources [1]. You'll find
> tags for LoadBalancingRules, Projects, etc too.
> 
> The failure msg you are seeing is because the uuid that you passed
> doesn't map to any id in CloudStack's database for the portforwarding
> rule. I see this issue on master for the PF test too [2]. 
> 
> Not sure what's the cause yet - I'll debug the next run
> 
> [1] https://cwiki.apache.org/confluence/x/PYnlAQ
> [2] http://s.apache.org/Xez

This is likely a change in behaviour of the API. When an object's
record is erased from the cloudstack DB, as in the case of FW rules,
the API server returns the exception of InvalidEntity because the UUID
doesn't exist in the system anymore. 

In case of other entities say Accounts, cloudstack retains the record but marks
it as 'removed'.  So when a user lists the object with the uuid, he gets an
empty response.

This is something Rohit and I debated about - from the point of the API server
it's not clear whether the UUID coming in is something that was once valid or
something that never existed. In the case of entities like firewall rules, we
err on the latter - entity doesn't exist.

Can you fix the test by handling the exception?
        nat_rule.delete(self.apiclient)

        try:
            list_nat_rule_response = list_nat_rules(
                                                self.apiclient,
                                                id=nat_rule.id
                                                )
        except CloudStackAPIException:
            self.debug("FW rule is deleted")


Note below the ids start from 7 not 1, because those rules are now gone.
mysql> select id, uuid, ip_address_id, start_port, end_port, protocol from firewall_rules;
+----+--------------------------------------+---------------+------------+----------+----------+
| id | uuid                                 | ip_address_id | start_port | end_port | protocol
|
+----+--------------------------------------+---------------+------------+----------+----------+
|  7 | 187402c5-60b8-4d08-954c-74b5b3e05ffd |             1 |         22 |       22 | tcp
     |
|  8 | a2497c0e-94f2-41f7-aaf1-9590b91b8bd4 |             1 |         22 |       22 | tcp
     |
| 15 | 5c657e11-7c60-4913-92d5-89eae209b06d |            16 |         22 |       22 | tcp
     |
| 17 | 5415227f-bb6e-41e9-ae83-48a28927aa34 |            17 |         22 |       22 | tcp
     |
| 18 | 504d021f-1e6a-4e63-89ab-331b61f73a6e |            17 |         22 |       22 | tcp
     |
| 19 | a1661008-edf1-4e69-848c-2f1d4aba3266 |            11 |         22 |       22 | tcp
     |
| 22 | 834bdd5c-c6e4-4af2-8c06-2962237fab0c |            11 |         22 |       22 | tcp
     |
+----+--------------------------------------+---------------+------------+----------+----------+
7 rows in set (0.00 sec)

Thanks,


-- 
Prasanna.,

------------------------
Powered by BigRock.com


Mime
View raw message