use of com.cloud.hypervisor.kvm.resource.KVMHAMonitor in project cosmic by MissionCriticalCloud.
the class LibvirtFenceCommandWrapper method execute.
@Override
public Answer execute(final FenceCommand command, final LibvirtComputingResource libvirtComputingResource) {
final ExecutorService executors = Executors.newSingleThreadExecutor();
final KvmHaMonitor monitor = libvirtComputingResource.getMonitor();
final List<NfsStoragePool> pools = monitor.getStoragePools();
/**
* We can only safely fence off hosts when we use NFS On NFS primary storage pools hosts continuesly write a
* heartbeat. Disable Fencing Off for hosts without NFS
*/
if (pools.size() == 0) {
final String logline = "No NFS storage pools found. No way to safely fence " + command.getVmName() + " on host " + command.getHostGuid();
s_logger.warn(logline);
return new FenceAnswer(command, false, logline);
}
final KvmHaChecker ha = new KvmHaChecker(pools, command.getHostIp());
final Future<Boolean> future = executors.submit(ha);
try {
final Boolean result = future.get();
if (result) {
return new FenceAnswer(command, false, "Heart is still beating...");
} else {
return new FenceAnswer(command);
}
} catch (final InterruptedException e) {
s_logger.warn("Unable to fence", e);
return new FenceAnswer(command, false, e.getMessage());
} catch (final ExecutionException e) {
s_logger.warn("Unable to fence", e);
return new FenceAnswer(command, false, e.getMessage());
}
}
use of com.cloud.hypervisor.kvm.resource.KVMHAMonitor 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<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:");
}
}
use of com.cloud.hypervisor.kvm.resource.KVMHAMonitor in project cloudstack by apache.
the class LibvirtCheckVMActivityOnStoragePoolCommandWrapper method execute.
@Override
public Answer execute(final CheckVMActivityOnStoragePoolCommand command, final LibvirtComputingResource libvirtComputingResource) {
final ExecutorService executors = Executors.newSingleThreadExecutor();
final KVMHAMonitor monitor = libvirtComputingResource.getMonitor();
final StorageFilerTO pool = command.getPool();
if (Storage.StoragePoolType.NetworkFilesystem == pool.getType()) {
final NfsStoragePool nfspool = monitor.getStoragePool(pool.getUuid());
final KVMHAVMActivityChecker ha = new KVMHAVMActivityChecker(nfspool, command.getHost().getPrivateNetwork().getIp(), command.getVolumeList(), libvirtComputingResource.getVmActivityCheckPath(), command.getSuspectTimeInSeconds());
final Future<Boolean> future = executors.submit(ha);
try {
final Boolean result = future.get();
if (result) {
return new Answer(command, false, "VMHA disk activity detected ...");
} else {
return new Answer(command);
}
} catch (InterruptedException e) {
return new Answer(command, false, "CheckVMActivityOnStoragePoolCommand: can't get status of host: InterruptedException");
} catch (ExecutionException e) {
return new Answer(command, false, "CheckVMActivityOnStoragePoolCommand: can't get status of host: ExecutionException");
}
}
return new Answer(command, false, "Unsupported Storage");
}
use of com.cloud.hypervisor.kvm.resource.KVMHAMonitor 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 beating...");
} else {
return new Answer(command);
}
} catch (final InterruptedException e) {
return new Answer(command, false, "CheckOnHostCommand: can't get status of host: InterruptedException");
} catch (final ExecutionException e) {
return new Answer(command, false, "CheckOnHostCommand: can't get status of host: ExecutionException");
}
}
use of com.cloud.hypervisor.kvm.resource.KVMHAMonitor in project cloudstack by apache.
the class LibvirtFenceCommandWrapper method execute.
@Override
public Answer execute(final FenceCommand command, final LibvirtComputingResource libvirtComputingResource) {
final ExecutorService executors = Executors.newSingleThreadExecutor();
final KVMHAMonitor monitor = libvirtComputingResource.getMonitor();
final List<NfsStoragePool> pools = monitor.getStoragePools();
/**
* We can only safely fence off hosts when we use NFS
* On NFS primary storage pools hosts continuesly write
* a heartbeat. Disable Fencing Off for hosts without NFS
*/
if (pools.size() == 0) {
String logline = "No NFS storage pools found. No way to safely fence " + command.getVmName() + " on host " + command.getHostGuid();
s_logger.warn(logline);
return new FenceAnswer(command, false, logline);
}
final KVMHAChecker ha = new KVMHAChecker(pools, command.getHostIp());
final Future<Boolean> future = executors.submit(ha);
try {
final Boolean result = future.get();
if (result) {
return new FenceAnswer(command, false, "Heart is still beating...");
} else {
return new FenceAnswer(command);
}
} catch (final InterruptedException e) {
s_logger.warn("Unable to fence", e);
return new FenceAnswer(command, false, e.getMessage());
} catch (final ExecutionException e) {
s_logger.warn("Unable to fence", e);
return new FenceAnswer(command, false, e.getMessage());
}
}
Aggregations