Search in sources :

Example 1 with NicResponse

use of org.apache.cloudstack.api.response.NicResponse in project cloudstack by apache.

the class UserVmJoinDaoImpl method setUserVmResponse.

@Override
public UserVmResponse setUserVmResponse(ResponseView view, UserVmResponse userVmData, UserVmJoinVO uvo) {
    Long securityGroupId = uvo.getSecurityGroupId();
    if (securityGroupId != null && securityGroupId.longValue() != 0) {
        SecurityGroupResponse resp = new SecurityGroupResponse();
        resp.setId(uvo.getSecurityGroupUuid());
        resp.setName(uvo.getSecurityGroupName());
        resp.setDescription(uvo.getSecurityGroupDescription());
        resp.setObjectName("securitygroup");
        if (uvo.getAccountType() == Account.ACCOUNT_TYPE_PROJECT) {
            resp.setProjectId(uvo.getProjectUuid());
            resp.setProjectName(uvo.getProjectName());
        } else {
            resp.setAccountName(uvo.getAccountName());
        }
        userVmData.addSecurityGroup(resp);
    }
    long nic_id = uvo.getNicId();
    if (nic_id > 0) {
        NicResponse nicResponse = new NicResponse();
        nicResponse.setId(uvo.getNicUuid());
        nicResponse.setIpaddress(uvo.getIpAddress());
        nicResponse.setGateway(uvo.getGateway());
        nicResponse.setNetmask(uvo.getNetmask());
        nicResponse.setNetworkid(uvo.getNetworkUuid());
        nicResponse.setNetworkName(uvo.getNetworkName());
        nicResponse.setMacAddress(uvo.getMacAddress());
        nicResponse.setIp6Address(uvo.getIp6Address());
        nicResponse.setIp6Gateway(uvo.getIp6Gateway());
        nicResponse.setIp6Cidr(uvo.getIp6Cidr());
        if (uvo.getBroadcastUri() != null) {
            nicResponse.setBroadcastUri(uvo.getBroadcastUri().toString());
        }
        if (uvo.getIsolationUri() != null) {
            nicResponse.setIsolationUri(uvo.getIsolationUri().toString());
        }
        if (uvo.getTrafficType() != null) {
            nicResponse.setTrafficType(uvo.getTrafficType().toString());
        }
        if (uvo.getGuestType() != null) {
            nicResponse.setType(uvo.getGuestType().toString());
        }
        nicResponse.setIsDefault(uvo.isDefaultNic());
        List<NicSecondaryIpVO> secondaryIps = ApiDBUtils.findNicSecondaryIps(uvo.getNicId());
        if (secondaryIps != null) {
            List<NicSecondaryIpResponse> ipList = new ArrayList<NicSecondaryIpResponse>();
            for (NicSecondaryIpVO ip : secondaryIps) {
                NicSecondaryIpResponse ipRes = new NicSecondaryIpResponse();
                ipRes.setId(ip.getUuid());
                ipRes.setIpAddr(ip.getIp4Address());
                ipList.add(ipRes);
            }
            nicResponse.setSecondaryIps(ipList);
        }
        nicResponse.setObjectName("nic");
        userVmData.addNic(nicResponse);
    }
    long tag_id = uvo.getTagId();
    if (tag_id > 0 && !userVmData.containTag(tag_id)) {
        addTagInformation(uvo, userVmData);
    }
    Long affinityGroupId = uvo.getAffinityGroupId();
    if (affinityGroupId != null && affinityGroupId.longValue() != 0) {
        AffinityGroupResponse resp = new AffinityGroupResponse();
        resp.setId(uvo.getAffinityGroupUuid());
        resp.setName(uvo.getAffinityGroupName());
        resp.setDescription(uvo.getAffinityGroupDescription());
        resp.setObjectName("affinitygroup");
        resp.setAccountName(uvo.getAccountName());
        userVmData.addAffinityGroup(resp);
    }
    return userVmData;
}
Also used : NicSecondaryIpResponse(org.apache.cloudstack.api.response.NicSecondaryIpResponse) NicSecondaryIpVO(com.cloud.vm.dao.NicSecondaryIpVO) AffinityGroupResponse(org.apache.cloudstack.affinity.AffinityGroupResponse) ArrayList(java.util.ArrayList) SecurityGroupResponse(org.apache.cloudstack.api.response.SecurityGroupResponse) NicResponse(org.apache.cloudstack.api.response.NicResponse)

Example 2 with NicResponse

use of org.apache.cloudstack.api.response.NicResponse in project cloudstack by apache.

the class ListNicsCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
    try {
        List<? extends Nic> results = _networkService.listNics(this);
        ListResponse<NicResponse> response = new ListResponse<NicResponse>();
        List<NicResponse> resList = null;
        if (results != null) {
            resList = new ArrayList<NicResponse>(results.size());
            for (Nic r : results) {
                NicResponse resp = _responseGenerator.createNicResponse(r);
                resp.setObjectName("nic");
                resList.add(resp);
            }
            response.setResponses(resList);
        }
        response.setResponses(resList);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (Exception e) {
        s_logger.warn("Failed to list secondary ip address per nic ");
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
    }
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) Nic(com.cloud.vm.Nic) ServerApiException(org.apache.cloudstack.api.ServerApiException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException) NicResponse(org.apache.cloudstack.api.response.NicResponse)

Example 3 with NicResponse

use of org.apache.cloudstack.api.response.NicResponse in project cloudstack by apache.

the class DomainRouterJoinDaoImpl method setDomainRouterResponse.

@Override
public DomainRouterResponse setDomainRouterResponse(DomainRouterResponse vrData, DomainRouterJoinVO vr) {
    long nic_id = vr.getNicId();
    if (nic_id > 0) {
        TrafficType ty = vr.getTrafficType();
        if (ty != null) {
            // nics response object
            if (ty == TrafficType.Public) {
                vrData.setPublicIp(vr.getIpAddress());
                vrData.setPublicMacAddress(vr.getMacAddress());
                vrData.setPublicNetmask(vr.getNetmask());
                vrData.setGateway(vr.getGateway());
                vrData.setPublicNetworkId(vr.getNetworkUuid());
            } else if (ty == TrafficType.Control) {
                vrData.setLinkLocalIp(vr.getIpAddress());
                vrData.setLinkLocalMacAddress(vr.getMacAddress());
                vrData.setLinkLocalNetmask(vr.getNetmask());
                vrData.setLinkLocalNetworkId(vr.getNetworkUuid());
            } else if (ty == TrafficType.Guest) {
                vrData.setGuestIpAddress(vr.getIpAddress());
                vrData.setGuestMacAddress(vr.getMacAddress());
                vrData.setGuestNetmask(vr.getNetmask());
                vrData.setGuestNetworkId(vr.getNetworkUuid());
                vrData.setGuestNetworkName(vr.getNetworkName());
                vrData.setNetworkDomain(vr.getNetworkDomain());
            }
        }
        NicResponse nicResponse = new NicResponse();
        nicResponse.setId(vr.getNicUuid());
        nicResponse.setIpaddress(vr.getIpAddress());
        nicResponse.setGateway(vr.getGateway());
        nicResponse.setNetmask(vr.getNetmask());
        nicResponse.setNetworkid(vr.getNetworkUuid());
        nicResponse.setNetworkName(vr.getNetworkName());
        nicResponse.setMacAddress(vr.getMacAddress());
        nicResponse.setIp6Address(vr.getIp6Address());
        nicResponse.setIp6Gateway(vr.getIp6Gateway());
        nicResponse.setIp6Cidr(vr.getIp6Cidr());
        if (vr.getBroadcastUri() != null) {
            nicResponse.setBroadcastUri(vr.getBroadcastUri().toString());
        }
        if (vr.getIsolationUri() != null) {
            nicResponse.setIsolationUri(vr.getIsolationUri().toString());
        }
        if (vr.getTrafficType() != null) {
            nicResponse.setTrafficType(vr.getTrafficType().toString());
        }
        if (vr.getGuestType() != null) {
            nicResponse.setType(vr.getGuestType().toString());
        }
        nicResponse.setIsDefault(vr.isDefaultNic());
        nicResponse.setObjectName("nic");
        vrData.addNic(nicResponse);
    }
    return vrData;
}
Also used : TrafficType(com.cloud.network.Networks.TrafficType) NicResponse(org.apache.cloudstack.api.response.NicResponse)

Example 4 with NicResponse

use of org.apache.cloudstack.api.response.NicResponse in project cloudstack by apache.

the class DomainRouterJoinDaoImpl method newDomainRouterResponse.

@Override
public DomainRouterResponse newDomainRouterResponse(DomainRouterJoinVO router, Account caller) {
    DomainRouterResponse routerResponse = new DomainRouterResponse();
    routerResponse.setId(router.getUuid());
    routerResponse.setZoneId(router.getDataCenterUuid());
    routerResponse.setName(router.getName());
    routerResponse.setTemplateId(router.getTemplateUuid());
    routerResponse.setCreated(router.getCreated());
    routerResponse.setState(router.getState());
    routerResponse.setIsRedundantRouter(router.isRedundantRouter());
    routerResponse.setRedundantState(router.getRedundantState().toString());
    if (router.getTemplateVersion() != null) {
        String routerVersion = Version.trimRouterVersion(router.getTemplateVersion());
        routerResponse.setVersion(routerVersion);
        routerResponse.setRequiresUpgrade((Version.compare(routerVersion, NetworkOrchestrationService.MinVRVersion.valueIn(router.getDataCenterId())) < 0));
    } else {
        routerResponse.setVersion("UNKNOWN");
        routerResponse.setRequiresUpgrade(true);
    }
    if (caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN || _accountMgr.isRootAdmin(caller.getId())) {
        if (router.getHostId() != null) {
            routerResponse.setHostId(router.getHostUuid());
            routerResponse.setHostName(router.getHostName());
            routerResponse.setHypervisor(router.getHypervisorType().toString());
        }
        routerResponse.setPodId(router.getPodUuid());
        long nic_id = router.getNicId();
        if (nic_id > 0) {
            TrafficType ty = router.getTrafficType();
            if (ty != null) {
                // nics response object
                if (ty == TrafficType.Public) {
                    routerResponse.setPublicIp(router.getIpAddress());
                    routerResponse.setPublicMacAddress(router.getMacAddress());
                    routerResponse.setPublicNetmask(router.getNetmask());
                    routerResponse.setGateway(router.getGateway());
                    routerResponse.setPublicNetworkId(router.getNetworkUuid());
                } else if (ty == TrafficType.Control) {
                    routerResponse.setLinkLocalIp(router.getIpAddress());
                    routerResponse.setLinkLocalMacAddress(router.getMacAddress());
                    routerResponse.setLinkLocalNetmask(router.getNetmask());
                    routerResponse.setLinkLocalNetworkId(router.getNetworkUuid());
                } else if (ty == TrafficType.Guest) {
                    routerResponse.setGuestIpAddress(router.getIpAddress());
                    routerResponse.setGuestMacAddress(router.getMacAddress());
                    routerResponse.setGuestNetmask(router.getNetmask());
                    routerResponse.setGuestNetworkId(router.getNetworkUuid());
                    routerResponse.setGuestNetworkName(router.getNetworkName());
                    routerResponse.setNetworkDomain(router.getNetworkDomain());
                }
            }
            NicResponse nicResponse = new NicResponse();
            nicResponse.setId(router.getNicUuid());
            nicResponse.setIpaddress(router.getIpAddress());
            nicResponse.setGateway(router.getGateway());
            nicResponse.setNetmask(router.getNetmask());
            nicResponse.setNetworkid(router.getNetworkUuid());
            nicResponse.setNetworkName(router.getNetworkName());
            nicResponse.setMacAddress(router.getMacAddress());
            nicResponse.setIp6Address(router.getIp6Address());
            nicResponse.setIp6Gateway(router.getIp6Gateway());
            nicResponse.setIp6Cidr(router.getIp6Cidr());
            if (router.getBroadcastUri() != null) {
                nicResponse.setBroadcastUri(router.getBroadcastUri().toString());
            }
            if (router.getIsolationUri() != null) {
                nicResponse.setIsolationUri(router.getIsolationUri().toString());
            }
            if (router.getTrafficType() != null) {
                nicResponse.setTrafficType(router.getTrafficType().toString());
            }
            if (router.getGuestType() != null) {
                nicResponse.setType(router.getGuestType().toString());
            }
            nicResponse.setIsDefault(router.isDefaultNic());
            nicResponse.setObjectName("nic");
            routerResponse.addNic(nicResponse);
        }
    }
    routerResponse.setServiceOfferingId(router.getServiceOfferingUuid());
    routerResponse.setServiceOfferingName(router.getServiceOfferingName());
    // populate owner.
    ApiResponseHelper.populateOwner(routerResponse, router);
    routerResponse.setDomainId(router.getDomainUuid());
    routerResponse.setDomainName(router.getDomainName());
    routerResponse.setZoneName(router.getDataCenterName());
    routerResponse.setDns1(router.getDns1());
    routerResponse.setDns2(router.getDns2());
    routerResponse.setIp6Dns1(router.getIp6Dns1());
    routerResponse.setIp6Dns2(router.getIp6Dns2());
    routerResponse.setVpcId(router.getVpcUuid());
    routerResponse.setVpcName(router.getVpcName());
    routerResponse.setRole(router.getRole().toString());
    // set async job
    if (router.getJobId() != null) {
        routerResponse.setJobId(router.getJobUuid());
        routerResponse.setJobStatus(router.getJobStatus());
    }
    if (router.getRole() == Role.INTERNAL_LB_VM) {
        routerResponse.setObjectName("internalloadbalancervm");
    } else {
        routerResponse.setObjectName("router");
    }
    return routerResponse;
}
Also used : DomainRouterResponse(org.apache.cloudstack.api.response.DomainRouterResponse) TrafficType(com.cloud.network.Networks.TrafficType) NicResponse(org.apache.cloudstack.api.response.NicResponse)

Example 5 with NicResponse

use of org.apache.cloudstack.api.response.NicResponse in project cloudstack by apache.

the class UserVmJoinDaoImpl method newUserVmResponse.

@Override
public UserVmResponse newUserVmResponse(ResponseView view, String objectName, UserVmJoinVO userVm, EnumSet<VMDetails> details, Account caller) {
    UserVmResponse userVmResponse = new UserVmResponse();
    if (userVm.getHypervisorType() != null) {
        userVmResponse.setHypervisor(userVm.getHypervisorType().toString());
    }
    userVmResponse.setId(userVm.getUuid());
    userVmResponse.setName(userVm.getName());
    if (userVm.getDisplayName() != null) {
        userVmResponse.setDisplayName(userVm.getDisplayName());
    } else {
        userVmResponse.setDisplayName(userVm.getName());
    }
    if (userVm.getAccountType() == Account.ACCOUNT_TYPE_PROJECT) {
        userVmResponse.setProjectId(userVm.getProjectUuid());
        userVmResponse.setProjectName(userVm.getProjectName());
    } else {
        userVmResponse.setAccountName(userVm.getAccountName());
    }
    User user = _userDao.getUser(userVm.getUserId());
    if (user != null) {
        userVmResponse.setUserId(user.getUuid());
        userVmResponse.setUserName(user.getUsername());
    }
    userVmResponse.setDomainId(userVm.getDomainUuid());
    userVmResponse.setDomainName(userVm.getDomainName());
    userVmResponse.setCreated(userVm.getCreated());
    userVmResponse.setDisplayVm(userVm.isDisplayVm());
    if (userVm.getState() != null) {
        userVmResponse.setState(userVm.getState().toString());
    }
    userVmResponse.setHaEnable(userVm.isHaEnabled());
    if (details.contains(VMDetails.all) || details.contains(VMDetails.group)) {
        userVmResponse.setGroupId(userVm.getInstanceGroupUuid());
        userVmResponse.setGroup(userVm.getInstanceGroupName());
    }
    userVmResponse.setZoneId(userVm.getDataCenterUuid());
    userVmResponse.setZoneName(userVm.getDataCenterName());
    if (view == ResponseView.Full) {
        userVmResponse.setInstanceName(userVm.getInstanceName());
        userVmResponse.setHostId(userVm.getHostUuid());
        userVmResponse.setHostName(userVm.getHostName());
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.tmpl)) {
        userVmResponse.setTemplateId(userVm.getTemplateUuid());
        userVmResponse.setTemplateName(userVm.getTemplateName());
        userVmResponse.setTemplateDisplayText(userVm.getTemplateDisplayText());
        userVmResponse.setPasswordEnabled(userVm.isPasswordEnabled());
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.iso)) {
        userVmResponse.setIsoId(userVm.getIsoUuid());
        userVmResponse.setIsoName(userVm.getIsoName());
        userVmResponse.setIsoDisplayText(userVm.getIsoDisplayText());
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.servoff)) {
        userVmResponse.setServiceOfferingId(userVm.getServiceOfferingUuid());
        userVmResponse.setServiceOfferingName(userVm.getServiceOfferingName());
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.diskoff)) {
        userVmResponse.setDiskOfferingId(userVm.getDiskOfferingUuid());
        userVmResponse.setDiskOfferingName(userVm.getDiskOfferingName());
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.servoff) || details.contains(VMDetails.stats)) {
        userVmResponse.setCpuNumber(userVm.getCpu());
        userVmResponse.setCpuSpeed(userVm.getSpeed());
        userVmResponse.setMemory(userVm.getRamSize());
        ServiceOfferingDetailsVO serviceOfferingDetail = ApiDBUtils.findServiceOfferingDetail(userVm.getServiceOfferingId(), GPU.Keys.vgpuType.toString());
        if (serviceOfferingDetail != null) {
            userVmResponse.setVgpu(serviceOfferingDetail.getValue());
        }
    }
    userVmResponse.setGuestOsId(userVm.getGuestOsUuid());
    if (details.contains(VMDetails.all) || details.contains(VMDetails.volume)) {
        userVmResponse.setRootDeviceId(userVm.getVolumeDeviceId());
        if (userVm.getVolumeType() != null) {
            userVmResponse.setRootDeviceType(userVm.getVolumeType().toString());
        }
    }
    userVmResponse.setPassword(userVm.getPassword());
    if (userVm.getJobId() != null) {
        userVmResponse.setJobId(userVm.getJobUuid());
        userVmResponse.setJobStatus(userVm.getJobStatus());
    }
    //userVmResponse.setForVirtualNetwork(userVm.getForVirtualNetwork());
    userVmResponse.setPublicIpId(userVm.getPublicIpUuid());
    userVmResponse.setPublicIp(userVm.getPublicIpAddress());
    userVmResponse.setKeyPairName(userVm.getKeypairName());
    userVmResponse.setOsTypeId(userVm.getGuestOsId());
    if (details.contains(VMDetails.all) || details.contains(VMDetails.stats)) {
        // stats calculation
        VmStats vmStats = ApiDBUtils.getVmStatistics(userVm.getId());
        if (vmStats != null) {
            userVmResponse.setCpuUsed(new DecimalFormat("#.##").format(vmStats.getCPUUtilization()) + "%");
            userVmResponse.setNetworkKbsRead((long) vmStats.getNetworkReadKBs());
            userVmResponse.setNetworkKbsWrite((long) vmStats.getNetworkWriteKBs());
            userVmResponse.setDiskKbsRead((long) vmStats.getDiskReadKBs());
            userVmResponse.setDiskKbsWrite((long) vmStats.getDiskWriteKBs());
            userVmResponse.setDiskIORead((long) vmStats.getDiskReadIOs());
            userVmResponse.setDiskIOWrite((long) vmStats.getDiskWriteIOs());
            userVmResponse.setMemoryKBs((long) vmStats.getMemoryKBs());
            userVmResponse.setMemoryIntFreeKBs((long) vmStats.getIntFreeMemoryKBs());
            userVmResponse.setMemoryTargetKBs((long) vmStats.getTargetMemoryKBs());
        }
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.secgrp)) {
        Long securityGroupId = userVm.getSecurityGroupId();
        if (securityGroupId != null && securityGroupId.longValue() != 0) {
            SecurityGroupResponse resp = new SecurityGroupResponse();
            resp.setId(userVm.getSecurityGroupUuid());
            resp.setName(userVm.getSecurityGroupName());
            resp.setDescription(userVm.getSecurityGroupDescription());
            resp.setObjectName("securitygroup");
            if (userVm.getAccountType() == Account.ACCOUNT_TYPE_PROJECT) {
                resp.setProjectId(userVm.getProjectUuid());
                resp.setProjectName(userVm.getProjectName());
            } else {
                resp.setAccountName(userVm.getAccountName());
            }
            userVmResponse.addSecurityGroup(resp);
        }
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.nics)) {
        long nic_id = userVm.getNicId();
        if (nic_id > 0) {
            NicResponse nicResponse = new NicResponse();
            nicResponse.setId(userVm.getNicUuid());
            nicResponse.setIpaddress(userVm.getIpAddress());
            nicResponse.setGateway(userVm.getGateway());
            nicResponse.setNetmask(userVm.getNetmask());
            nicResponse.setNetworkid(userVm.getNetworkUuid());
            nicResponse.setNetworkName(userVm.getNetworkName());
            nicResponse.setMacAddress(userVm.getMacAddress());
            nicResponse.setIp6Address(userVm.getIp6Address());
            nicResponse.setIp6Gateway(userVm.getIp6Gateway());
            nicResponse.setIp6Cidr(userVm.getIp6Cidr());
            if (userVm.getBroadcastUri() != null) {
                nicResponse.setBroadcastUri(userVm.getBroadcastUri().toString());
            }
            if (userVm.getIsolationUri() != null) {
                nicResponse.setIsolationUri(userVm.getIsolationUri().toString());
            }
            if (userVm.getTrafficType() != null) {
                nicResponse.setTrafficType(userVm.getTrafficType().toString());
            }
            if (userVm.getGuestType() != null) {
                nicResponse.setType(userVm.getGuestType().toString());
            }
            nicResponse.setIsDefault(userVm.isDefaultNic());
            List<NicSecondaryIpVO> secondaryIps = ApiDBUtils.findNicSecondaryIps(userVm.getNicId());
            if (secondaryIps != null) {
                List<NicSecondaryIpResponse> ipList = new ArrayList<NicSecondaryIpResponse>();
                for (NicSecondaryIpVO ip : secondaryIps) {
                    NicSecondaryIpResponse ipRes = new NicSecondaryIpResponse();
                    ipRes.setId(ip.getUuid());
                    ipRes.setIpAddr(ip.getIp4Address());
                    ipList.add(ipRes);
                }
                nicResponse.setSecondaryIps(ipList);
            }
            nicResponse.setObjectName("nic");
            userVmResponse.addNic(nicResponse);
        }
    }
    // update tag information
    long tag_id = userVm.getTagId();
    if (tag_id > 0 && !userVmResponse.containTag(tag_id)) {
        addTagInformation(userVm, userVmResponse);
    }
    if (details.contains(VMDetails.all) || details.contains(VMDetails.affgrp)) {
        Long affinityGroupId = userVm.getAffinityGroupId();
        if (affinityGroupId != null && affinityGroupId.longValue() != 0) {
            AffinityGroupResponse resp = new AffinityGroupResponse();
            resp.setId(userVm.getAffinityGroupUuid());
            resp.setName(userVm.getAffinityGroupName());
            resp.setDescription(userVm.getAffinityGroupDescription());
            resp.setObjectName("affinitygroup");
            resp.setAccountName(userVm.getAccountName());
            userVmResponse.addAffinityGroup(resp);
        }
    }
    // set resource details map
    // Allow passing details to end user
    List<UserVmDetailVO> vmDetails = _userVmDetailsDao.listDetails(userVm.getId());
    if (vmDetails != null) {
        Map<String, String> resourceDetails = new HashMap<String, String>();
        for (UserVmDetailVO userVmDetailVO : vmDetails) {
            resourceDetails.put(userVmDetailVO.getName(), userVmDetailVO.getValue());
        }
        userVmResponse.setDetails(resourceDetails);
    }
    userVmResponse.setObjectName(objectName);
    if (userVm.isDynamicallyScalable() == null) {
        userVmResponse.setDynamicallyScalable(false);
    } else {
        userVmResponse.setDynamicallyScalable(userVm.isDynamicallyScalable());
    }
    return userVmResponse;
}
Also used : User(com.cloud.user.User) HashMap(java.util.HashMap) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) ServiceOfferingDetailsVO(com.cloud.service.ServiceOfferingDetailsVO) SecurityGroupResponse(org.apache.cloudstack.api.response.SecurityGroupResponse) UserVmResponse(org.apache.cloudstack.api.response.UserVmResponse) NicSecondaryIpResponse(org.apache.cloudstack.api.response.NicSecondaryIpResponse) UserVmDetailVO(com.cloud.vm.UserVmDetailVO) NicSecondaryIpVO(com.cloud.vm.dao.NicSecondaryIpVO) AffinityGroupResponse(org.apache.cloudstack.affinity.AffinityGroupResponse) VmStats(com.cloud.vm.VmStats) NicResponse(org.apache.cloudstack.api.response.NicResponse)

Aggregations

NicResponse (org.apache.cloudstack.api.response.NicResponse)6 NicSecondaryIpVO (com.cloud.vm.dao.NicSecondaryIpVO)3 ArrayList (java.util.ArrayList)3 NicSecondaryIpResponse (org.apache.cloudstack.api.response.NicSecondaryIpResponse)3 TrafficType (com.cloud.network.Networks.TrafficType)2 AffinityGroupResponse (org.apache.cloudstack.affinity.AffinityGroupResponse)2 SecurityGroupResponse (org.apache.cloudstack.api.response.SecurityGroupResponse)2 UserVmJoinVO (com.cloud.api.query.vo.UserVmJoinVO)1 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)1 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)1 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)1 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)1 NetworkVO (com.cloud.network.dao.NetworkVO)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 ServiceOfferingDetailsVO (com.cloud.service.ServiceOfferingDetailsVO)1 User (com.cloud.user.User)1 Nic (com.cloud.vm.Nic)1 NicVO (com.cloud.vm.NicVO)1 UserVmDetailVO (com.cloud.vm.UserVmDetailVO)1 VMInstanceVO (com.cloud.vm.VMInstanceVO)1