Search in sources :

Example 61 with VDS

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());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Test(org.junit.Test)

Example 62 with VDS

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);
}
Also used : Arrays(java.util.Arrays) Logger(org.slf4j.Logger) AuditLogDirector(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector) MessageDigest(java.security.MessageDigest) Guid(org.ovirt.engine.core.compat.Guid) JsonHelper(org.ovirt.engine.core.utils.JsonHelper) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) Collectors(java.util.stream.Collectors) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Inject(javax.inject.Inject) List(java.util.List) TreeMap(java.util.TreeMap) Map(java.util.Map) AuditLogType(org.ovirt.engine.core.common.AuditLogType) VDS(org.ovirt.engine.core.common.businessentities.VDS) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) TreeMap(java.util.TreeMap) List(java.util.List) MessageDigest(java.security.MessageDigest) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 63 with 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);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) List(java.util.List) HashSet(java.util.HashSet)

Example 64 with VDS

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;
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 65 with VDS

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);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) VdsPowerDownParameters(org.ovirt.engine.core.common.action.VdsPowerDownParameters)

Aggregations

VDS (org.ovirt.engine.core.common.businessentities.VDS)578 ArrayList (java.util.ArrayList)160 Test (org.junit.Test)138 Guid (org.ovirt.engine.core.compat.Guid)132 List (java.util.List)78 VM (org.ovirt.engine.core.common.businessentities.VM)65 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)55 HashMap (java.util.HashMap)53 HashSet (java.util.HashSet)48 Map (java.util.Map)45 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)42 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)42 Set (java.util.Set)40 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)39 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)39 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)38 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)38 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)37 Frontend (org.ovirt.engine.ui.frontend.Frontend)35