Prasanna does the regression  test scripts call using 8096 port?

If yes then that's the reason why the API is failing.

From: Alena Prokharchyk
Sent: Thursday, July 18, 2013 4:13 PM
To: dev@cloudstack.apache.org; Prachi Damle; Alex Huang
Subject: Re: deleteAffinityGroup API

If the API came through port 8096, then the caller comes as a System context 
(System default user id=1, account id=1). It was always like this since the 
time the UserContext was introduced.

-Alena.

From: Alex Huang <alex.hu...@citrix.com<mailto:alex.hu...@citrix.com>>
Reply-To: "dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>" 
<dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>>
Date: Thursday, July 18, 2013 4:00 PM
To: Prachi Damle <prachi.da...@citrix.com<mailto:prachi.da...@citrix.com>>, 
"dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>" 
<dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>>
Subject: RE: deleteAffinityGroup API

This one is a problem.  I will look into it.  In the bug description, all the 
logs were background threads.  All of CloudStack background threads act with 
system context.  That's correct.  That's why I closed it out.

Here I think you're actually saying that when called through admin API, it came 
in as System context.  That would be a bug if I understand you correctly.

--Alex

-----Original Message-----
From: Prachi Damle
Sent: Thursday, July 18, 2013 11:55 AM
To: dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>
Cc: Alex Huang
Subject: RE: deleteAffinityGroup API
Hi Alex,
The error thrown while deleting affinitygroup by Id is: " Account and
domainId are needed for resource creation "
Many of our APIs call AccntManager to figure out owner of the resources the
API is working on like this:
         Account caller = CallContext.current().getCallingAccount(); //earlier 
it
was using UserContext and was replaced by CallContext
         Account owner = _accountMgr.finalizeOwner(caller, account, domainId,
null);
And AccountManager: finalizeOwner has this check at start:
         if (caller.getId() == Account.ACCOUNT_ID_SYSTEM && ((accountName
== null || domainId == null) && projectId == null)) {
             throw new InvalidParameterValueException("Account and domainId
are needed for resource creation");
         }
Now the CallContext.current().getCallingAccount(); is returning the System
user causing the subsequent failure. Why would it return system user, if the
caller is admin user?
Thanks,
Prachi
-----Original Message-----
From: Prasanna Santhanam [mailto:t...@apache.org]
Sent: Thursday, July 18, 2013 6:09 AM
To: dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>
Subject: Re: deleteAffinityGroup API
On Thu, Jul 18, 2013 at 02:17:46PM +0530, Prasanna Santhanam wrote:
> On Thu, Jul 18, 2013 at 07:14:42AM +0000, Prachi Damle wrote:
> > Account and domainId are not required parameters of this API. It
> > works fine with just an id too.
> >
> > Account and domain will be used if delete is called providing a name
> > of the group instead of id, say by an admin for a regular user's
> > group.
> >
>
> Thanks Prachi - I think it is related to the recent changes in
> CallContext that is making the user system for the API call preventing
> it from deleteing the aff.group with just an id. Filed a bug for it.
Ok - Alex mentioned the bug is 'Not a Problem'. So it's only the background
CS workers which use the CallContext. But the affinity group is still failing to
delete using the id.
--
Prasanna.,
------------------------
Powered by BigRock.com


Reply via email to