Search in sources :

Example 1 with Pod

use of com.cloud.dc.Pod in project CloudStack-archive by CloudStack-extras.

the class ListPodsByCmd method execute.

@Override
public void execute() {
    List<? extends Pod> result = _mgr.searchForPods(this);
    ListResponse<PodResponse> response = new ListResponse<PodResponse>();
    List<PodResponse> podResponses = new ArrayList<PodResponse>();
    for (Pod pod : result) {
        PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities);
        podResponse.setObjectName("pod");
        podResponses.add(podResponse);
    }
    response.setResponses(podResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) Pod(com.cloud.dc.Pod) ArrayList(java.util.ArrayList) PodResponse(com.cloud.api.response.PodResponse)

Example 2 with Pod

use of com.cloud.dc.Pod in project CloudStack-archive by CloudStack-extras.

the class CreatePodCmd method execute.

@Override
public void execute() {
    Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState());
    if (result != null) {
        PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod");
    }
}
Also used : Pod(com.cloud.dc.Pod) ServerApiException(com.cloud.api.ServerApiException) PodResponse(com.cloud.api.response.PodResponse)

Example 3 with Pod

use of com.cloud.dc.Pod in project cloudstack by apache.

the class LoadBalanceRuleHandler method deployLoadBalancerVM.

private DomainRouterVO deployLoadBalancerVM(final Long networkId, final IPAddressVO ipAddr) {
    final NetworkVO network = _networkDao.findById(networkId);
    final DataCenter dc = _dcDao.findById(network.getDataCenterId());
    final Long podId = getPodIdForDirectIp(ipAddr);
    final Pod pod = podId == null ? null : _podDao.findById(podId);
    final Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
    params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
    final Account owner = _accountService.getActiveAccountByName("system", new Long(1));
    final DeployDestination dest = new DeployDestination(dc, pod, null, null);
    s_logger.debug("About to deploy ELB vm ");
    try {
        final DomainRouterVO elbVm = deployELBVm(network, dest, owner, params);
        if (elbVm == null) {
            throw new InvalidParameterValueException("Could not deploy or find existing ELB VM");
        }
        s_logger.debug("Deployed ELB  vm = " + elbVm);
        return elbVm;
    } catch (final Throwable t) {
        s_logger.warn("Error while deploying ELB VM:  ", t);
        return null;
    }
}
Also used : Account(com.cloud.user.Account) NetworkVO(com.cloud.network.dao.NetworkVO) Pod(com.cloud.dc.Pod) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) DataCenter(com.cloud.dc.DataCenter) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) DeployDestination(com.cloud.deploy.DeployDestination) Param(com.cloud.vm.VirtualMachineProfile.Param) VirtualMachineProfile(com.cloud.vm.VirtualMachineProfile) DomainRouterVO(com.cloud.vm.DomainRouterVO)

Example 4 with Pod

use of com.cloud.dc.Pod in project cloudstack by apache.

the class CreatePodCmd method execute.

@Override
public void execute() {
    Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState());
    if (result != null) {
        PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod");
    }
}
Also used : Pod(com.cloud.dc.Pod) ServerApiException(org.apache.cloudstack.api.ServerApiException) PodResponse(org.apache.cloudstack.api.response.PodResponse)

Example 5 with Pod

use of com.cloud.dc.Pod in project cloudstack by apache.

the class UpdatePodCmd method execute.

@Override
public void execute() {
    Pod result = _configService.editPod(this);
    if (result != null) {
        PodResponse response = _responseGenerator.createPodResponse(result, false);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod");
    }
}
Also used : Pod(com.cloud.dc.Pod) ServerApiException(org.apache.cloudstack.api.ServerApiException) PodResponse(org.apache.cloudstack.api.response.PodResponse)

Aggregations

Pod (com.cloud.dc.Pod)23 DataCenter (com.cloud.dc.DataCenter)9 ArrayList (java.util.ArrayList)6 Host (com.cloud.host.Host)5 Cluster (com.cloud.org.Cluster)5 StoragePool (com.cloud.storage.StoragePool)5 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)5 DeployDestination (com.cloud.deploy.DeployDestination)4 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)4 Volume (com.cloud.storage.Volume)4 DB (com.cloud.utils.db.DB)4 List (java.util.List)4 PodResponse (com.cloud.api.response.PodResponse)3 DiskOffering (com.cloud.offering.DiskOffering)3 ServiceOffering (com.cloud.offering.ServiceOffering)3 HashMap (java.util.HashMap)3 ServerApiException (com.cloud.api.ServerApiException)2 ClusterDetailsVO (com.cloud.dc.ClusterDetailsVO)2 ClusterVO (com.cloud.dc.ClusterVO)2 VlanVO (com.cloud.dc.VlanVO)2