use of com.cloud.agent.api.to.NetworkTO in project cloudstack by apache.
the class LibvirtCheckOnHostCommandWrapper method execute.
@Override
public Answer execute(final CheckOnHostCommand command, final LibvirtComputingResource libvirtComputingResource) {
final ExecutorService executors = Executors.newSingleThreadExecutor();
final KVMHAMonitor monitor = libvirtComputingResource.getMonitor();
final List<NfsStoragePool> pools = monitor.getStoragePools();
final HostTO host = command.getHost();
final NetworkTO privateNetwork = host.getPrivateNetwork();
final KVMHAChecker ha = new KVMHAChecker(pools, privateNetwork.getIp());
final Future<Boolean> future = executors.submit(ha);
try {
final Boolean result = future.get();
if (result) {
return new Answer(command, false, "Heart is still beating...");
} else {
return new Answer(command);
}
} catch (final InterruptedException e) {
return new Answer(command, false, "can't get status of host:");
} catch (final ExecutionException e) {
return new Answer(command, false, "can't get status of host:");
}
}
Aggregations