Package brooklyn.location

Examples of brooklyn.location.HardwareDetails


        int minCores = max(strategyMinCores, contextMinCores);
        LOG.info("Provisioning strategy RAM {}, cores {}", minRam, minCores);

        List<DockerHostLocation> available = MutableList.of();
        for (DockerHostLocation location : locations) {
            HardwareDetails details = location.getMachine().getMachineDetails().getHardwareDetails();
            if (details.getCpuCount() > minCores && details.getRam() > minRam) {
                // Look up other entities already using this location and their requirements
                Iterable<Entity> entities = getBrooklynManagementContext().getEntityManager().findEntities(EntityPredicates.withLocation(location));
                int ramUsed = 0, coresUsed = 0;
                for (Entity entity : entities) {
                    Map<String,Object> entityFlags = entity.getConfig(SoftwareProcess.PROVISIONING_PROPERTIES);
                    LOG.info("Checking provisioning flags on {}: {}", entity, entityFlags);
                    if (entityFlags == null || entityFlags.isEmpty()) continue;
                    Integer entityMinRam = (Integer) entityFlags.get("minRam");
                    Integer entityMinCores = (Integer) entityFlags.get("minCores");
                    ramUsed += entityMinRam == null ? 0 : entityMinRam;
                    coresUsed += entityMinCores == null ? 0 : entityMinCores;
                }
                if ((details.getCpuCount() - coresUsed) > minCores && (details.getRam() - ramUsed) > minRam) {
                    available.add(location);
                }
            }
        }
        return available;
View Full Code Here

TOP

Related Classes of brooklyn.location.HardwareDetails

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.