mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
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:
@@ -21,7 +21,6 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -30,6 +29,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
|
||||
sio "github.com/codedellemc/goscaleio"
|
||||
siotypes "github.com/codedellemc/goscaleio/types/v1"
|
||||
"github.com/golang/glog"
|
||||
@@ -77,13 +78,15 @@ type sioClient struct {
|
||||
inited bool
|
||||
diskRegex *regexp.Regexp
|
||||
mtx sync.Mutex
|
||||
exec mount.Exec
|
||||
}
|
||||
|
||||
func newSioClient(gateway, username, password string, sslEnabled bool) (*sioClient, error) {
|
||||
func newSioClient(gateway, username, password string, sslEnabled bool, exec mount.Exec) (*sioClient, error) {
|
||||
client := new(sioClient)
|
||||
client.gateway = gateway
|
||||
client.username = username
|
||||
client.password = password
|
||||
client.exec = exec
|
||||
if sslEnabled {
|
||||
client.insecure = false
|
||||
client.certsEnabled = true
|
||||
@@ -296,7 +299,7 @@ func (c *sioClient) IID() (string, error) {
|
||||
|
||||
if c.instanceID == "" {
|
||||
cmd := c.getSdcCmd()
|
||||
output, err := exec.Command(cmd, "--query_guid").Output()
|
||||
output, err := c.exec.Run(cmd, "--query_guid")
|
||||
if err != nil {
|
||||
glog.Error(log("drv_cfg --query_guid failed: %v", err))
|
||||
return "", err
|
||||
@@ -355,7 +358,7 @@ func (c *sioClient) Devs() (map[string]string, error) {
|
||||
volumeMap := make(map[string]string)
|
||||
|
||||
// grab the sdc tool output
|
||||
out, err := exec.Command(c.getSdcCmd(), "--query_vols").Output()
|
||||
out, err := c.exec.Run(c.getSdcCmd(), "--query_vols")
|
||||
if err != nil {
|
||||
glog.Error(log("sdc --query_vols failed: %v", err))
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user