Package brooklyn.entity.container.docker

Examples of brooklyn.entity.container.docker.DockerHost


                    .configure(DynamicLocation.OWNER, infrastructure)
                    .configure(LocationInternal.NAMED_SPEC_NAME, locationName)
                    .displayName(displayName);
            return managementContext.getLocationManager().createLocation(locationSpec);
        } else {
            DockerHost dockerHost = (DockerHost) managementContext.getEntityManager().getEntity(dockerHostId);

            LocationSpec<DockerHostLocation> locationSpec = LocationSpec.create(DockerHostLocation.class)
                    .parent(infrastructure.getDynamicLocation())
                    .configure(flags)
                    .configure(DynamicLocation.OWNER, dockerHost)
View Full Code Here


    }

    protected List<DockerHostLocation> getDockerHostLocations() {
        List<Optional<DockerHostLocation>> result = Lists.newArrayList();
        for (Entity entity : getDockerHostList()) {
            DockerHost host = (DockerHost) entity;
            DockerHostLocation machine = host.getDynamicLocation();
            result.add(Optional.<DockerHostLocation>fromNullable(machine));
        }
        return ImmutableList.copyOf(Optional.presentInstances(result));
    }
View Full Code Here

                entityStrategies = ImmutableList.of();
            }

            // Use the docker strategy to add a new host
            DockerHostLocation machine = null;
            DockerHost dockerHost = null;
            if (available.size() > 0) {
                machine = available.get(0);
                dockerHost = machine.getOwner();
            } else {
                Iterable<DockerAwareProvisioningStrategy> provisioningStrategies = Iterables.filter(Iterables.concat(strategies,  entityStrategies), DockerAwareProvisioningStrategy.class);
                for (DockerAwareProvisioningStrategy strategy : provisioningStrategies) {
                    flags = strategy.apply((Map<String,Object>) flags);
                }

                LOG.info("Provisioning new host with flags: {}", flags);
                SshMachineLocation provisioned = getProvisioner().obtain(flags);
                Entity added = getDockerInfrastructure().getDockerHostCluster().addNode(provisioned, MutableMap.of());
                dockerHost = (DockerHost) added;
                machine = dockerHost.getDynamicLocation();
            }

            // Now wait until the host has started up
            Entities.waitForServiceUp(dockerHost);
View Full Code Here

    }

    protected void remove(DockerHostLocation machine) {
        LOG.info("Releasing {}", machine);
        DynamicCluster cluster = infrastructure.getDockerHostCluster();
        DockerHost host = machine.getOwner();
        if (cluster.removeMember(host)) {
            LOG.info("Docker Host {} released", host.getDockerHostName());
        } else {
            LOG.warn("Docker Host {} not found for release", host.getDockerHostName());
        }

        // Now close and unmange the host
        try {
            machine.close();
            host.stop();
        } catch (Exception e) {
            LOG.warn("Error stopping host: " + host, e);
            Exceptions.propagateIfFatal(e);
        } finally {
            Entities.unmanage(host);
View Full Code Here

TOP

Related Classes of brooklyn.entity.container.docker.DockerHost

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.