use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class VirtMonitoringStrategyTest method testProtectRhel6InRhel7.
@Test
public void testProtectRhel6InRhel7() {
VDS vds = createBaseVds();
vdsFromDb.setHostOs("RHEL - 7Server - 1.el7");
vds.setHostOs("RHEL - 6Server - 6.5.0.1.el6");
virtStrategy.processSoftwareCapabilities(vds);
assertEquals(VDSStatus.NonOperational, vds.getStatus());
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class MultipathHealthHandler method handleMultipathHealthReport.
public void handleMultipathHealthReport(VDS vds, Map<String, Object> statsMap) {
if (!statsMap.containsKey(VdsProperties.MULTIPATH_HEALTH)) {
return;
}
Map<String, Object> multipathHealthMap = (Map<String, Object>) statsMap.get(VdsProperties.MULTIPATH_HEALTH);
// The following mechanism avoids to have the same events generated
// when there was no changes in the health report.
// Note that the EventFloodRegulator is solving the problem of not
// emitting the same event reoccuring in the time frame of AuditLogTimeInterval.
// In this case, using the EventFloodRegulator would filter events that are needed.
// For example, having an event of NO_FAULTY_MULTIPATHS_ON_HOST, then
// an event of FAULTY_MULTIPATHS_ON_HOST, and again NO_FAULTY_MULTIPATHS_ON_HOST.
// The last event would have been filtered out.
byte[] hash;
String json;
try {
json = JsonHelper.mapToJson(new TreeMap<>(multipathHealthMap));
MessageDigest digest = MessageDigest.getInstance("SHA1");
digest.update(json.getBytes("UTF-8"));
hash = digest.digest();
} catch (Exception e) {
log.error("failed building multipath events: {}", e.getMessage());
log.debug("Exception", e);
return;
}
byte[] previousHash = multipathHealthHash.get(vds.getId());
if (Arrays.equals(hash, previousHash)) {
// No changes in the report
return;
}
multipathHealthHash.put(vds.getId(), hash);
log.debug("Multipath health report for host {}: {}", vds.getName(), json);
if (multipathHealthMap.isEmpty()) {
AuditLogable logable = createAuditLogableForHost(vds);
auditLogDirector.log(logable, AuditLogType.NO_FAULTY_MULTIPATHS_ON_HOST);
return;
}
Map<Boolean, List<String>> multipathHealthMapPartition = multipathHealthMap.entrySet().stream().collect(Collectors.partitioningBy(entry -> {
Map<String, Object> internalValue = (Map<String, Object>) entry.getValue();
return (Integer) internalValue.get(VdsProperties.MULTIPATH_VALID_PATHS) > 0;
}, Collectors.mapping(Map.Entry::getKey, Collectors.toList())));
createAuditLog(multipathHealthMapPartition.get(Boolean.FALSE), AuditLogType.MULTIPATH_DEVICES_WITHOUT_VALID_PATHS_ON_HOST, vds);
createAuditLog(multipathHealthMapPartition.get(Boolean.TRUE), AuditLogType.FAULTY_MULTIPATHS_ON_HOST, vds);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class AsyncDataProvider method getEmulatedMachinesByClusterID.
public void getEmulatedMachinesByClusterID(AsyncQuery<Set<String>> aQuery, Guid clusterId) {
aQuery.converterCallback = source -> {
if (source != null) {
List<VDS> vdsList = (List<VDS>) source;
Set<String> emulatedMachineList = new HashSet<>();
for (VDS host : vdsList) {
String hostSupportedMachines = host.getSupportedEmulatedMachines();
if (!StringHelper.isNullOrEmpty(hostSupportedMachines)) {
// $NON-NLS-1$
emulatedMachineList.addAll(Arrays.asList(hostSupportedMachines.split(",")));
}
}
return emulatedMachineList;
}
return null;
};
Frontend.getInstance().runQuery(QueryType.GetHostsByClusterId, new IdQueryParameters(clusterId), aQuery);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class Cloner method cloneVDS.
private static Object cloneVDS(VDS instance) {
VDS obj = new VDS();
obj.setHostName(instance.getHostName());
obj.setSshKeyFingerprint(instance.getSshKeyFingerprint());
obj.setSshPort(instance.getSshPort());
obj.setSshUsername(instance.getSshUsername());
obj.setFenceAgents(cloneAgents(instance.getFenceAgents()));
obj.setDisablePowerManagementPolicy(instance.isDisablePowerManagementPolicy());
obj.setPmKdumpDetection(instance.isPmKdumpDetection());
obj.setPort(instance.getPort());
obj.setServerSslEnabled(instance.isServerSslEnabled());
obj.setClusterId(instance.getClusterId());
obj.setId(instance.getId());
obj.setVdsName(instance.getName());
obj.setVdsStrength(instance.getVdsStrength());
obj.setVdsType(instance.getVdsType());
obj.setUniqueId(instance.getUniqueId());
obj.setVdsSpmPriority(instance.getVdsSpmPriority());
obj.setCurrentKernelCmdline(instance.getCurrentKernelCmdline());
obj.setKernelCmdlineParsable(instance.isKernelCmdlineParsable());
obj.setLastStoredKernelCmdline(instance.getLastStoredKernelCmdline());
obj.setKernelCmdlineBlacklistNouveau(instance.isKernelCmdlineBlacklistNouveau());
obj.setKernelCmdlineIommu(instance.isKernelCmdlineIommu());
obj.setKernelCmdlineKvmNested(instance.isKernelCmdlineKvmNested());
obj.setKernelCmdlinePciRealloc(instance.isKernelCmdlinePciRealloc());
obj.setKernelCmdlineUnsafeInterrupts(instance.isKernelCmdlineUnsafeInterrupts());
return obj;
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method onSshStop.
public void onSshStop() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
VdsPowerDownParameters param = new VdsPowerDownParameters(vds.getId());
param.setFallbackToPowerManagement(false);
param.setKeepPolicyPMEnabled(true);
list.add(param);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.VdsPowerDown, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancelConfirm();
}, model);
}
Aggregations