| ... | ... |
@@ -140,6 +140,7 @@ odk- <github@odkurzacz.org> |
| 140 | 140 |
Pascal Borreli <pascal@borreli.com> |
| 141 | 141 |
Paul Bowsher <pbowsher@globalpersonals.co.uk> |
| 142 | 142 |
Paul Hammond <paul@paulhammond.org> |
| 143 |
+Paul Nasrat <pnasrat@gmail.com> |
|
| 143 | 144 |
Phil Spitler <pspitler@gmail.com> |
| 144 | 145 |
Piotr Bogdan <ppbogdan@gmail.com> |
| 145 | 146 |
pysqz <randomq@126.com> |
| ... | ... |
@@ -1062,12 +1062,7 @@ func (container *Container) allocateNetwork() error {
|
| 1062 | 1062 |
|
| 1063 | 1063 |
var iface *NetworkInterface |
| 1064 | 1064 |
var err error |
| 1065 |
- if !container.State.Ghost {
|
|
| 1066 |
- iface, err = container.runtime.networkManager.Allocate() |
|
| 1067 |
- if err != nil {
|
|
| 1068 |
- return err |
|
| 1069 |
- } |
|
| 1070 |
- } else {
|
|
| 1065 |
+ if container.State.Ghost {
|
|
| 1071 | 1066 |
manager := container.runtime.networkManager |
| 1072 | 1067 |
if manager.disabled {
|
| 1073 | 1068 |
iface = &NetworkInterface{disabled: true}
|
| ... | ... |
@@ -1077,8 +1072,20 @@ func (container *Container) allocateNetwork() error {
|
| 1077 | 1077 |
Gateway: manager.bridgeNetwork.IP, |
| 1078 | 1078 |
manager: manager, |
| 1079 | 1079 |
} |
| 1080 |
- ipNum := ipToInt(iface.IPNet.IP) |
|
| 1081 |
- manager.ipAllocator.inUse[ipNum] = struct{}{}
|
|
| 1080 |
+ if iface !=nil && iface.IPNet.IP != nil {
|
|
| 1081 |
+ ipNum := ipToInt(iface.IPNet.IP) |
|
| 1082 |
+ manager.ipAllocator.inUse[ipNum] = struct{}{}
|
|
| 1083 |
+ } else {
|
|
| 1084 |
+ iface, err = container.runtime.networkManager.Allocate() |
|
| 1085 |
+ if err != nil {
|
|
| 1086 |
+ return err |
|
| 1087 |
+ } |
|
| 1088 |
+ } |
|
| 1089 |
+ } |
|
| 1090 |
+ } else {
|
|
| 1091 |
+ iface, err = container.runtime.networkManager.Allocate() |
|
| 1092 |
+ if err != nil {
|
|
| 1093 |
+ return err |
|
| 1082 | 1094 |
} |
| 1083 | 1095 |
} |
| 1084 | 1096 |
|
| ... | ... |
@@ -1657,11 +1657,13 @@ func TestRestartGhost(t *testing.T) {
|
| 1657 | 1657 |
runtime := mkRuntime(t) |
| 1658 | 1658 |
defer nuke(runtime) |
| 1659 | 1659 |
|
| 1660 |
- container, err := runtime.Create(&Config{
|
|
| 1661 |
- Image: GetTestImage(runtime).ID, |
|
| 1662 |
- Cmd: []string{"sh", "-c", "echo -n bar > /test/foo"},
|
|
| 1663 |
- Volumes: map[string]struct{}{"/test": {}},
|
|
| 1664 |
- }, |
|
| 1660 |
+ container, _, err := runtime.Create( |
|
| 1661 |
+ &Config{
|
|
| 1662 |
+ Image: GetTestImage(runtime).ID, |
|
| 1663 |
+ Cmd: []string{"sh", "-c", "echo -n bar > /test/foo"},
|
|
| 1664 |
+ Volumes: map[string]struct{}{"/test": {}},
|
|
| 1665 |
+ }, |
|
| 1666 |
+ "", |
|
| 1665 | 1667 |
) |
| 1666 | 1668 |
|
| 1667 | 1669 |
if err != nil {
|
| ... | ... |
@@ -1677,4 +1679,4 @@ func TestRestartGhost(t *testing.T) {
|
| 1677 | 1677 |
if err != nil {
|
| 1678 | 1678 |
t.Fatal(err) |
| 1679 | 1679 |
} |
| 1680 |
-} |
|
| 1681 | 1680 |
\ No newline at end of file |
| 1681 |
+} |