use of com.cloud.legacymodel.to.HostTO in project cosmic by MissionCriticalCloud.
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<KvmHaBase.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