1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Container: Make allocateNetwork and releaseNetwork public.

Since we are moving network allocation outside of container scope (it
will be managed by create/destroy), those functions need to be
accessible from the outside.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2014-09-29 16:52:27 -07:00
parent 103a4e0676
commit ab4188c08d

View file

@ -441,7 +441,7 @@ func (container *Container) buildHostnameAndHostsFiles(IP string) error {
return container.buildHostsFiles(IP)
}
func (container *Container) allocateNetwork() error {
func (container *Container) AllocateNetwork() error {
mode := container.hostConfig.NetworkMode
if container.Config.NetworkDisabled || !mode.IsPrivate() {
return nil
@ -514,7 +514,7 @@ func (container *Container) allocateNetwork() error {
return nil
}
func (container *Container) releaseNetwork() {
func (container *Container) ReleaseNetwork() {
if container.Config.NetworkDisabled {
return
}
@ -527,7 +527,7 @@ func (container *Container) releaseNetwork() {
// cleanup releases any network resources allocated to the container along with any rules
// around how containers are linked together. It also unmounts the container's root filesystem.
func (container *Container) cleanup() {
container.releaseNetwork()
container.ReleaseNetwork()
// Disable all active links
if container.activeLinks != nil {
@ -972,7 +972,7 @@ func (container *Container) initializeNetworking() error {
container.Config.NetworkDisabled = true
return container.buildHostnameAndHostsFiles("127.0.1.1")
}
if err := container.allocateNetwork(); err != nil {
if err := container.AllocateNetwork(); err != nil {
return err
}
return container.buildHostnameAndHostsFiles(container.NetworkSettings.IPAddress)