ScaleIO: Use VolumeHost.GetExec() to execute utilities

This prepares volume plugins to run things in containers instead of running
them on the host.

As consequence, a mount.Exec interface needs to be passed from VolumeHost
down to SioClient.
This commit is contained in:
Jan Safranek
2017-08-22 13:27:59 +02:00
parent dbaf41e92a
commit 158017cef7
4 changed files with 21 additions and 13 deletions

View File

@@ -20,6 +20,8 @@ import (
"errors"
"strconv"
"k8s.io/kubernetes/pkg/util/mount"
"github.com/golang/glog"
siotypes "github.com/codedellemc/goscaleio/types/v1"
@@ -36,9 +38,10 @@ type storageInterface interface {
type sioMgr struct {
client sioInterface
configData map[string]string
exec mount.Exec
}
func newSioMgr(configs map[string]string) (*sioMgr, error) {
func newSioMgr(configs map[string]string, exec mount.Exec) (*sioMgr, error) {
if configs == nil {
return nil, errors.New("missing configuration data")
}
@@ -47,7 +50,7 @@ func newSioMgr(configs map[string]string) (*sioMgr, error) {
configs[confKey.sdcRootPath] = defaultString(configs[confKey.sdcRootPath], sdcRootPath)
configs[confKey.storageMode] = defaultString(configs[confKey.storageMode], "ThinProvisioned")
mgr := &sioMgr{configData: configs}
mgr := &sioMgr{configData: configs, exec: exec}
return mgr, nil
}
@@ -67,7 +70,7 @@ func (m *sioMgr) getClient() (sioInterface, error) {
certsEnabled := b
glog.V(4).Info(log("creating new client for gateway %s", gateway))
client, err := newSioClient(gateway, username, password, certsEnabled)
client, err := newSioClient(gateway, username, password, certsEnabled, m.exec)
if err != nil {
glog.Error(log("failed to create scaleio client: %v", err))
return nil, err