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
Родитель 103a4e0676
Коммит ab4188c08d
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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)