Search in sources :

Example 11 with CheckSshAnswer

use of com.cloud.agent.api.check.CheckSshAnswer in project cloudstack by apache.

the class CitrixCheckSshCommandWrapper method execute.

@Override
public Answer execute(final CheckSshCommand command, final CitrixResourceBase citrixResourceBase) {
    final Connection conn = citrixResourceBase.getConnection();
    final String vmName = command.getName();
    final String privateIp = command.getIp();
    final int cmdPort = command.getPort();
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Ping command port, " + privateIp + ":" + cmdPort);
    }
    try {
        final String result = citrixResourceBase.connect(conn, command.getName(), privateIp, cmdPort);
        if (result != null) {
            return new CheckSshAnswer(command, "Can not ping System vm " + vmName + "due to:" + result);
        }
    //Do not destroy the disk here! It will stio the patching process. Please, don't!
    //destroyPatchVbd(conn, vmName);
    } catch (final Exception e) {
        return new CheckSshAnswer(command, e);
    }
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Ping command port succeeded for vm " + vmName);
    }
    return new CheckSshAnswer(command);
}
Also used : CheckSshAnswer(com.cloud.agent.api.check.CheckSshAnswer) Connection(com.xensource.xenapi.Connection)

Aggregations

CheckSshAnswer (com.cloud.agent.api.check.CheckSshAnswer)11 ConfigurationException (javax.naming.ConfigurationException)5 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)4 InternalErrorException (com.cloud.exception.InternalErrorException)3 IOException (java.io.IOException)3 URISyntaxException (java.net.URISyntaxException)3 Commands (com.cloud.agent.manager.Commands)2 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)2 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)2 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)2 StorageUnavailableException (com.cloud.exception.StorageUnavailableException)2 IPAddressVO (com.cloud.network.dao.IPAddressVO)2 UnableDeleteHostException (com.cloud.resource.UnableDeleteHostException)2 ReservationContext (com.cloud.vm.ReservationContext)2 VirtualMachineProfile (com.cloud.vm.VirtualMachineProfile)2 ConnectException (java.net.ConnectException)2 RemoteException (java.rmi.RemoteException)2 Test (org.junit.Test)2 Answer (com.cloud.agent.api.Answer)1 GetDomRVersionAnswer (com.cloud.agent.api.GetDomRVersionAnswer)1