Search in sources :

Example 56 with HypervisorType

use of com.cloud.hypervisor.Hypervisor.HypervisorType in project cloudstack by apache.

the class VmwareResource method examineStorageSubSystemCommandFullCloneFlagForVmware.

/**
     * Examine StorageSubSystem command to get full clone flag, if provided
     * @param cmd command to execute
     * @param params params
     * @return copy of params including new values, if suitable
     */
protected EnumMap<VmwareStorageProcessorConfigurableFields, Object> examineStorageSubSystemCommandFullCloneFlagForVmware(CopyCommand cmd, EnumMap<VmwareStorageProcessorConfigurableFields, Object> params) {
    EnumMap<VmwareStorageProcessorConfigurableFields, Object> paramsCopy = new EnumMap<VmwareStorageProcessorConfigurableFields, Object>(params);
    HypervisorType hypervisor = cmd.getDestTO().getHypervisorType();
    if (hypervisor != null && hypervisor.equals(HypervisorType.VMware)) {
        DataStoreTO destDataStore = cmd.getDestTO().getDataStore();
        if (destDataStore instanceof PrimaryDataStoreTO) {
            PrimaryDataStoreTO dest = (PrimaryDataStoreTO) destDataStore;
            if (dest.isFullCloneFlag() != null) {
                paramsCopy.put(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG, dest.isFullCloneFlag().booleanValue());
            }
        }
    }
    return paramsCopy;
}
Also used : HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) VmwareStorageProcessorConfigurableFields(com.cloud.storage.resource.VmwareStorageProcessor.VmwareStorageProcessorConfigurableFields) EnumMap(java.util.EnumMap)

Example 57 with HypervisorType

use of com.cloud.hypervisor.Hypervisor.HypervisorType in project cloudstack by apache.

the class ConsoleProxyManagerImpl method startNew.

public ConsoleProxyVO startNew(long dataCenterId) throws ConcurrentOperationException {
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Assign console proxy from a newly started instance for request from data center : " + dataCenterId);
    }
    if (!allowToLaunchNew(dataCenterId)) {
        s_logger.warn("The number of launched console proxy on zone " + dataCenterId + " has reached to limit");
        return null;
    }
    VMTemplateVO template = null;
    HypervisorType availableHypervisor = _resourceMgr.getAvailableHypervisor(dataCenterId);
    template = _templateDao.findSystemVMReadyTemplate(dataCenterId, availableHypervisor);
    if (template == null) {
        throw new CloudRuntimeException("Not able to find the System templates or not downloaded in zone " + dataCenterId);
    }
    Map<String, Object> context = createProxyInstance(dataCenterId, template);
    long proxyVmId = (Long) context.get("proxyVmId");
    if (proxyVmId == 0) {
        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Creating proxy instance failed, data center id : " + dataCenterId);
        }
        return null;
    }
    ConsoleProxyVO proxy = _consoleProxyDao.findById(proxyVmId);
    if (proxy != null) {
        SubscriptionMgr.getInstance().notifySubscribers(ConsoleProxyManager.ALERT_SUBJECT, this, new ConsoleProxyAlertEventArgs(ConsoleProxyAlertEventArgs.PROXY_CREATED, dataCenterId, proxy.getId(), proxy, null));
        return proxy;
    } else {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Unable to allocate console proxy storage, remove the console proxy record from DB, proxy id: " + proxyVmId);
        }
    }
    return null;
}
Also used : HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VMTemplateVO(com.cloud.storage.VMTemplateVO) ConsoleProxyVO(com.cloud.vm.ConsoleProxyVO)

Aggregations

HypervisorType (com.cloud.hypervisor.Hypervisor.HypervisorType)57 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)25 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)20 ArrayList (java.util.ArrayList)19 Account (com.cloud.user.Account)15 VMTemplateVO (com.cloud.storage.VMTemplateVO)12 ClusterVO (com.cloud.dc.ClusterVO)10 HostVO (com.cloud.host.HostVO)8 UserVmVO (com.cloud.vm.UserVmVO)8 HashMap (java.util.HashMap)8 StoragePoolVO (org.apache.cloudstack.storage.datastore.db.StoragePoolVO)8 DataCenterVO (com.cloud.dc.DataCenterVO)7 PermissionDeniedException (com.cloud.exception.PermissionDeniedException)7 DataStore (org.apache.cloudstack.engine.subsystem.api.storage.DataStore)7 Answer (com.cloud.agent.api.Answer)6 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)6 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)6 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)6 ServiceOfferingVO (com.cloud.service.ServiceOfferingVO)6 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)5