Instead of adding yet another parameter, could we look into adding a generic 
filter as in:
http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html

From: Rohit Yadav <rohit.ya...@shapeblue.com<mailto:rohit.ya...@shapeblue.com>>
Reply-To: "dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>" 
<dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>>
Date: Tuesday, November 25, 2014 at 1:27 AM
To: "dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>" 
<dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>>
Subject: Re: [DISCUSS] Major business logic refactoring: Move from Account to 
UserAccount

Good ideas, I’ll use them. So I think no one disagrees with this;

- list VMs still has user_id, but deployVM won’t
- We’ll use first user in the account if someone’s impersonating; else use 
logged in user to get user_id

On 25-Nov-2014, at 12:17 am, Prachi Damle 
<prachi.da...@citrix.com<mailto:prachi.da...@citrix.com>> wrote:

Hi Rohit,

I see your point: when deploy VM is called by an admin impersonating another 
account, the user_id value will be set to logged in user, which will be the 
admin. And this will break your usecase.
Correct?

Do you think your functionality needs this usecase i.e an admin impersonating 
deployVm for another user? If you won't hit this scenario primarily, we can 
just set the user_id to first user in the account being impersonated to cover 
this case - just as your upgrade code for existing Vms.

What do you think?

Thanks,
Prachi

-----Original Message-----
From: Rohit Yadav [mailto:rohit.ya...@shapeblue.com]
Sent: Friday, November 21, 2014 11:13 PM
To: dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>
Subject: Re: [DISCUSS] Major business logic refactoring: Move from Account to 
UserAccount

Hi Min, Prachi,

Thanks for your comments. I see your point, the use case is to list VMs for a 
user_id (uuid, not name). I'm going to add the arg/option the listVM api to 
accept user_id and return the list of VMs for that user, and add option in the 
UI to do the same. Note, this is not for auditing purposes (for that we have 
events).

But, since we allow impersonation of account while deploying a VM by the same 
logic we should allow impersonation at the user_id as well which we only accept 
in the deploy VM API if an account/domain is mentioned along with the user_id. 
If I only use logged-in user ID, it makes implementation very simple but at the 
same time but sort of breaks impersonation semantics. Note: the fix will be 
simple, won't change IAM and this is just to add capability to list VMs for a 
user ID.

On 21-Nov-2014, at 11:57 pm, Prachi Damle 
<prachi.da...@citrix.com<mailto:prachi.da...@citrix.com>> wrote:

Hi Rohit,
The accountId in deployVm API is serving the purpose of impersonation and can 
be passed typically by admin accounts to deploy VM on behalf of other User.
So Ideally with IAM, this parameter should be removed from the API and 
impersonation should be handled separately.
Keeping this goal, I think let's not add userID parameter in the API.

We should default the value to the logged in user - this will prevent usecases 
around cross-account/cross-user scenarios.
Thanks,
Prachi


-----Original Message-----
From: Min Chen [mailto:min.c...@citrix.com]
Sent: Friday, November 21, 2014 8:16 AM
To: dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>
Subject: Re: [DISCUSS] Major business logic refactoring: Move from
Account to UserAccount

If I understood correctly, (account, domainId) passed into deployVMCmd is used 
for impersonation-like behavior, that is, caller is deploying a VM on behalf of 
an account. Personally I don't like this kind of putting so many parameters in 
one API to perform several different functionalities, impersonation should be 
done through IAM separately. Too many parameters will just make our API 
semantics very hard to understand and maintain.
Along this line, I will not like to see this user_id added here.

Thanks
-min

On 11/21/14 5:20 AM, "Rohit Yadav" 
<rohit.ya...@shapeblue.com<mailto:rohit.ya...@shapeblue.com>> wrote:

Hi Prachi,

Since we¹re already allowing users to specific account and list VMs
by account, following the same pattern I added the case so as to
allow users to specify user_id in both list/deploy VM commands. In
case the userid is not specified, in that case the logged in user¹s ID will be 
used.

It¹s open for discussion of course, let me know if it¹s a good idea
to follow the same pattern or strictly use the logged-in user¹s ID?

On 21-Nov-2014, at 1:41 am, Prachi Damle 
<prachi.da...@citrix.com<mailto:prachi.da...@citrix.com>>
wrote:

Rohit,

I checked the code here
https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=shortlog;
h= ref s/heads/useraccount-refactoring and I don't understand why we
need to expose the userId parameter in the deployVm API.
I think we should be using the userId of the logged in user always.
Exposing the parameter at the API allows it to be set by a user to
the ID of another user . Also we need validation around it to make
sure it belongs to the passed account etc.

+    //Owner userId
+    @Parameter(name = ApiConstants.USER_ID, type =
+ CommandType.UUID,
entityType = UserResponse.class, required = true, description = "the
user ID of the owner, optional to use with account and domainId. If
not provided logged in user's ID is used.")
+    private Long userId;


Prachi

-----Original Message-----
From: Rohit Yadav [mailto:rohit.ya...@shapeblue.com]
Sent: Sunday, November 16, 2014 6:06 AM
To: dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>
Subject: Re: [DISCUSS] Major business logic refactoring: Move from
Account to UserAccount

Only one table will be affected.

On 16-Nov-2014, at 3:14 am, Amogh Vasekar
<amogh.vase...@citrix.com<mailto:amogh.vase...@citrix.com>>
wrote:

Question - What happens to the already existing VMs with entries in
the DB? Do we keep it NULL?

NULL will be and not useful. I think it should be okay to have a db
migration path that sets user_id to the first user in account_id
(which usually has the same name as account) for existing VMs. The
amount of code change will be minimal.

Checkout some code in this branch (has the db migration code and API
layer changes);
https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=shortlog;
h=
ref
s/heads/useraccount-refactoring

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +91 88 262 30892 | 
rohit.ya...@shapeblue.com<mailto:rohit.ya...@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 Software
Engineering<http://shapeblue.com/cloudstack-software-engineering/>
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.

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +91 88 262 30892 | 
rohit.ya...@shapeblue.com<mailto:rohit.ya...@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 Software
Engineering<http://shapeblue.com/cloudstack-software-engineering/>
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.


Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +91 88 262 30892 | 
rohit.ya...@shapeblue.com<mailto:rohit.ya...@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 Software 
Engineering<http://shapeblue.com/cloudstack-software-engineering/>
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.

Regards,
Rohit Yadav
Software Architect, ShapeBlue
M. +91 88 262 30892 | 
rohit.ya...@shapeblue.com<mailto:rohit.ya...@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 Software 
Engineering<http://shapeblue.com/cloudstack-software-engineering/>
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.

Reply via email to