Search in sources :

Example 26 with DomainVO

use of com.cloud.domain.DomainVO in project cloudstack by apache.

the class DedicatedResourceManagerImpl method getDomainChildIds.

private List<Long> getDomainChildIds(long domainId) {
    DomainVO domainRecord = _domainDao.findById(domainId);
    List<Long> domainIds = new ArrayList<Long>();
    domainIds.add(domainRecord.getId());
    // find all domain Ids till leaf
    List<DomainVO> allChildDomains = _domainDao.findAllChildren(domainRecord.getPath(), domainRecord.getId());
    for (DomainVO domain : allChildDomains) {
        domainIds.add(domain.getId());
    }
    return domainIds;
}
Also used : DomainVO(com.cloud.domain.DomainVO) ArrayList(java.util.ArrayList)

Example 27 with DomainVO

use of com.cloud.domain.DomainVO in project cloudstack by apache.

the class DedicatedResourceManagerImpl method createDedicatePodResponse.

@Override
public DedicatePodResponse createDedicatePodResponse(DedicatedResources resource) {
    DedicatePodResponse dedicatePodResponse = new DedicatePodResponse();
    HostPodVO pod = _podDao.findById(resource.getPodId());
    DomainVO domain = _domainDao.findById(resource.getDomainId());
    AccountVO account = _accountDao.findById(resource.getAccountId());
    AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
    dedicatePodResponse.setId(resource.getUuid());
    dedicatePodResponse.setPodId(pod.getUuid());
    dedicatePodResponse.setPodName(pod.getName());
    dedicatePodResponse.setDomainId(domain.getUuid());
    dedicatePodResponse.setAffinityGroupId(group.getUuid());
    if (account != null) {
        dedicatePodResponse.setAccountId(account.getUuid());
    }
    dedicatePodResponse.setObjectName("dedicatedpod");
    return dedicatePodResponse;
}
Also used : DomainVO(com.cloud.domain.DomainVO) DedicatePodResponse(org.apache.cloudstack.api.response.DedicatePodResponse) HostPodVO(com.cloud.dc.HostPodVO) AccountVO(com.cloud.user.AccountVO) AffinityGroup(org.apache.cloudstack.affinity.AffinityGroup)

Example 28 with DomainVO

use of com.cloud.domain.DomainVO in project cloudstack by apache.

the class DedicatedResourceManagerImpl method createDedicateHostResponse.

@Override
public DedicateHostResponse createDedicateHostResponse(DedicatedResources resource) {
    DedicateHostResponse dedicateHostResponse = new DedicateHostResponse();
    HostVO host = _hostDao.findById(resource.getHostId());
    DomainVO domain = _domainDao.findById(resource.getDomainId());
    AccountVO account = _accountDao.findById(resource.getAccountId());
    AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
    dedicateHostResponse.setId(resource.getUuid());
    dedicateHostResponse.setHostId(host.getUuid());
    dedicateHostResponse.setHostName(host.getName());
    dedicateHostResponse.setDomainId(domain.getUuid());
    dedicateHostResponse.setAffinityGroupId(group.getUuid());
    if (account != null) {
        dedicateHostResponse.setAccountId(account.getUuid());
    }
    dedicateHostResponse.setObjectName("dedicatedhost");
    return dedicateHostResponse;
}
Also used : DomainVO(com.cloud.domain.DomainVO) DedicateHostResponse(org.apache.cloudstack.api.response.DedicateHostResponse) AccountVO(com.cloud.user.AccountVO) HostVO(com.cloud.host.HostVO) AffinityGroup(org.apache.cloudstack.affinity.AffinityGroup)

Example 29 with DomainVO

use of com.cloud.domain.DomainVO in project cloudstack by apache.

the class DedicatedResourceManagerImpl method createDedicateZoneResponse.

@Override
public DedicateZoneResponse createDedicateZoneResponse(DedicatedResources resource) {
    DedicateZoneResponse dedicateZoneResponse = new DedicateZoneResponse();
    DataCenterVO dc = _zoneDao.findById(resource.getDataCenterId());
    DomainVO domain = _domainDao.findById(resource.getDomainId());
    AccountVO account = _accountDao.findById(resource.getAccountId());
    AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
    dedicateZoneResponse.setId(resource.getUuid());
    dedicateZoneResponse.setZoneId(dc.getUuid());
    dedicateZoneResponse.setZoneName(dc.getName());
    dedicateZoneResponse.setDomainId(domain.getUuid());
    dedicateZoneResponse.setAffinityGroupId(group.getUuid());
    if (account != null) {
        dedicateZoneResponse.setAccountId(account.getUuid());
    }
    dedicateZoneResponse.setObjectName("dedicatedzone");
    return dedicateZoneResponse;
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) DomainVO(com.cloud.domain.DomainVO) DedicateZoneResponse(org.apache.cloudstack.api.response.DedicateZoneResponse) AccountVO(com.cloud.user.AccountVO) AffinityGroup(org.apache.cloudstack.affinity.AffinityGroup)

Example 30 with DomainVO

use of com.cloud.domain.DomainVO in project cloudstack by apache.

the class DedicatedResourceManagerImpl method createDedicateClusterResponse.

@Override
public DedicateClusterResponse createDedicateClusterResponse(DedicatedResources resource) {
    DedicateClusterResponse dedicateClusterResponse = new DedicateClusterResponse();
    ClusterVO cluster = _clusterDao.findById(resource.getClusterId());
    DomainVO domain = _domainDao.findById(resource.getDomainId());
    AccountVO account = _accountDao.findById(resource.getAccountId());
    AffinityGroup group = _affinityGroupDao.findById(resource.getAffinityGroupId());
    dedicateClusterResponse.setId(resource.getUuid());
    dedicateClusterResponse.setClusterId(cluster.getUuid());
    dedicateClusterResponse.setClusterName(cluster.getName());
    dedicateClusterResponse.setDomainId(domain.getUuid());
    dedicateClusterResponse.setAffinityGroupId(group.getUuid());
    if (account != null) {
        dedicateClusterResponse.setAccountId(account.getUuid());
    }
    dedicateClusterResponse.setObjectName("dedicatedcluster");
    return dedicateClusterResponse;
}
Also used : DomainVO(com.cloud.domain.DomainVO) ClusterVO(com.cloud.dc.ClusterVO) DedicateClusterResponse(org.apache.cloudstack.api.response.DedicateClusterResponse) AccountVO(com.cloud.user.AccountVO) AffinityGroup(org.apache.cloudstack.affinity.AffinityGroup)

Aggregations

DomainVO (com.cloud.domain.DomainVO)196 Account (com.cloud.user.Account)85 AccountVO (com.cloud.user.AccountVO)64 Test (org.junit.Test)56 ArrayList (java.util.ArrayList)53 DomainDao (com.cloud.domain.dao.DomainDao)30 Field (java.lang.reflect.Field)30 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)29 SslCertDao (com.cloud.network.dao.SslCertDao)29 AccountManager (com.cloud.user.AccountManager)29 SslCertVO (com.cloud.network.dao.SslCertVO)27 List (java.util.List)26 PermissionDeniedException (com.cloud.exception.PermissionDeniedException)24 Pair (com.cloud.utils.Pair)24 Domain (com.cloud.domain.Domain)23 Filter (com.cloud.utils.db.Filter)23 File (java.io.File)23 IOException (java.io.IOException)23 FileUtils.readFileToString (org.apache.commons.io.FileUtils.readFileToString)23 InvalidParameterValueException (com.cloud.utils.exception.InvalidParameterValueException)22