mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Added kernel version checks for macvlan/ipvlan
ipvlan >= 4.0.0 due to early instability macvlan >= 3.9 Signed-off-by: Brent Salisbury <brent@docker.com>
This commit is contained in:
parent
469ea4eb3f
commit
af75e8a624
4 changed files with 25 additions and 3 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/libnetwork/driverapi"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
|
@ -13,6 +14,15 @@ import (
|
|||
|
||||
// CreateNetwork the network for the specified driver type
|
||||
func (d *driver) CreateNetwork(nid string, option map[string]interface{}, ipV4Data, ipV6Data []driverapi.IPAMData) error {
|
||||
kv, err := kernel.GetKernelVersion()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to check kernel version for %s driver support: %v", ipvlanType, err)
|
||||
}
|
||||
// ensure Kernel version is greater then v4.0 for ipvlan support
|
||||
if kv.Kernel < ipvlanKernelVer {
|
||||
return fmt.Errorf("kernel version failed to meet the minimum ipvlan kernel requirement of %d.%d, found %d.%d.%d",
|
||||
ipvlanKernelVer, ipvlanMajorVer, kv.Kernel, kv.Major, kv.Minor)
|
||||
}
|
||||
// parse and validate the config and bind to networkConfiguration
|
||||
config, err := parseNetworkOptions(nid, option)
|
||||
if err != nil {
|
||||
|
|
|
@ -14,8 +14,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
dummyPrefix = "di-" // ipvlan prefix for dummy parent interface
|
||||
ipvlanKernelVer = "3.19" // minimum ipvlan kernel version support
|
||||
dummyPrefix = "di-" // ipvlan prefix for dummy parent interface
|
||||
ipvlanKernelVer = 4 // minimum ipvlan kernel support
|
||||
ipvlanMajorVer = 0 // minimum ipvlan major kernel support
|
||||
)
|
||||
|
||||
// createIPVlan Create the ipvlan slave specifying the source name
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/libnetwork/driverapi"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
|
@ -13,6 +14,15 @@ import (
|
|||
|
||||
// CreateNetwork the network for the specified driver type
|
||||
func (d *driver) CreateNetwork(nid string, option map[string]interface{}, ipV4Data, ipV6Data []driverapi.IPAMData) error {
|
||||
kv, err := kernel.GetKernelVersion()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check kernel version for %s driver support: %v", macvlanType, err)
|
||||
}
|
||||
// ensure Kernel version is greater then v3.9 for macvlan support
|
||||
if kv.Kernel < macvlanKernelVer || (kv.Kernel == macvlanKernelVer && kv.Major < macvlanMajorVer) {
|
||||
return fmt.Errorf("kernel version failed to meet the minimum macvlan kernel requirement of %d.%d, found %d.%d.%d",
|
||||
macvlanKernelVer, macvlanMajorVer, kv.Kernel, kv.Major, kv.Minor)
|
||||
}
|
||||
// parse and validate the config and bind to networkConfiguration
|
||||
config, err := parseNetworkOptions(nid, option)
|
||||
if err != nil {
|
||||
|
|
|
@ -15,7 +15,8 @@ import (
|
|||
|
||||
const (
|
||||
dummyPrefix = "dm-" // macvlan prefix for dummy parent interface
|
||||
macvlanKernelVer = "3.9" // minimum ipvlan kernel version support
|
||||
macvlanKernelVer = 3 // minimum macvlan kernel support
|
||||
macvlanMajorVer = 9 // minimum macvlan major kernel support
|
||||
)
|
||||
|
||||
// Create the macvlan slave specifying the source name
|
||||
|
|
Loading…
Reference in a new issue