Search in sources :

Example 1 with FeatureNameType

use of org.voltdb.compiler.deploymentfile.FeatureNameType in project voltdb by VoltDB.

the class VoltProjectBuilder method setupDiskLimitType.

private void setupDiskLimitType(SystemSettingsType systemSettingsType, org.voltdb.compiler.deploymentfile.ObjectFactory factory) {
    Set<FeatureNameType> featureNames = new HashSet<>();
    if (m_featureDiskLimits != null && !m_featureDiskLimits.isEmpty()) {
        featureNames.addAll(m_featureDiskLimits.keySet());
    }
    if (m_snmpFeatureDiskLimits != null && !m_snmpFeatureDiskLimits.isEmpty()) {
        featureNames.addAll(m_snmpFeatureDiskLimits.keySet());
    }
    if (featureNames.isEmpty()) {
        return;
    }
    DiskLimitType diskLimit = factory.createDiskLimitType();
    for (FeatureNameType featureName : featureNames) {
        DiskLimitType.Feature feature = factory.createDiskLimitTypeFeature();
        feature.setName(featureName);
        if (m_featureDiskLimits != null && m_featureDiskLimits.containsKey(featureName)) {
            feature.setSize(m_featureDiskLimits.get(featureName));
        }
        if (m_snmpFeatureDiskLimits != null && m_snmpFeatureDiskLimits.containsKey(featureName)) {
            feature.setAlert(m_snmpFeatureDiskLimits.get(featureName));
        }
        diskLimit.getFeature().add(feature);
    }
    ResourceMonitorType monitorType = initializeResourceMonitorType(systemSettingsType, factory);
    monitorType.setDisklimit(diskLimit);
}
Also used : FeatureNameType(org.voltdb.compiler.deploymentfile.FeatureNameType) ResourceMonitorType(org.voltdb.compiler.deploymentfile.ResourceMonitorType) DiskLimitType(org.voltdb.compiler.deploymentfile.DiskLimitType) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with FeatureNameType

use of org.voltdb.compiler.deploymentfile.FeatureNameType in project voltdb by VoltDB.

the class DiskResourceChecker method findDiskLimitConfiguration.

private void findDiskLimitConfiguration(DiskLimitType diskLimit) {
    // By now we know that resource monitor is not null
    DiskLimitType diskLimitConfig = diskLimit;
    if (diskLimitConfig == null) {
        return;
    }
    List<DiskLimitType.Feature> features = diskLimitConfig.getFeature();
    if (features == null || features.isEmpty()) {
        return;
    }
    ImmutableMap.Builder<FeatureNameType, FeatureDiskLimitConfig> builder = new ImmutableMap.Builder<>();
    EnumSet<FeatureNameType> configuredFeatures = EnumSet.noneOf(FeatureNameType.class);
    if (features != null && !features.isEmpty()) {
        for (DiskLimitType.Feature feature : features) {
            configuredFeatures.add(feature.getName());
            if (!isSupportedFeature(feature.getName())) {
                m_logger.warn("Ignoring unsupported feature " + feature.getName());
                continue;
            }
            String size = feature.getSize();
            String snmpSize = feature.getAlert();
            FeatureDiskLimitConfig aConfig = new FeatureDiskLimitConfig(feature.getName(), size, snmpSize);
            builder.put(feature.getName(), aConfig);
            if (m_logger.isDebugEnabled()) {
                m_logger.debug("Added disk usage limit configuration " + (size == null ? "no limit " : size) + "snmp alert configuration " + (snmpSize == null ? "no limit " : snmpSize) + " for feature " + feature.getName());
            }
        }
    }
    m_configuredLimits = builder.build();
}
Also used : FeatureNameType(org.voltdb.compiler.deploymentfile.FeatureNameType) DiskLimitType(org.voltdb.compiler.deploymentfile.DiskLimitType) ImmutableMap(com.google_voltpatches.common.collect.ImmutableMap)

Aggregations

DiskLimitType (org.voltdb.compiler.deploymentfile.DiskLimitType)2 FeatureNameType (org.voltdb.compiler.deploymentfile.FeatureNameType)2 ImmutableMap (com.google_voltpatches.common.collect.ImmutableMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 ResourceMonitorType (org.voltdb.compiler.deploymentfile.ResourceMonitorType)1