-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.go
49 lines (41 loc) · 865 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"github.com/codegangsta/cli"
"github.com/docker/go-plugins-helpers/network"
"log"
"os"
"docker-sriov-plugin/driver"
)
const (
version = "0.1.2"
)
// Run initializes the driver
func Run(ctx *cli.Context) {
d, err := driver.StartDriver()
if err != nil {
panic(err)
}
h := network.NewHandler(d)
log.Printf("Mellanox sriov plugin started version=%v\n", version)
log.Printf("Ready to accept commands.\n")
err = h.ServeUnix("sriov", 0)
if err != nil {
log.Fatal("Run app error: %s", err.Error())
os.Exit(1)
}
}
func main() {
var flagDebug = cli.BoolFlag{
Name: "debug, d",
Usage: "enable debugging",
}
app := cli.NewApp()
app.Name = "sriov"
app.Usage = "Docker Networking using SRIOV/Passthrough netdevices"
app.Version = version
app.Flags = []cli.Flag{
flagDebug,
}
app.Action = Run
app.Run(os.Args)
}