Examples of HostProfileCounter


Examples of io.fabric8.internal.autoscale.HostProfileCounter

        FabricService fabricService = request.getFabricService();

        Container[] containers = fabricService.getContainers();
        FabricRequirements requirements = request.getFabricRequirements();
        List<? extends HostConfiguration> hostConfigurations = requirements.getSshHosts();
        HostProfileCounter hostProfileCounter = new HostProfileCounter();
        AutoScalers.createHostToProfileScaleMap(hostProfileCounter, hostConfigurations, containers);

        for (int i = 0; i < count; i++) {
            CreateSshContainerOptions.Builder builder = null;
            NameValidator nameValidator = Containers.createNameValidator(containers);
View Full Code Here

Examples of io.fabric8.internal.autoscale.HostProfileCounter

        requirements.sshHost(hostMedium).hostName(hostMedium).maximumContainerCount(2);
        requirements.sshHost(hostBig).hostName(hostBig).maximumContainerCount(8);
        requirements.profile(mqProfileId).minimumInstances(2).maximumInstancesPerHost(1).sshScaling().hostPatterns("!small");
        requirements.profile(exampleProfileId).minimumInstances(5).dependentProfiles(mqProfileId);

        HostProfileCounter hostProfileCounter = assertSshAutoScale(requirements);
        assertHostHasProfileCount(hostProfileCounter, hostSmall, exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, hostMedium, exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, hostMedium, mqProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, hostBig, mqProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, hostBig, exampleProfileId, 3);
View Full Code Here

Examples of io.fabric8.internal.autoscale.HostProfileCounter

            requirements.sshHost(box).tags("esb");
        }
        requirements.profile(mqProfileId).minimumInstances(2).sshScaling().hostTags("mq");
        requirements.profile(exampleProfileId).minimumInstances(8).dependentProfiles(mqProfileId).sshScaling().hostTags("esb");

        HostProfileCounter hostProfileCounter = assertSshAutoScale(requirements);
        for (String box : mqBoxes) {
            assertHostHasProfileCount(hostProfileCounter, box, mqProfileId, 1);
        }
        for (String box : esbBoxes) {
            assertHostHasProfileCount(hostProfileCounter, box, exampleProfileId, 2);
View Full Code Here

Examples of io.fabric8.internal.autoscale.HostProfileCounter

        for (String box : esbBoxes) {
            requirements.sshHost(box);
        }
        requirements.profile(exampleProfileId).minimumInstances(2);

        HostProfileCounter hostProfileCounter = assertSshAutoScale(requirements);
        assertHostHasProfileCount(hostProfileCounter, "esb1", exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, "esb2", exampleProfileId, 1);
        assertHostHasProfileCount(hostProfileCounter, "esb3", exampleProfileId, 0);
        assertHostHasProfileCount(hostProfileCounter, "esb4", exampleProfileId, 0);
        dumpHostProfiles(hostProfileCounter);
View Full Code Here

Examples of io.fabric8.internal.autoscale.HostProfileCounter

    public static HostProfileCounter assertSshAutoScale(FabricRequirements requirements) {
        return assertSshAutoScale(requirements, new AutoScaleStatus());
    }

    public static HostProfileCounter assertSshAutoScale(FabricRequirements requirements, AutoScaleStatus status) {
        HostProfileCounter hostProfileCounter = new HostProfileCounter();
        String version = requirements.getVersion();
        if (Strings.isEmpty(version)) {
            version = "1.0";
        }
        List<ProfileRequirements> profileRequirements = requirements.getProfileRequirements();
        for (ProfileRequirements profileRequirement : profileRequirements) {
            Integer minimumInstances = profileRequirement.getMinimumInstances();
            if (minimumInstances != null) {
                for (int i = 0; i < minimumInstances; i++) {
                    String profileId = profileRequirement.getProfile();
                    AutoScaleRequest request = new AutoScaleRequest(null, version, profileId, 1, requirements, profileRequirement, status);
                    CreateSshContainerOptions.Builder builder = chooseHostContainerOptions(request, hostProfileCounter);
                    assertNotNull("Should have found a builder for " + profileId, builder);
                    String host = builder.getHost();
                    hostProfileCounter.incrementContainers(host);
                    hostProfileCounter.incrementProfileCount(host, profileId);
                }
            }
        }
        Map<String, CountingMap> hostToProfileCounts = hostProfileCounter.getHostToProfileCounts();
        assertProfilesUseSeparateHost(requirements, hostToProfileCounts);
        assertMaximumContainerCountNotExceeded(requirements, hostToProfileCounts);
        return hostProfileCounter;
    }
View Full Code Here

Examples of io.fabric8.internal.autoscale.HostProfileCounter

        if (fabricService != null) {

            Container[] containers = fabricService.getContainers();
            FabricRequirements requirements = request.getFabricRequirements();
            List<? extends HostConfiguration> hostConfigurations = requirements.getDockerHosts();
            HostProfileCounter hostProfileCounter = new HostProfileCounter();
            AutoScalers.createHostToProfileScaleMap(hostProfileCounter, hostConfigurations, containers);


            // TODO this is actually generic to all providers! :)
            for (int i = 0; i < count; i++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.