Search in sources :

Example 6 with CheckSshCommand

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

the class ConsoleProxyManagerImpl method finalizeCommandsOnStart.

@Override
public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachineProfile profile) {
    NicProfile managementNic = null;
    NicProfile controlNic = null;
    for (final NicProfile nic : profile.getNics()) {
        if (nic.getTrafficType() == TrafficType.Management) {
            managementNic = nic;
        } else if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) {
            controlNic = nic;
        }
    }
    if (controlNic == null) {
        if (managementNic == null) {
            logger.error("Management network doesn't exist for the console proxy vm " + profile.getVirtualMachine());
            return false;
        }
        controlNic = managementNic;
    }
    final CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922);
    cmds.addCommand("checkSsh", check);
    return true;
}
Also used : CheckSshCommand(com.cloud.legacymodel.communication.command.CheckSshCommand) NicProfile(com.cloud.vm.NicProfile)

Aggregations

CheckSshCommand (com.cloud.legacymodel.communication.command.CheckSshCommand)6 Answer (com.cloud.legacymodel.communication.answer.Answer)3 AttachAnswer (com.cloud.legacymodel.communication.answer.AttachAnswer)3 Test (org.junit.Test)3 LibvirtRequestWrapper (com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper)2 VirtualRoutingResource (com.cloud.common.virtualnetwork.VirtualRoutingResource)2 CheckRouterAnswer (com.cloud.legacymodel.communication.answer.CheckRouterAnswer)2 NicProfile (com.cloud.vm.NicProfile)2 CreateAnswer (com.cloud.legacymodel.communication.answer.CreateAnswer)1 RebootAnswer (com.cloud.legacymodel.communication.answer.RebootAnswer)1 GetDomRVersionCommand (com.cloud.legacymodel.communication.command.GetDomRVersionCommand)1 NetworkUsageCommand (com.cloud.legacymodel.communication.command.NetworkUsageCommand)1 DomainRouterVO (com.cloud.vm.DomainRouterVO)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1