| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package main
- import (
- "log"
- "os"
- "path/filepath"
- "strconv"
- // Vendors
- "iscsi"
- "github.com/Sirupsen/logrus"
- "github.com/docker/go-plugins-helpers/volume"
- )
- // Main
- func main() {
- debug := os.Getenv("DEBUG")
- if ok, _ := strconv.ParseBool(debug); ok {
- logrus.SetLevel(logrus.DebugLevel)
- }
- iSCSI = iscsi.NewISCSIPlugin()
- path := "/var/lib/docker"
- d, err := newiscsiDriver(path)
- if err != nil {
- log.Fatal(err)
- }
- socketPath := "/run/docker/plugins"
- if err := os.MkdirAll(socketPath, 0755); err != nil {
- logrus.Error(err.Error())
- }
- socketAddress := filepath.Join(socketPath, "volume-iscsi.sock")
- h := volume.NewHandler(d)
- logrus.Infof("listening on %s", socketAddress)
- logrus.Error(h.ServeUnix(socketAddress, 0))
- }
|