Implement requesting the name ip

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby
2014-01-31 12:04:44 -08:00
parent 49b9813035
commit 2df0166107
2 changed files with 27 additions and 22 deletions
+11 -2
View File
@@ -304,9 +304,18 @@ func createBridgeIface(name string) error {
// Allocate a network interface
func Allocate(job *engine.Job) engine.Status {
id := job.Args[0]
var (
ip *net.IP
err error
id = job.Args[0]
requestedIP = net.ParseIP(job.Getenv("RequestedIP"))
)
ip, err := ipallocator.RequestIP(bridgeNetwork, nil)
if requestedIP != nil {
ip, err = ipallocator.RequestIP(bridgeNetwork, &requestedIP)
} else {
ip, err = ipallocator.RequestIP(bridgeNetwork, nil)
}
if err != nil {
job.Error(err)
return engine.StatusErr