You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Gaurav Aradhye <ga...@clogeny.com> on 2014/08/07 18:53:34 UTC

List APIs Behavior

I want to understand the output of the list APIs when the entity is not
present / deleted. Suppose I create an account, create a network within it
and acquire a public IP address in the network.

1) ListPublicIpAddresses  - public ip id passed, returns public IP
2) ListPublicIpAddresses - account, domainid passed, returns public IP

Now I delete the public IP (Disassociate).

After this operation, I expect following results:
1) ListPublicIpAddreses - account,domain id passed, result: None (assuming
there was only one)
2) ListPublicIpAddresses - public ip id passed, I expect exception here
because the id must have been removed from DB. But I get "None" as result
here.

If I get None, then can I assume that id is still present in DB but it is
marked as obsolete?

When can I expect an exception in return? And when can I expect None?
Ideally, when we search by Id, then exception should be thrown and when we
expect by passing account/domainid/projectid/networkid etc, then None
should be returned. Do all List APIs follow a similar guideline?

Regards,
Gaurav

Re: List APIs Behavior

Posted by Rohit Yadav <ro...@shapeblue.com>.
Hi,

The list apis is giving different behaviour on integration (default 8096) and authenticated (default 8080) ports.
Using cloudmonkey you can try: list users with/out listall=true?

Can someone check why we’ve different behaviours?

Cheers.


On 11-Aug-2014, at 7:53 am, Gaurav Aradhye <ga...@clogeny.com> wrote:

> Thanks Alena. Yes, that answers my question!
>
> Regards,
> Gaurav
>
>
> On Fri, Aug 8, 2014 at 9:45 PM, Alena Prokharchyk <
> Alena.Prokharchyk@citrix.com> wrote:
>
>> Gaurav,
>>
>> "Ideally, when we search by Id, then exception should be thrown and when
>> We expect by passing account/domainid/projectid/networkid etc, then
>> Noneshould be returned. Do all List APIs follow a similar guideline?²
>>
>> Yes, all of CS APIs follow this behavior. If non-existing Id is passed in,
>> then the error is thrown by the DB Id validator. In case of public ip
>> address its different, and let me explain why.
>>
>> When the ip gets disassociated, it doesn¹t get deleted. It¹s just marked
>> as non-allocated, and left in the DB so next associateIpAddress can pick
>> it up. Therefore you don¹t see any exception when requesting the ip by id.
>> Why empty list is returned then? Because by default, listPublicIpAddresses
>> returns allocated ips only. If you want to see free ips as well, you have
>> to pass ³allocatedOnly=false² to the call.
>>
>> Hope it answers your question.
>>
>> -Alena.
>>
>>
>>
>> On 8/8/14, 2:05 AM, "Gaurav Aradhye" <ga...@clogeny.com> wrote:
>>
>>> Thanks Daan. I will update the page.
>>>
>>> Regards,
>>> Gaurav
>>>
>>>
>>> On Fri, Aug 8, 2014 at 2:20 PM, Daan Hoogland <da...@gmail.com>
>>> wrote:
>>>
>>>> Gaurav,
>>>>
>>>> I think you are now pointing at one of the qualities of our API that
>>>> need to be addressed in 5.0 [1]. I may be wrong but I don't think a
>>>> standard behavior in these cases is defined and every list api has a
>>>> choice of several conventions to folow. Feel free to define what the
>>>> behavior should be in a future version by editing [1] :)
>>>>
>>>> [1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+changes
>>>>
>>>> On Fri, Aug 8, 2014 at 10:44 AM, Gaurav Aradhye
>>>> <ga...@clogeny.com> wrote:
>>>>> Hello,
>>>>>
>>>>> Can somebody please address this query?
>>>>>
>>>>> Regards,
>>>>> Gaurav
>>>>>
>>>>>
>>>>> On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <
>>>> gaurav.aradhye@clogeny.com>
>>>>> wrote:
>>>>>
>>>>>> I want to understand the output of the list APIs when the entity is
>>>> not
>>>>>> present / deleted. Suppose I create an account, create a network
>>>> within
>>>> it
>>>>>> and acquire a public IP address in the network.
>>>>>>
>>>>>> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
>>>>>> 2) ListPublicIpAddresses - account, domainid passed, returns public
>>>> IP
>>>>>>
>>>>>> Now I delete the public IP (Disassociate).
>>>>>>
>>>>>> After this operation, I expect following results:
>>>>>> 1) ListPublicIpAddreses - account,domain id passed, result: None
>>>> (assuming
>>>>>> there was only one)
>>>>>> 2) ListPublicIpAddresses - public ip id passed, I expect exception
>>>> here
>>>>>> because the id must have been removed from DB. But I get "None" as
>>>> result
>>>>>> here.
>>>>>>
>>>>>> If I get None, then can I assume that id is still present in DB but
>>>> it
>>>> is
>>>>>> marked as obsolete?
>>>>>>
>>>>>> When can I expect an exception in return? And when can I expect None?
>>>>>> Ideally, when we search by Id, then exception should be thrown and
>>>> when
>>>> we
>>>>>> expect by passing account/domainid/projectid/networkid etc, then None
>>>>>> should be returned. Do all List APIs follow a similar guideline?
>>>>>>
>>>>>> Regards,
>>>>>> Gaurav
>>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Daan
>>
>>

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +41 779015219 | rohit.yadav@shapeblue.com
Blog: bhaisaab.org | Twitter: @_bhaisaab



Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//>
CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/>
CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/>
CloudStack Infrastructure Support<http://shapeblue.com/cloudstack-infrastructure-support/>
CloudStack Bootcamp Training Courses<http://shapeblue.com/cloudstack-training/>

This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd or related companies. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of South Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Re: List APIs Behavior

Posted by Gaurav Aradhye <ga...@clogeny.com>.
Thanks Alena. Yes, that answers my question!

Regards,
Gaurav


On Fri, Aug 8, 2014 at 9:45 PM, Alena Prokharchyk <
Alena.Prokharchyk@citrix.com> wrote:

> Gaurav,
>
> "Ideally, when we search by Id, then exception should be thrown and when
> We expect by passing account/domainid/projectid/networkid etc, then
> Noneshould be returned. Do all List APIs follow a similar guideline?²
>
> Yes, all of CS APIs follow this behavior. If non-existing Id is passed in,
> then the error is thrown by the DB Id validator. In case of public ip
> address its different, and let me explain why.
>
> When the ip gets disassociated, it doesn¹t get deleted. It¹s just marked
> as non-allocated, and left in the DB so next associateIpAddress can pick
> it up. Therefore you don¹t see any exception when requesting the ip by id.
> Why empty list is returned then? Because by default, listPublicIpAddresses
> returns allocated ips only. If you want to see free ips as well, you have
> to pass ³allocatedOnly=false² to the call.
>
> Hope it answers your question.
>
> -Alena.
>
>
>
> On 8/8/14, 2:05 AM, "Gaurav Aradhye" <ga...@clogeny.com> wrote:
>
> >Thanks Daan. I will update the page.
> >
> >Regards,
> >Gaurav
> >
> >
> >On Fri, Aug 8, 2014 at 2:20 PM, Daan Hoogland <da...@gmail.com>
> >wrote:
> >
> >> Gaurav,
> >>
> >> I think you are now pointing at one of the qualities of our API that
> >> need to be addressed in 5.0 [1]. I may be wrong but I don't think a
> >> standard behavior in these cases is defined and every list api has a
> >> choice of several conventions to folow. Feel free to define what the
> >> behavior should be in a future version by editing [1] :)
> >>
> >> [1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+changes
> >>
> >> On Fri, Aug 8, 2014 at 10:44 AM, Gaurav Aradhye
> >> <ga...@clogeny.com> wrote:
> >> > Hello,
> >> >
> >> > Can somebody please address this query?
> >> >
> >> > Regards,
> >> > Gaurav
> >> >
> >> >
> >> > On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <
> >> gaurav.aradhye@clogeny.com>
> >> > wrote:
> >> >
> >> >> I want to understand the output of the list APIs when the entity is
> >>not
> >> >> present / deleted. Suppose I create an account, create a network
> >>within
> >> it
> >> >> and acquire a public IP address in the network.
> >> >>
> >> >> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
> >> >> 2) ListPublicIpAddresses - account, domainid passed, returns public
> >>IP
> >> >>
> >> >> Now I delete the public IP (Disassociate).
> >> >>
> >> >> After this operation, I expect following results:
> >> >> 1) ListPublicIpAddreses - account,domain id passed, result: None
> >> (assuming
> >> >> there was only one)
> >> >> 2) ListPublicIpAddresses - public ip id passed, I expect exception
> >>here
> >> >> because the id must have been removed from DB. But I get "None" as
> >> result
> >> >> here.
> >> >>
> >> >> If I get None, then can I assume that id is still present in DB but
> >>it
> >> is
> >> >> marked as obsolete?
> >> >>
> >> >> When can I expect an exception in return? And when can I expect None?
> >> >> Ideally, when we search by Id, then exception should be thrown and
> >>when
> >> we
> >> >> expect by passing account/domainid/projectid/networkid etc, then None
> >> >> should be returned. Do all List APIs follow a similar guideline?
> >> >>
> >> >> Regards,
> >> >> Gaurav
> >> >>
> >>
> >>
> >>
> >> --
> >> Daan
>
>

Re: List APIs Behavior

Posted by Alena Prokharchyk <Al...@citrix.com>.
Gaurav,

"Ideally, when we search by Id, then exception should be thrown and when
We expect by passing account/domainid/projectid/networkid etc, then
Noneshould be returned. Do all List APIs follow a similar guideline?²

Yes, all of CS APIs follow this behavior. If non-existing Id is passed in,
then the error is thrown by the DB Id validator. In case of public ip
address its different, and let me explain why.

When the ip gets disassociated, it doesn¹t get deleted. It¹s just marked
as non-allocated, and left in the DB so next associateIpAddress can pick
it up. Therefore you don¹t see any exception when requesting the ip by id.
Why empty list is returned then? Because by default, listPublicIpAddresses
returns allocated ips only. If you want to see free ips as well, you have
to pass ³allocatedOnly=false² to the call.

Hope it answers your question.

-Alena.



On 8/8/14, 2:05 AM, "Gaurav Aradhye" <ga...@clogeny.com> wrote:

>Thanks Daan. I will update the page.
>
>Regards,
>Gaurav
>
>
>On Fri, Aug 8, 2014 at 2:20 PM, Daan Hoogland <da...@gmail.com>
>wrote:
>
>> Gaurav,
>>
>> I think you are now pointing at one of the qualities of our API that
>> need to be addressed in 5.0 [1]. I may be wrong but I don't think a
>> standard behavior in these cases is defined and every list api has a
>> choice of several conventions to folow. Feel free to define what the
>> behavior should be in a future version by editing [1] :)
>>
>> [1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+changes
>>
>> On Fri, Aug 8, 2014 at 10:44 AM, Gaurav Aradhye
>> <ga...@clogeny.com> wrote:
>> > Hello,
>> >
>> > Can somebody please address this query?
>> >
>> > Regards,
>> > Gaurav
>> >
>> >
>> > On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <
>> gaurav.aradhye@clogeny.com>
>> > wrote:
>> >
>> >> I want to understand the output of the list APIs when the entity is
>>not
>> >> present / deleted. Suppose I create an account, create a network
>>within
>> it
>> >> and acquire a public IP address in the network.
>> >>
>> >> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
>> >> 2) ListPublicIpAddresses - account, domainid passed, returns public
>>IP
>> >>
>> >> Now I delete the public IP (Disassociate).
>> >>
>> >> After this operation, I expect following results:
>> >> 1) ListPublicIpAddreses - account,domain id passed, result: None
>> (assuming
>> >> there was only one)
>> >> 2) ListPublicIpAddresses - public ip id passed, I expect exception
>>here
>> >> because the id must have been removed from DB. But I get "None" as
>> result
>> >> here.
>> >>
>> >> If I get None, then can I assume that id is still present in DB but
>>it
>> is
>> >> marked as obsolete?
>> >>
>> >> When can I expect an exception in return? And when can I expect None?
>> >> Ideally, when we search by Id, then exception should be thrown and
>>when
>> we
>> >> expect by passing account/domainid/projectid/networkid etc, then None
>> >> should be returned. Do all List APIs follow a similar guideline?
>> >>
>> >> Regards,
>> >> Gaurav
>> >>
>>
>>
>>
>> --
>> Daan


Re: List APIs Behavior

Posted by Gaurav Aradhye <ga...@clogeny.com>.
Thanks Daan. I will update the page.

Regards,
Gaurav


On Fri, Aug 8, 2014 at 2:20 PM, Daan Hoogland <da...@gmail.com>
wrote:

> Gaurav,
>
> I think you are now pointing at one of the qualities of our API that
> need to be addressed in 5.0 [1]. I may be wrong but I don't think a
> standard behavior in these cases is defined and every list api has a
> choice of several conventions to folow. Feel free to define what the
> behavior should be in a future version by editing [1] :)
>
> [1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+changes
>
> On Fri, Aug 8, 2014 at 10:44 AM, Gaurav Aradhye
> <ga...@clogeny.com> wrote:
> > Hello,
> >
> > Can somebody please address this query?
> >
> > Regards,
> > Gaurav
> >
> >
> > On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <
> gaurav.aradhye@clogeny.com>
> > wrote:
> >
> >> I want to understand the output of the list APIs when the entity is not
> >> present / deleted. Suppose I create an account, create a network within
> it
> >> and acquire a public IP address in the network.
> >>
> >> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
> >> 2) ListPublicIpAddresses - account, domainid passed, returns public IP
> >>
> >> Now I delete the public IP (Disassociate).
> >>
> >> After this operation, I expect following results:
> >> 1) ListPublicIpAddreses - account,domain id passed, result: None
> (assuming
> >> there was only one)
> >> 2) ListPublicIpAddresses - public ip id passed, I expect exception here
> >> because the id must have been removed from DB. But I get "None" as
> result
> >> here.
> >>
> >> If I get None, then can I assume that id is still present in DB but it
> is
> >> marked as obsolete?
> >>
> >> When can I expect an exception in return? And when can I expect None?
> >> Ideally, when we search by Id, then exception should be thrown and when
> we
> >> expect by passing account/domainid/projectid/networkid etc, then None
> >> should be returned. Do all List APIs follow a similar guideline?
> >>
> >> Regards,
> >> Gaurav
> >>
>
>
>
> --
> Daan
>

Re: List APIs Behavior

Posted by Daan Hoogland <da...@gmail.com>.
Gaurav,

I think you are now pointing at one of the qualities of our API that
need to be addressed in 5.0 [1]. I may be wrong but I don't think a
standard behavior in these cases is defined and every list api has a
choice of several conventions to folow. Feel free to define what the
behavior should be in a future version by editing [1] :)

[1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+changes

On Fri, Aug 8, 2014 at 10:44 AM, Gaurav Aradhye
<ga...@clogeny.com> wrote:
> Hello,
>
> Can somebody please address this query?
>
> Regards,
> Gaurav
>
>
> On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <ga...@clogeny.com>
> wrote:
>
>> I want to understand the output of the list APIs when the entity is not
>> present / deleted. Suppose I create an account, create a network within it
>> and acquire a public IP address in the network.
>>
>> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
>> 2) ListPublicIpAddresses - account, domainid passed, returns public IP
>>
>> Now I delete the public IP (Disassociate).
>>
>> After this operation, I expect following results:
>> 1) ListPublicIpAddreses - account,domain id passed, result: None (assuming
>> there was only one)
>> 2) ListPublicIpAddresses - public ip id passed, I expect exception here
>> because the id must have been removed from DB. But I get "None" as result
>> here.
>>
>> If I get None, then can I assume that id is still present in DB but it is
>> marked as obsolete?
>>
>> When can I expect an exception in return? And when can I expect None?
>> Ideally, when we search by Id, then exception should be thrown and when we
>> expect by passing account/domainid/projectid/networkid etc, then None
>> should be returned. Do all List APIs follow a similar guideline?
>>
>> Regards,
>> Gaurav
>>



-- 
Daan

Re: List APIs Behavior

Posted by Gaurav Aradhye <ga...@clogeny.com>.
Hello,

Can somebody please address this query?

Regards,
Gaurav


On Thu, Aug 7, 2014 at 10:23 PM, Gaurav Aradhye <ga...@clogeny.com>
wrote:

> I want to understand the output of the list APIs when the entity is not
> present / deleted. Suppose I create an account, create a network within it
> and acquire a public IP address in the network.
>
> 1) ListPublicIpAddresses  - public ip id passed, returns public IP
> 2) ListPublicIpAddresses - account, domainid passed, returns public IP
>
> Now I delete the public IP (Disassociate).
>
> After this operation, I expect following results:
> 1) ListPublicIpAddreses - account,domain id passed, result: None (assuming
> there was only one)
> 2) ListPublicIpAddresses - public ip id passed, I expect exception here
> because the id must have been removed from DB. But I get "None" as result
> here.
>
> If I get None, then can I assume that id is still present in DB but it is
> marked as obsolete?
>
> When can I expect an exception in return? And when can I expect None?
> Ideally, when we search by Id, then exception should be thrown and when we
> expect by passing account/domainid/projectid/networkid etc, then None
> should be returned. Do all List APIs follow a similar guideline?
>
> Regards,
> Gaurav
>