parent
4cbb6ce13b
commit
95708dd35c
3 changed files with 24 additions and 14 deletions
1
AUTHORS
1
AUTHORS
|
@ -140,6 +140,7 @@ odk- <github@odkurzacz.org>
|
||||||
Pascal Borreli <pascal@borreli.com>
|
Pascal Borreli <pascal@borreli.com>
|
||||||
Paul Bowsher <pbowsher@globalpersonals.co.uk>
|
Paul Bowsher <pbowsher@globalpersonals.co.uk>
|
||||||
Paul Hammond <paul@paulhammond.org>
|
Paul Hammond <paul@paulhammond.org>
|
||||||
|
Paul Nasrat <pnasrat@gmail.com>
|
||||||
Phil Spitler <pspitler@gmail.com>
|
Phil Spitler <pspitler@gmail.com>
|
||||||
Piotr Bogdan <ppbogdan@gmail.com>
|
Piotr Bogdan <ppbogdan@gmail.com>
|
||||||
pysqz <randomq@126.com>
|
pysqz <randomq@126.com>
|
||||||
|
|
19
container.go
19
container.go
|
@ -1062,12 +1062,7 @@ func (container *Container) allocateNetwork() error {
|
||||||
|
|
||||||
var iface *NetworkInterface
|
var iface *NetworkInterface
|
||||||
var err error
|
var err error
|
||||||
if !container.State.Ghost {
|
if container.State.Ghost {
|
||||||
iface, err = container.runtime.networkManager.Allocate()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
manager := container.runtime.networkManager
|
manager := container.runtime.networkManager
|
||||||
if manager.disabled {
|
if manager.disabled {
|
||||||
iface = &NetworkInterface{disabled: true}
|
iface = &NetworkInterface{disabled: true}
|
||||||
|
@ -1077,8 +1072,20 @@ func (container *Container) allocateNetwork() error {
|
||||||
Gateway: manager.bridgeNetwork.IP,
|
Gateway: manager.bridgeNetwork.IP,
|
||||||
manager: manager,
|
manager: manager,
|
||||||
}
|
}
|
||||||
|
if iface !=nil && iface.IPNet.IP != nil {
|
||||||
ipNum := ipToInt(iface.IPNet.IP)
|
ipNum := ipToInt(iface.IPNet.IP)
|
||||||
manager.ipAllocator.inUse[ipNum] = struct{}{}
|
manager.ipAllocator.inUse[ipNum] = struct{}{}
|
||||||
|
} else {
|
||||||
|
iface, err = container.runtime.networkManager.Allocate()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
iface, err = container.runtime.networkManager.Allocate()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1657,11 +1657,13 @@ func TestRestartGhost(t *testing.T) {
|
||||||
runtime := mkRuntime(t)
|
runtime := mkRuntime(t)
|
||||||
defer nuke(runtime)
|
defer nuke(runtime)
|
||||||
|
|
||||||
container, err := runtime.Create(&Config{
|
container, _, err := runtime.Create(
|
||||||
|
&Config{
|
||||||
Image: GetTestImage(runtime).ID,
|
Image: GetTestImage(runtime).ID,
|
||||||
Cmd: []string{"sh", "-c", "echo -n bar > /test/foo"},
|
Cmd: []string{"sh", "-c", "echo -n bar > /test/foo"},
|
||||||
Volumes: map[string]struct{}{"/test": {}},
|
Volumes: map[string]struct{}{"/test": {}},
|
||||||
},
|
},
|
||||||
|
"",
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue