@Override public List<? extends Cluster> searchForClusters(long zoneId, final Long startIndex, final Long pageSizeVal, final String hypervisorType) { final Filter searchFilter = new Filter(ClusterVO.class, "id", true, startIndex, pageSizeVal); final SearchCriteria<ClusterVO> sc = _clusterDao.createSearchCriteria(); zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId); sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId); sc.addAnd("hypervisorType", SearchCriteria.Op.EQ, hypervisorType); return _clusterDao.search(sc, searchFilter); }
@Override public AcquirePodIpCmdResponse allocatePodIp(Account ipOwner, String zoneId, String podId) throws ResourceAllocationException { Account caller = CallContext.current().getCallingAccount(); long callerUserId = CallContext.current().getCallingUserId(); DataCenter zone = _entityMgr.findByUuid(DataCenter.class, zoneId); if (zone == null) { throw new InvalidParameterValueException("Invalid zone Id "); } if (_accountMgr.checkAccessAndSpecifyAuthority(caller, zone.getId()) != zone.getId()) { throw new InvalidParameterValueException("Caller does not have permission for this Zone" + "(" + zoneId + ")"); } if (s_logger.isDebugEnabled()) { s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId()); } return _ipAddrMgr.allocatePodIp(zoneId, podId); }
@Override public boolean archiveAlerts(final ArchiveAlertsCmd cmd) { final Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), null); final boolean result = _alertDao.archiveAlert(cmd.getIds(), cmd.getType(), cmd.getStartDate(), cmd.getEndDate(), zoneId); return result; }
@Override public boolean deleteAlerts(final DeleteAlertsCmd cmd) { final Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), null); final boolean result = _alertDao.deleteAlert(cmd.getIds(), cmd.getType(), cmd.getStartDate(), cmd.getEndDate(), zoneId); return result; }
long storeId = store.getId(); _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), store.getDataCenterId());
throw new InvalidParameterValueException("Image store with id " + storeId + " doesn't exist"); _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), store.getDataCenterId());
throw new InvalidParameterValueException("Cache store with id " + storeId + " doesn't exist"); _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), store.getDataCenterId());
throw new InvalidParameterValueException("Currently clusterId param is not suppoerted"); zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
final Boolean fetchLatest = cmd.getFetchLatest(); zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId); if (fetchLatest != null && fetchLatest) { _alertMgr.recalculateCapacity();
final List<String> hostTags = cmd.getHostTags(); dcId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), dcId);
@Override public Pair<List<? extends Host>, Integer> searchForServers(final ListHostsCmd cmd) { final Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId()); final Object name = cmd.getHostName(); final Object type = cmd.getType(); final Object state = cmd.getState(); final Object pod = cmd.getPodId(); final Object cluster = cmd.getClusterId(); final Object id = cmd.getId(); final Object keyword = cmd.getKeyword(); final Object resourceState = cmd.getResourceState(); final Object haHosts = cmd.getHaHost(); final Pair<List<HostVO>, Integer> result = searchForServers(cmd.getStartIndex(), cmd.getPageSizeVal(), name, type, state, zoneId, pod, cluster, id, keyword, resourceState, haHosts, null, null); return new Pair<List<? extends Host>, Integer>(result.first(), result.second()); }
@Override public Pair<List<? extends Alert>, Integer> searchForAlerts(final ListAlertsCmd cmd) { final Filter searchFilter = new Filter(AlertVO.class, "lastSent", false, cmd.getStartIndex(), cmd.getPageSizeVal()); final SearchCriteria<AlertVO> sc = _alertDao.createSearchCriteria(); final Object id = cmd.getId(); final Object type = cmd.getType(); final Object keyword = cmd.getKeyword(); final Object name = cmd.getName(); final Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), null); if (id != null) { sc.addAnd("id", SearchCriteria.Op.EQ, id); } if (zoneId != null) { sc.addAnd("data_center_id", SearchCriteria.Op.EQ, zoneId); } if (keyword != null) { final SearchCriteria<AlertVO> ssc = _alertDao.createSearchCriteria(); ssc.addOr("subject", SearchCriteria.Op.LIKE, "%" + keyword + "%"); sc.addAnd("subject", SearchCriteria.Op.SC, ssc); } if (type != null) { sc.addAnd("type", SearchCriteria.Op.EQ, type); } if (name != null) { sc.addAnd("name", SearchCriteria.Op.EQ, name); } sc.addAnd("archived", SearchCriteria.Op.EQ, false); final Pair<List<AlertVO>, Integer> result = _alertDao.searchAndCount(sc, searchFilter); return new Pair<List<? extends Alert>, Integer>(result.first(), result.second()); }
Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId()); Object id = cmd.getId(); Object name = cmd.getStoragePoolName();
private Pair<List<ImageStoreJoinVO>, Integer> searchForImageStoresInternal(ListImageStoresCmd cmd) { Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId()); Object id = cmd.getId(); Object name = cmd.getStoreName();
private Pair<List<ImageStoreJoinVO>, Integer> searchForCacheStoresInternal(ListSecondaryStagingStoresCmd cmd) { Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId()); Object id = cmd.getId(); Object name = cmd.getStoreName();
throw new InvalidParameterValueException("Host with id " + hostId + " doesn't exist"); _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), host.getDataCenterId());
final Object keyword = cmd.getKeyword(); final Object allocationState = cmd.getAllocationState(); zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
public Pair<List<HostJoinVO>, Integer> searchForServersInternal(ListHostsCmd cmd) { Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId()); Object name = cmd.getHostName(); Object type = cmd.getType();
final Object allocationState = cmd.getAllocationState(); final String keyword = cmd.getKeyword(); zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
@Override public Pair<List<? extends VirtualMachine>, Integer> searchForSystemVm(final ListSystemVMsCmd cmd) { final String type = cmd.getSystemVmType(); final Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId()); final Long id = cmd.getId(); final String name = cmd.getSystemVmName();