Initial commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user