You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Bug Reference

Unable to render Jira issues macro, execution error.

Purpose

Due to CloudStack's account based tenant model VMs cannot be listed by the user who created them. The aim of this small feature is to add a user_id column in the vm_instance table and expose listing based on user ID.

Architecture and Design description

The VMInstanceVO class was modified to accept userId parameter. The userId for systemvm is the system user, for others the userId is the calling user's ID. In case the calling user's account ID is not same as the owner ID (for example an admin launching VMs for a user), the userId is set to the first available user in the owner account. For example:

long userId = CallContext.current().getCallingUserId();
if (CallContext.current().getCallingAccount().getId() != owner.getId()) {
 userId =  _userDao.listByAccount(owner.getAccountId()).get(0).getId();
}

The listVM API now accepts a new "userid" parameter which if passed will return list of VMs searching for that particular userID.

Notes

  • Upgrade path will set userId to first user in the account
  • user_vm_view will have the user_id column

 

  • No labels