當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceOffering類代碼示例

本文整理匯總了Java中com.cloud.offering.ServiceOffering的典型用法代碼示例。如果您正苦於以下問題:Java ServiceOffering類的具體用法?Java ServiceOffering怎麽用?Java ServiceOffering使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ServiceOffering類屬於com.cloud.offering包,在下文中一共展示了ServiceOffering類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() throws ResourceAllocationException {
    CallContext.current().setEventDetails("Vm Id: " + getId());

    final ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    if (serviceOffering == null) {
        throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
    }

    final UserVm result = _userVmService.upgradeVirtualMachine(this);
    if (result != null) {
        final UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:19,代碼來源:UpgradeVMCmdByAdmin.java

示例2: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() {
    CallContext.current().setEventDetails("Vm Id: " + getId());

    final ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    if (serviceOffering == null) {
        throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
    }

    final VirtualMachine result = _mgr.upgradeSystemVM(this);
    if (result != null) {
        final SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:19,代碼來源:UpgradeSystemVMCmd.java

示例3: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() throws ResourceAllocationException {
    CallContext.current().setEventDetails("Vm Id: " + getId());

    final ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    if (serviceOffering == null) {
        throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
    }

    final UserVm result = _userVmService.upgradeVirtualMachine(this);

    if (result != null) {
        final UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:20,代碼來源:UpgradeVMCmd.java

示例4: createVpcOfferingResponse

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public VpcOfferingResponse createVpcOfferingResponse(final VpcOffering offering) {
    final VpcOfferingResponse response = new VpcOfferingResponse();
    response.setId(offering.getUuid());
    response.setName(offering.getName());
    response.setDisplayText(offering.getDisplayText());
    response.setIsDefault(offering.isDefault());
    response.setState(offering.getState().name());
    final ServiceOffering serviceOffering = _serviceOfferingDao.findById(offering.getServiceOfferingId());
    if (serviceOffering != null) {
        response.setServiceOfferingId(serviceOffering.getUuid());
        response.setServiceOfferingName(serviceOffering.getName());
    }
    final ServiceOffering secondaryServiceOffering = _serviceOfferingDao.findById(offering.getSecondaryServiceOfferingId());
    if (secondaryServiceOffering != null) {
        response.setSecondaryServiceOfferingId(secondaryServiceOffering.getUuid());
        response.setSecondaryServiceOfferingName(secondaryServiceOffering.getName());
    }
    final Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(offering.getId());
    final List<ServiceResponse> serviceResponses = getServiceResponses(serviceProviderMap);

    response.setServices(serviceResponses);
    response.setObjectName("vpcoffering");
    return response;
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:26,代碼來源:ApiResponseHelper.java

示例5: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() throws ResourceAllocationException{
    CallContext.current().setEventDetails("Vm Id: "+getId());

    ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    if (serviceOffering == null) {
        throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
    }

    UserVm result = _userVmService.upgradeVirtualMachine(this);
    if (result != null){
        UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
    }
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:19,代碼來源:UpgradeVMCmdByAdmin.java

示例6: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() {
    CallContext.current().setEventDetails("Vm Id: " + getId());

    ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    if (serviceOffering == null) {
        throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
    }

    VirtualMachine result = _mgr.upgradeSystemVM(this);
    if (result != null) {
        SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
    }
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:19,代碼來源:UpgradeSystemVMCmd.java

示例7: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() throws ResourceAllocationException {
    CallContext.current().setEventDetails("Vm Id: " + getId());

    ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    if (serviceOffering == null) {
        throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
    }

    UserVm result = _userVmService.upgradeVirtualMachine(this);

    if (result != null){
        UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
    }
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:20,代碼來源:UpgradeVMCmd.java

示例8: canHandle

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) {
    // check what the ServiceOffering says. If null, check the global config
    ServiceOffering offering = vm.getServiceOffering();
    if (vm.getHypervisorType() != HypervisorType.BareMetal) {
        if (offering != null && offering.getDeploymentPlanner() != null) {
            if (offering.getDeploymentPlanner().equals(getName())) {
                return true;
            }
        } else {
            if (globalDeploymentPlanner != null && globalDeploymentPlanner.equals(_name)) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:18,代碼來源:FirstFitPlanner.java

示例9: getDiskWithThrottling

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public DiskTO getDiskWithThrottling(final DataTO volTO, final Volume.Type volumeType, final long deviceId, final String path, final long offeringId, final long diskOfferingId) {
    DiskTO disk = null;
    if (volTO != null && volTO instanceof VolumeObjectTO) {
        VolumeObjectTO volumeTO = (VolumeObjectTO) volTO;
        ServiceOffering offering = _entityMgr.findById(ServiceOffering.class, offeringId);
        DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, diskOfferingId);
        if (volumeType == Volume.Type.ROOT) {
            setVolumeObjectTOThrottling(volumeTO, offering, diskOffering);
        } else {
            setVolumeObjectTOThrottling(volumeTO, null, diskOffering);
        }
        disk = new DiskTO(volumeTO, deviceId, path, volumeType);
    } else {
        disk = new DiskTO(volTO, deviceId, path, volumeType);
    }
    return disk;
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:19,代碼來源:StorageManagerImpl.java

示例10: ServiceInstanceModel

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
/**
 * Create a ServiceInstance as result of an API call.
 *
 * @param owner
 * @param name
 * @param template
 * @param serviceOffering
 * @param left
 * @param right
 */
public ServiceInstanceModel(Project project, String name, VirtualMachineTemplate template, ServiceOffering serviceOffering, VirtualNetworkModel left, VirtualNetworkModel right) {
    String parent_name;
    if (project != null) {
        parent_name = StringUtils.join(project.getQualifiedName(), ':');

        _projectId = project.getUuid();
    } else {
        parent_name = ContrailManager.VNC_ROOT_DOMAIN + ":" + ContrailManager.VNC_DEFAULT_PROJECT;

        //In the original code, if the projectId is null, it will simply throw NPE on the last line (nr. 90) of the method where the projectId.getUuid() is called.
        //This was added as a way to avoid NPE. Should we perhaps throw a CloudRuntimeException if the project object is null?
        _projectId = UUID.randomUUID().toString();
    }
    _fqName = parent_name + ":" + name;

    _mgmtName = ContrailManager.VNC_ROOT_DOMAIN + ":" + ContrailManager.VNC_DEFAULT_PROJECT + ":" + ContrailManager.managementNetworkName;
    _left = left;
    _right = right;
    _leftName = StringUtils.join(left.getVirtualNetwork().getQualifiedName(), ":");
    _rightName = StringUtils.join(right.getVirtualNetwork().getQualifiedName(), ":");

    _templateName = template.getName();
    _templateId = template.getUuid();
    _templateUrl = template.getUrl();
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:36,代碼來源:ServiceInstanceModel.java

示例11: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() {
    final ServiceOffering result = _configService.createServiceOffering(this);
    if (result != null) {
        final ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering");
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:12,代碼來源:CreateServiceOfferingCmd.java

示例12: execute

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public void execute() {
    //Note
    //Once an offering is created, we cannot update the domainId field (keeping consistent with zones logic)
    final ServiceOffering result = _configService.updateServiceOffering(this);
    if (result != null) {
        final ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service offering");
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:14,代碼來源:UpdateServiceOfferingCmd.java

示例13: isVirtualMachineUpgradable

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering) {
    boolean isMachineUpgradable = true;
    for (final HostAllocator allocator : hostAllocators) {
        isMachineUpgradable = allocator.isVirtualMachineUpgradable(vm, offering);
        if (isMachineUpgradable) {
            continue;
        } else {
            break;
        }
    }

    return isMachineUpgradable;
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:15,代碼來源:VirtualMachineManagerImpl.java

示例14: upgradeVmDb

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
@Override
public boolean upgradeVmDb(final long vmId, final long serviceOfferingId) {
    final VMInstanceVO vmForUpdate = _vmDao.createForUpdate();
    vmForUpdate.setServiceOfferingId(serviceOfferingId);
    final ServiceOffering newSvcOff = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
    vmForUpdate.setHaEnabled(newSvcOff.getOfferHA());
    vmForUpdate.setLimitCpuUse(newSvcOff.getLimitCpuUse());
    vmForUpdate.setServiceOfferingId(newSvcOff.getId());
    return _vmDao.update(vmId, vmForUpdate);
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:11,代碼來源:VirtualMachineManagerImpl.java

示例15: findPod

import com.cloud.offering.ServiceOffering; //導入依賴的package包/類
public Pair<Pod, Long> findPod(final VirtualMachineTemplate template, final ServiceOffering offering, final DataCenter dc, final long accountId, final Set<Long> avoids) {
    for (final PodAllocator allocator : _podAllocators) {
        final Pair<Pod, Long> pod = allocator.allocateTo(template, offering, dc, accountId, avoids);
        if (pod != null) {
            return pod;
        }
    }
    return null;
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:10,代碼來源:VolumeOrchestrator.java


注:本文中的com.cloud.offering.ServiceOffering類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。