mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Code format fixes
This commit is contained in:
parent
4c05adaac0
commit
294d3a2fda
@ -111,7 +111,6 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
|
||||
return caller.getId();
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -148,4 +147,5 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
|
||||
public String getEventDescription() {
|
||||
return "creating project";
|
||||
}
|
||||
|
||||
}
|
||||
@ -61,10 +61,10 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd {
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
// TODO - return project entity ownerId
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
|
||||
// tracked
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
UserContext.current().setEventDetails("Project invitation id " + id);
|
||||
@ -86,4 +86,5 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd {
|
||||
public String getEventDescription() {
|
||||
return "Project invitatino id " + id + " is being removed";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
|
||||
@IdentityMapper(entityTableName = "project_invitations")
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "list invitations by id")
|
||||
private Long id;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -82,7 +83,8 @@ public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
List<? extends ProjectInvitation> invites = _projectService.listProjectInvitations(id, projectId, this.getAccountName(), this.getDomainId(), state, activeOnly, this.getStartIndex(), this.getPageSizeVal(), this.isRecursive(), this.listAll());
|
||||
List<? extends ProjectInvitation> invites = _projectService.listProjectInvitations(id, projectId, this.getAccountName(), this.getDomainId(), state, activeOnly, this.getStartIndex(), this.getPageSizeVal(),
|
||||
this.isRecursive(), this.listAll());
|
||||
ListResponse<ProjectInvitationResponse> response = new ListResponse<ProjectInvitationResponse>();
|
||||
List<ProjectInvitationResponse> projectInvitationResponses = new ArrayList<ProjectInvitationResponse>();
|
||||
for (ProjectInvitation invite : invites) {
|
||||
@ -94,4 +96,5 @@ public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
|
||||
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -82,7 +82,8 @@ public class StartVMCmd extends BaseAsyncCmd {
|
||||
return vm.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
|
||||
// tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,4 +133,5 @@ public class StartVMCmd extends BaseAsyncCmd {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -52,7 +52,6 @@ public class StopVMCmd extends BaseAsyncCmd {
|
||||
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
|
||||
private Boolean forced;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -81,7 +80,8 @@ public class StopVMCmd extends BaseAsyncCmd {
|
||||
return vm.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
|
||||
// tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -36,7 +36,6 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateProjectInvitationCmd.class.getName());
|
||||
private static final String s_name = "updateprojectinvitationresponse";
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -80,17 +79,16 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd {
|
||||
return accept;
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
// TODO - return project entity ownerId
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
|
||||
// tracked
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
UserContext.current().setEventDetails("Project id: " + projectId + "; accountName " + accountName + "; accept " + getAccept());
|
||||
|
||||
@ -26,31 +26,40 @@ import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ProjectAccountResponse extends BaseResponse implements ControlledEntityResponse {
|
||||
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="project id")
|
||||
@SerializedName(ApiConstants.PROJECT_ID)
|
||||
@Param(description = "project id")
|
||||
private IdentityProxy projectId = new IdentityProxy("projects");
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT) @Param(description="project name")
|
||||
@SerializedName(ApiConstants.PROJECT)
|
||||
@Param(description = "project name")
|
||||
private String projectName;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the id of the account")
|
||||
@SerializedName(ApiConstants.ACCOUNT_ID)
|
||||
@Param(description = "the id of the account")
|
||||
private IdentityProxy id = new IdentityProxy("account");
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the name of the account")
|
||||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
@Param(description = "the name of the account")
|
||||
private String accountName;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT_TYPE) @Param(description="account type (admin, domain-admin, user)")
|
||||
@SerializedName(ApiConstants.ACCOUNT_TYPE)
|
||||
@Param(description = "account type (admin, domain-admin, user)")
|
||||
private Short accountType;
|
||||
|
||||
@SerializedName(ApiConstants.ROLE) @Param(description="account role in the project (regular,owner)")
|
||||
@SerializedName(ApiConstants.ROLE)
|
||||
@Param(description = "account role in the project (regular,owner)")
|
||||
private String role;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="id of the Domain the account belongs too")
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
@Param(description = "id of the Domain the account belongs too")
|
||||
private IdentityProxy domainId = new IdentityProxy("domain");
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="name of the Domain the account belongs too")
|
||||
@SerializedName(ApiConstants.DOMAIN)
|
||||
@Param(description = "name of the Domain the account belongs too")
|
||||
private String domainName;
|
||||
|
||||
@SerializedName(ApiConstants.USER) @Param(description="the list of users associated with account", responseObject = UserResponse.class)
|
||||
@SerializedName(ApiConstants.USER)
|
||||
@Param(description = "the list of users associated with account", responseObject = UserResponse.class)
|
||||
private List<UserResponse> users;
|
||||
|
||||
public void setProjectId(Long projectId) {
|
||||
|
||||
@ -212,7 +212,8 @@ public class ApiDispatcher {
|
||||
Object paramObj = unpackedParams.get(parameterAnnotation.name());
|
||||
if (paramObj == null) {
|
||||
if (parameterAnnotation.required()) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getCommandName().substring(0, cmd.getCommandName().length()-8) + " due to missing parameter " + parameterAnnotation.name());
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getCommandName().substring(0, cmd.getCommandName().length() - 8) + " due to missing parameter "
|
||||
+ parameterAnnotation.name());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -224,17 +225,20 @@ public class ApiDispatcher {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Unable to execute API command " + cmd.getCommandName() + " due to invalid value " + paramObj + " for parameter " + parameterAnnotation.name());
|
||||
}
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getCommandName().substring(0, cmd.getCommandName().length()-8) + " due to invalid value " + paramObj + " for parameter "
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getCommandName().substring(0, cmd.getCommandName().length() - 8) + " due to invalid value " + paramObj
|
||||
+ " for parameter "
|
||||
+ parameterAnnotation.name());
|
||||
} catch (ParseException parseEx) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Invalid date parameter " + paramObj + " passed to command " + cmd.getCommandName().substring(0, cmd.getCommandName().length() - 8));
|
||||
}
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to parse date " + paramObj + " for command " + cmd.getCommandName().substring(0, cmd.getCommandName().length()-8) + ", please pass dates in the format mentioned in the api documentation");
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to parse date " + paramObj + " for command " + cmd.getCommandName().substring(0, cmd.getCommandName().length() - 8)
|
||||
+ ", please pass dates in the format mentioned in the api documentation");
|
||||
} catch (InvalidParameterValueException invEx) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to execute API command " + cmd.getCommandName().substring(0, cmd.getCommandName().length() - 8) + " due to invalid value. " + invEx.getMessage());
|
||||
} catch (CloudRuntimeException cloudEx) {
|
||||
// FIXME: Better error message? This only happens if the API command is not executable, which typically means
|
||||
// FIXME: Better error message? This only happens if the API command is not executable, which typically
|
||||
// means
|
||||
// there was
|
||||
// and IllegalAccessException setting one of the parameters.
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Internal error executing API command " + cmd.getCommandName().substring(0, cmd.getCommandName().length() - 8));
|
||||
@ -252,7 +256,8 @@ public class ApiDispatcher {
|
||||
field.set(cmdObj, Boolean.valueOf(paramObj.toString()));
|
||||
break;
|
||||
case DATE:
|
||||
// This piece of code is for maintaining backward compatibility and support both the date formats(Bug 9724)
|
||||
// This piece of code is for maintaining backward compatibility and support both the date formats(Bug
|
||||
// 9724)
|
||||
// Do the date massaging for ListEventsCmd only
|
||||
if (cmdObj instanceof ListEventsCmd) {
|
||||
boolean isObjInNewDateFormat = isObjInNewDateFormat(paramObj.toString());
|
||||
@ -297,8 +302,7 @@ public class ApiDispatcher {
|
||||
case INTEGER:
|
||||
listParam.add(Integer.valueOf(token));
|
||||
break;
|
||||
case LONG:
|
||||
{
|
||||
case LONG: {
|
||||
Long val = null;
|
||||
if (identityMapper != null)
|
||||
val = s_instance._identityDao.getIdentityId(identityMapper, token);
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
package com.cloud.projects;
|
||||
|
||||
import java.util.List;
|
||||
@ -17,4 +16,5 @@ public interface ProjectManager extends ProjectService {
|
||||
boolean projectInviteRequired();
|
||||
|
||||
boolean allowUserToCreateProject();
|
||||
|
||||
}
|
||||
|
||||
@ -25,7 +25,9 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface ProjectAccountDao extends GenericDao<ProjectAccountVO, Long> {
|
||||
ProjectAccountVO getProjectOwner(long projectId);
|
||||
|
||||
List<ProjectAccountVO> listByProjectId(long projectId);
|
||||
|
||||
ProjectAccountVO findByProjectIdAccountId(long projectId, long accountId);
|
||||
|
||||
boolean canAccessProjectAccount(long accountId, long projectAccountId);
|
||||
|
||||
@ -138,4 +138,5 @@ public class ProjectAccountDaoImpl extends GenericDaoBase<ProjectAccountVO, Long
|
||||
sc.setParameters("role", role);
|
||||
return customSearch(sc, null).get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,4 +32,5 @@ public interface ProjectDao extends GenericDao<ProjectVO, Long>{
|
||||
ProjectVO findByProjectAccountId(long projectAccountId);
|
||||
|
||||
List<ProjectVO> listByState(Project.State state);
|
||||
|
||||
}
|
||||
|
||||
@ -46,7 +46,8 @@ public class ProjectDaoImpl extends GenericDaoBase<ProjectVO, Long> implements P
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
@Override
|
||||
@DB
|
||||
public boolean remove(Long projectId) {
|
||||
boolean result = false;
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
@ -87,4 +88,5 @@ public class ProjectDaoImpl extends GenericDaoBase<ProjectVO, Long> implements P
|
||||
sc.setParameters("state", state);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,12 +25,21 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface ProjectInvitationDao extends GenericDao<ProjectInvitationVO, Long> {
|
||||
ProjectInvitationVO findByAccountIdProjectId(long accountId, long projectId, State... inviteState);
|
||||
|
||||
List<ProjectInvitationVO> listExpiredInvitations();
|
||||
|
||||
boolean expirePendingInvitations(long timeOut);
|
||||
|
||||
boolean isActive(long id, long timeout);
|
||||
|
||||
ProjectInvitationVO findByEmailAndProjectId(String email, long projectId, State... inviteState);
|
||||
|
||||
ProjectInvitationVO findPendingByTokenAndProjectId(String token, long projectId, State... inviteState);
|
||||
|
||||
void cleanupInvitations(long projectId);
|
||||
|
||||
ProjectInvitationVO findPendingById(long id);
|
||||
|
||||
List<ProjectInvitationVO> listInvitationsToExpire(long timeOut);
|
||||
|
||||
}
|
||||
|
||||
@ -41,7 +41,6 @@ public class ProjectInvitationDaoImpl extends GenericDaoBase<ProjectInvitationVO
|
||||
InactiveSearch.done();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ProjectInvitationVO findByAccountIdProjectId(long accountId, long projectId, State... inviteState) {
|
||||
SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
|
||||
@ -150,4 +149,5 @@ public class ProjectInvitationDaoImpl extends GenericDaoBase<ProjectInvitationVO
|
||||
int numberRemoved = remove(sc);
|
||||
s_logger.debug("Removed " + numberRemoved + " invitations for project id=" + projectId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -298,7 +298,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
private final LoadBalancerDao _loadbalancerDao;
|
||||
private final HypervisorCapabilitiesDao _hypervisorCapabilitiesDao;
|
||||
private final Adapters<HostAllocator> _hostAllocators;
|
||||
@Inject ProjectManager _projectMgr;
|
||||
@Inject
|
||||
ProjectManager _projectMgr;
|
||||
private final ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
SnapshotManager _snapshotMgr;
|
||||
@ -369,7 +370,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
_hypervisorCapabilitiesDao = locator.getDao(HypervisorCapabilitiesDao.class);
|
||||
|
||||
|
||||
_hostAllocators = locator.getAdapters(HostAllocator.class);
|
||||
if (_hostAllocators == null || !_hostAllocators.isSet()) {
|
||||
s_logger.error("Unable to find HostAllocators");
|
||||
@ -616,7 +616,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
// The list method for offerings is being modified in accordance with discussion with Will/Kevin
|
||||
// For now, we will be listing the following based on the usertype
|
||||
// 1. For root, we will list all offerings
|
||||
// 2. For domainAdmin and regular users, we will list everything in their domains+parent domains ... all the way till
|
||||
// 2. For domainAdmin and regular users, we will list everything in their domains+parent domains ... all the way
|
||||
// till
|
||||
// root
|
||||
Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
|
||||
isAscending = (isAscending == null ? true : isAscending);
|
||||
@ -707,7 +708,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
private List<ServiceOfferingVO> searchServiceOfferingsInternal(Account account, Object name, Object id, Long vmId, Object keyword, Filter searchFilter) {
|
||||
|
||||
// it was decided to return all offerings for the user's domain, and everything above till root (for normal user or
|
||||
// it was decided to return all offerings for the user's domain, and everything above till root (for normal user
|
||||
// or
|
||||
// domain admin)
|
||||
// list all offerings belonging to this domain, and all of its parents
|
||||
// check the parent, if not null, add offerings for that parent to list
|
||||
@ -883,7 +885,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
throw new InvalidParameterValueException("VM is not Running, unable to migrate the vm " + vm);
|
||||
}
|
||||
|
||||
if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware) && !vm.getHypervisorType().equals(HypervisorType.KVM) && !vm.getHypervisorType().equals(HypervisorType.Ovm)) {
|
||||
if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware) && !vm.getHypervisorType().equals(HypervisorType.KVM)
|
||||
&& !vm.getHypervisorType().equals(HypervisorType.Ovm)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug(vm + " is not XenServer/VMware/KVM/OVM, cannot migrate this VM.");
|
||||
}
|
||||
@ -922,7 +925,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
s_logger.debug("Calling HostAllocators to search for hosts in cluster: " + cluster + " having enough capacity and suitable for migration");
|
||||
}
|
||||
|
||||
|
||||
List<Host> suitableHosts = new ArrayList<Host>();
|
||||
Enumeration<HostAllocator> enHost = _hostAllocators.enumeration();
|
||||
|
||||
@ -1295,7 +1297,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return templateZonePairSet;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VMTemplateVO updateTemplate(UpdateIsoCmd cmd) {
|
||||
return updateTemplateOrIso(cmd);
|
||||
@ -1384,7 +1385,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return _templateDao.findById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<EventVO> searchForEvents(ListEventsCmd cmd) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
@ -1511,7 +1511,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DomainRouterVO> searchForRouters(ListRoutersCmd cmd) {
|
||||
Long id = cmd.getId();
|
||||
@ -1590,7 +1589,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return _routerDao.search(sc, searchFilter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<IPAddressVO> searchForIPAddresses(ListPublicIpAddressesCmd cmd) {
|
||||
Object keyword = cmd.getKeyword();
|
||||
@ -1632,7 +1630,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
sb.and("isSourceNat", sb.entity().isSourceNat(), SearchCriteria.Op.EQ);
|
||||
sb.and("isStaticNat", sb.entity().isOneToOneNat(), SearchCriteria.Op.EQ);
|
||||
|
||||
|
||||
if (forLoadBalancing != null && (Boolean) forLoadBalancing) {
|
||||
SearchBuilder<LoadBalancerVO> lbSearch = _loadbalancerDao.createSearchBuilder();
|
||||
sb.join("lbSearch", lbSearch, sb.entity().getId(), lbSearch.entity().getSourceIpAddressId(), JoinType.INNER);
|
||||
@ -1686,7 +1683,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
sc.setParameters("isStaticNat", staticNat);
|
||||
}
|
||||
|
||||
|
||||
if (address == null && keyword != null) {
|
||||
sc.setParameters("addressLIKE", "%" + keyword + "%");
|
||||
}
|
||||
@ -1990,7 +1986,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
List<CapacityVO> capacities = new ArrayList<CapacityVO>();
|
||||
|
||||
|
||||
Integer pageSize = null;
|
||||
try {
|
||||
pageSize = Integer.valueOf(cmd.getPageSizeVal().toString());
|
||||
@ -2023,7 +2018,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
} else {
|
||||
capacity.setUsedPercentage(0);
|
||||
}
|
||||
SummedCapacity summedCapacity = new SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(), capacity.getUsedPercentage(), capacity.getCapacityType(), capacity.getDataCenterId(), capacity.getPodId(), capacity.getClusterId());
|
||||
SummedCapacity summedCapacity = new SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(), capacity.getUsedPercentage(), capacity.getCapacityType(), capacity.getDataCenterId(),
|
||||
capacity.getPodId(), capacity.getClusterId());
|
||||
list.add(summedCapacity);
|
||||
} else {
|
||||
List<DataCenterVO> dcList = _dcDao.listEnabledZones();
|
||||
@ -2034,7 +2030,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
} else {
|
||||
capacity.setUsedPercentage(0);
|
||||
}
|
||||
SummedCapacity summedCapacity = new SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(), capacity.getUsedPercentage(), capacity.getCapacityType(), capacity.getDataCenterId(), capacity.getPodId(), capacity.getClusterId());
|
||||
SummedCapacity summedCapacity = new SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(), capacity.getUsedPercentage(), capacity.getCapacityType(), capacity.getDataCenterId(),
|
||||
capacity.getPodId(), capacity.getClusterId());
|
||||
list.add(summedCapacity);
|
||||
}// End of for
|
||||
}
|
||||
@ -2108,9 +2105,9 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
|
||||
|
||||
private List<DiskOfferingVO> searchDiskOfferingsInternal(Account account, Object name, Object id, Object keyword, Filter searchFilter) {
|
||||
// it was decided to return all offerings for the user's domain, and everything above till root (for normal user or
|
||||
// it was decided to return all offerings for the user's domain, and everything above till root (for normal user
|
||||
// or
|
||||
// domain admin)
|
||||
// list all offerings belonging to this domain, and all of its parents
|
||||
// check the parent, if not null, add offerings for that parent to list
|
||||
@ -2178,7 +2175,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
// The list method for offerings is being modified in accordance with discussion with Will/Kevin
|
||||
// For now, we will be listing the following based on the usertype
|
||||
// 1. For root, we will list all offerings
|
||||
// 2. For domainAdmin and regular users, we will list everything in their domains+parent domains ... all the way till
|
||||
// 2. For domainAdmin and regular users, we will list everything in their domains+parent domains ... all the way
|
||||
// till
|
||||
// root
|
||||
|
||||
Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
|
||||
@ -2247,7 +2245,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
// FIXME: disk offerings should search back up the hierarchy for available disk offerings...
|
||||
/*
|
||||
* if (domainId != null) { sc.setParameters("domainId", domainId); // //DomainVO domain =
|
||||
* _domainDao.findById((Long)domainId); // // I want to join on user_vm.domain_id = domain.id where domain.path like
|
||||
* _domainDao.findById((Long)domainId); // // I want to join on user_vm.domain_id = domain.id where domain.path
|
||||
* like
|
||||
* 'foo%' //sc.setJoinParameters("domainSearch", "path", domain.getPath() + "%"); // }
|
||||
*/
|
||||
|
||||
@ -2362,7 +2361,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return _poolDao.search(sc, searchFilter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AsyncJobVO> searchForAsyncJobs(ListAsyncJobsCmd cmd) {
|
||||
|
||||
@ -2735,9 +2733,11 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
if (volume.getVolumeType() != Volume.Type.DATADISK) { // Datadisk dont have any template dependence.
|
||||
|
||||
VMTemplateVO template = ApiDBUtils.findTemplateById(volume.getTemplateId());
|
||||
if (template != null){ //For ISO based volumes template = null and we allow extraction of all ISO based volumes
|
||||
if (template != null) { // For ISO based volumes template = null and we allow extraction of all ISO based
|
||||
// volumes
|
||||
boolean isExtractable = template.isExtractable() && template.getTemplateType() != Storage.TemplateType.SYSTEM;
|
||||
if (!isExtractable && account != null && account.getType() != Account.ACCOUNT_TYPE_ADMIN) { // Global admins are always allowed to extract
|
||||
if (!isExtractable && account != null && account.getType() != Account.ACCOUNT_TYPE_ADMIN) { // Global
|
||||
// admins are always allowed to extract
|
||||
throw new PermissionDeniedException("The volume:" + volumeId + " is not allowed to be extracted");
|
||||
}
|
||||
}
|
||||
@ -2864,7 +2864,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InstanceGroupVO updateVmGroup(UpdateVMGroupCmd cmd) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
@ -3114,7 +3113,8 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
_accountMgr.buildACLSearchParameters(caller, null, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
|
||||
Long domainId = domainIdRecursiveListProject.first();
|
||||
Boolean isRecursive = domainIdRecursiveListProject.second();
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third(); SearchBuilder<SSHKeyPairVO> sb = _sshKeyPairDao.createSearchBuilder();
|
||||
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
|
||||
SearchBuilder<SSHKeyPairVO> sb = _sshKeyPairDao.createSearchBuilder();
|
||||
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
|
||||
Filter searchFilter = new Filter(SSHKeyPairVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
|
||||
@ -3297,7 +3297,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return hpvCapabilities;
|
||||
}
|
||||
|
||||
|
||||
hpvCapabilities = _hypervisorCapabilitiesDao.createForUpdate(id);
|
||||
|
||||
if (maxGuestsLimit != null) {
|
||||
|
||||
@ -52,6 +52,7 @@ import com.cloud.test.utils.UtilsForTest;
|
||||
|
||||
public class ApiCommand {
|
||||
public static final Logger s_logger = Logger.getLogger(ApiCommand.class.getName());
|
||||
|
||||
public static enum CommandType {
|
||||
HTTP, MYSQL, SCRIPT;
|
||||
}
|
||||
@ -68,7 +69,6 @@ public class ApiCommand{
|
||||
private CommandType commandType;
|
||||
private ResponseType responseType;
|
||||
|
||||
|
||||
private TreeMap<String, String> urlParam;
|
||||
private HashMap<String, String> verifyParam = new HashMap<String, String>();;
|
||||
private HashMap<String, String> setParam = new HashMap<String, String>();;
|
||||
@ -83,7 +83,6 @@ public class ApiCommand{
|
||||
private boolean required = false;
|
||||
private ResultSet result;
|
||||
|
||||
|
||||
public ApiCommand(Element fstElmnt, HashMap<String, String> param, HashMap<String, String> commands) {
|
||||
this.setXmlCommand(fstElmnt);
|
||||
this.setCommandName();
|
||||
@ -98,6 +97,7 @@ public class ApiCommand{
|
||||
String async = commands.get(this.getName());
|
||||
if (async != null && async.equals("yes")) {
|
||||
this.isAsync = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,7 +238,6 @@ public class ApiCommand{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set command URL
|
||||
public void setCommand(HashMap<String, String> param) {
|
||||
|
||||
@ -377,7 +376,6 @@ public class ApiCommand{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
@ -442,7 +440,8 @@ public class ApiCommand{
|
||||
// get status of the job
|
||||
Element jobStatusTag = (Element) responseBodyAsyncEl.getElementsByTagName("jobstatus").item(0);
|
||||
String jobStatus = jobStatusTag.getTextContent();
|
||||
if (!jobStatus.equals("1")) { // Need to modify with different error codes for jobAsync results
|
||||
if (!jobStatus.equals("1")) { // Need to modify with different error codes for jobAsync
|
||||
// results
|
||||
// set fake response code by now
|
||||
this.responseCode = 400;
|
||||
}
|
||||
@ -469,7 +468,6 @@ public class ApiCommand{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ================FOLLOWING METHODS USE RETURN XML FILE=======================//
|
||||
|
||||
public boolean setParam(HashMap<String, String> param) {
|
||||
@ -735,7 +733,6 @@ public class ApiCommand{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static boolean verifyEvents(HashMap<String, Integer> expectedEvents, String level, String host, String parameters) {
|
||||
boolean result = false;
|
||||
HashMap<String, Integer> actualEvents = new HashMap<String, Integer>();
|
||||
@ -795,7 +792,6 @@ public class ApiCommand{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public Element queryAsyncJobResult(String jobId) {
|
||||
Element returnBody = null;
|
||||
int code = 400;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user