当前位置: 首页>>代码示例>>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;未经允许,请勿转载。