mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1016 from nerdalert/modprobe
Removed experimental drivers modprobe check
This commit is contained in:
commit
433b29baca
4 changed files with 0 additions and 52 deletions
|
@ -72,10 +72,6 @@ func (d *driver) CreateNetwork(nid string, option map[string]interface{}, ipV4Da
|
||||||
|
|
||||||
// createNetwork is used by new network callbacks and persistent network cache
|
// createNetwork is used by new network callbacks and persistent network cache
|
||||||
func (d *driver) createNetwork(config *configuration) error {
|
func (d *driver) createNetwork(config *configuration) error {
|
||||||
// fail the network create if the ipvlan kernel module is unavailable
|
|
||||||
if err := kernelSupport(ipvlanType); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
networkList := d.getNetworks()
|
networkList := d.getNetworks()
|
||||||
for _, nw := range networkList {
|
for _, nw := range networkList {
|
||||||
if config.Parent == nw.config.Parent {
|
if config.Parent == nw.config.Parent {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package ipvlan
|
package ipvlan
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -72,25 +69,6 @@ func parentExists(ifaceStr string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// kernelSupport for the necessary kernel module for the driver type
|
|
||||||
func kernelSupport(networkTpe string) error {
|
|
||||||
// attempt to load the module, silent if successful or already loaded
|
|
||||||
exec.Command("modprobe", ipvlanType).Run()
|
|
||||||
f, err := os.Open("/proc/modules")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
if strings.Contains(s.Text(), ipvlanType) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("unable to load the Linux kernel module %s", ipvlanType)
|
|
||||||
}
|
|
||||||
|
|
||||||
// createVlanLink parses sub-interfaces and vlan id for creation
|
// createVlanLink parses sub-interfaces and vlan id for creation
|
||||||
func createVlanLink(parentName string) error {
|
func createVlanLink(parentName string) error {
|
||||||
if strings.Contains(parentName, ".") {
|
if strings.Contains(parentName, ".") {
|
||||||
|
|
|
@ -76,10 +76,6 @@ func (d *driver) CreateNetwork(nid string, option map[string]interface{}, ipV4Da
|
||||||
|
|
||||||
// createNetwork is used by new network callbacks and persistent network cache
|
// createNetwork is used by new network callbacks and persistent network cache
|
||||||
func (d *driver) createNetwork(config *configuration) error {
|
func (d *driver) createNetwork(config *configuration) error {
|
||||||
// fail the network create if the macvlan kernel module is unavailable
|
|
||||||
if err := kernelSupport(macvlanType); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
networkList := d.getNetworks()
|
networkList := d.getNetworks()
|
||||||
for _, nw := range networkList {
|
for _, nw := range networkList {
|
||||||
if config.Parent == nw.config.Parent {
|
if config.Parent == nw.config.Parent {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package macvlan
|
package macvlan
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -76,25 +73,6 @@ func parentExists(ifaceStr string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// kernelSupport for the necessary kernel module for the driver type
|
|
||||||
func kernelSupport(networkTpe string) error {
|
|
||||||
// attempt to load the module, silent if successful or already loaded
|
|
||||||
exec.Command("modprobe", macvlanType).Run()
|
|
||||||
f, err := os.Open("/proc/modules")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
if strings.Contains(s.Text(), macvlanType) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("unable to load the Linux kernel module %s", macvlanType)
|
|
||||||
}
|
|
||||||
|
|
||||||
// createVlanLink parses sub-interfaces and vlan id for creation
|
// createVlanLink parses sub-interfaces and vlan id for creation
|
||||||
func createVlanLink(parentName string) error {
|
func createVlanLink(parentName string) error {
|
||||||
if strings.Contains(parentName, ".") {
|
if strings.Contains(parentName, ".") {
|
||||||
|
|
Loading…
Reference in a new issue