Search in sources :

Example 1 with StartupCommand

use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.

the class ConsoleProxyResource method initialize.

@Override
public synchronized StartupCommand[] initialize() {
    final StartupProxyCommand cmd = new StartupProxyCommand();
    fillNetworkInformation(cmd);
    cmd.setProxyPort(this._proxyPort);
    cmd.setProxyVmId(this._proxyVmId);
    cmd.setVersion(ConsoleProxyResource.class.getPackage().getImplementationVersion());
    if (this._pubIp != null) {
        cmd.setPublicIpAddress(this._pubIp);
    }
    return new StartupCommand[] { cmd };
}
Also used : StartupProxyCommand(com.cloud.legacymodel.communication.command.startup.StartupProxyCommand) StartupCommand(com.cloud.legacymodel.communication.command.startup.StartupCommand)

Example 2 with StartupCommand

use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.

the class NfsSecondaryStorageResource method initialize.

@Override
public StartupCommand[] initialize() {
    final StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand();
    fillNetworkInformation(cmd);
    cmd.setVersion(NfsSecondaryStorageResource.class.getPackage().getImplementationVersion());
    if (this._publicIp != null) {
        cmd.setPublicIpAddress(this._publicIp);
    }
    if (this._inSystemVM) {
        final Script command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("ln -sf " + this._parent + " /var/www/html/copy");
        final String result = command.execute();
        if (result != null) {
            s_logger.warn("Error in linking  err=" + result);
            return null;
        }
    }
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.legacymodel.communication.command.startup.StartupCommand) Script(com.cloud.utils.script.Script) StartupSecondaryStorageCommand(com.cloud.legacymodel.communication.command.startup.StartupSecondaryStorageCommand)

Example 3 with StartupCommand

use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.

the class StorageCapacityListener method processConnect.

@Override
public void processConnect(final Host server, final StartupCommand[] startupCommands, final boolean forRebalance) {
    for (final StartupCommand startupCommand : startupCommands) {
        if (!(startupCommand instanceof StartupStorageCommand)) {
            return;
        }
        final StartupStorageCommand ssCmd = (StartupStorageCommand) startupCommand;
        if (ssCmd.getResourceType() == StorageResourceType.STORAGE_HOST) {
            final BigDecimal overProvFactor = BigDecimal.valueOf(CapacityManager.StorageOverprovisioningFactor.value());
            final CapacityVO capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), server.getClusterId(), 0L, (overProvFactor.multiply(new BigDecimal(server.getTotalSize()))).longValue(), Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED);
            _capacityDao.persist(capacity);
        }
    }
}
Also used : StartupCommand(com.cloud.legacymodel.communication.command.startup.StartupCommand) StartupStorageCommand(com.cloud.legacymodel.communication.command.startup.StartupStorageCommand) BigDecimal(java.math.BigDecimal)

Example 4 with StartupCommand

use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.

the class KvmDummyResourceBase method initialize.

@Override
public StartupCommand[] initialize() {
    final StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, null, HypervisorType.KVM, new HashMap<>());
    cmd.setDataCenter(this._zoneId);
    cmd.setPod(this._podId);
    cmd.setCluster(this._clusterId);
    cmd.setGuid(this._guid);
    cmd.setName(this._agentIp);
    cmd.setPrivateIpAddress(this._agentIp);
    cmd.setStorageIpAddress(this._agentIp);
    cmd.setVersion(KvmDummyResourceBase.class.getPackage().getImplementationVersion());
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.legacymodel.communication.command.startup.StartupCommand) StartupRoutingCommand(com.cloud.legacymodel.communication.command.startup.StartupRoutingCommand)

Example 5 with StartupCommand

use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.

the class LibvirtServerDiscoverer method createHostVOForConnectedAgent.

@Override
public HostVO createHostVOForConnectedAgent(final HostVO host, final StartupCommand[] cmd) {
    final StartupCommand firstCmd = cmd[0];
    if (!(firstCmd instanceof StartupRoutingCommand)) {
        return null;
    }
    final StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
    if (ssCmd.getHypervisorType() != getHypervisorType()) {
        return null;
    }
    /* KVM requires host are the same in cluster */
    final ClusterVO clusterVO = this._clusterDao.findById(host.getClusterId());
    if (clusterVO == null) {
        s_logger.debug("cannot find cluster: " + host.getClusterId());
        throw new IllegalArgumentException("cannot add host, due to can't find cluster: " + host.getClusterId());
    }
    this._hostDao.loadDetails(host);
    return this._resourceMgr.fillRoutingHostVO(host, ssCmd, getHypervisorType(), host.getDetails(), null);
}
Also used : StartupCommand(com.cloud.legacymodel.communication.command.startup.StartupCommand) ClusterVO(com.cloud.dc.ClusterVO) StartupRoutingCommand(com.cloud.legacymodel.communication.command.startup.StartupRoutingCommand)

Aggregations

StartupCommand (com.cloud.legacymodel.communication.command.startup.StartupCommand)27 StartupRoutingCommand (com.cloud.legacymodel.communication.command.startup.StartupRoutingCommand)14 AgentUnavailableException (com.cloud.legacymodel.exceptions.AgentUnavailableException)6 CloudRuntimeException (com.cloud.legacymodel.exceptions.CloudRuntimeException)6 StartupStorageCommand (com.cloud.legacymodel.communication.command.startup.StartupStorageCommand)5 HostVO (com.cloud.host.HostVO)4 StartupSecondaryStorageCommand (com.cloud.legacymodel.communication.command.startup.StartupSecondaryStorageCommand)4 Request (com.cloud.common.transport.Request)3 ClusterVO (com.cloud.dc.ClusterVO)3 ConnectionException (com.cloud.legacymodel.exceptions.ConnectionException)3 DiscoveryException (com.cloud.legacymodel.exceptions.DiscoveryException)3 InvalidParameterValueException (com.cloud.legacymodel.exceptions.InvalidParameterValueException)3 NoTransitionException (com.cloud.legacymodel.exceptions.NoTransitionException)3 ResourceInUseException (com.cloud.legacymodel.exceptions.ResourceInUseException)3 UnableDeleteHostException (com.cloud.legacymodel.exceptions.UnableDeleteHostException)3 StoragePoolHostVO (com.cloud.storage.StoragePoolHostVO)3 SshException (com.cloud.utils.ssh.SshException)3 URISyntaxException (java.net.URISyntaxException)3 ConfigurationException (javax.naming.ConfigurationException)3 Commands (com.cloud.agent.manager.Commands)2