Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to use ScaleIO v2 API #355

Merged
merged 1 commit into from Apr 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .docs/user-guide/storage-providers.md
Expand Up @@ -280,6 +280,7 @@ example see the `Examples` section.
```yaml
scaleio:
endpoint: https://host_ip/api
apiVersion: "2.0"
insecure: false
useCerts: true
userName: admin
Expand All @@ -294,6 +295,8 @@ scaleio:
```

#### Configuration Notes
- The `apiVersion` can optionally be set here to force certain API behavior.
The default is to retrieve the endpoint API, and pass this version during calls.
- `insecure` should be set to `true` if you have not loaded the SSL
certificates on the host. A successful wget or curl should be possible without
SSL errors to the API `endpoint` in this case.
Expand Down Expand Up @@ -327,7 +330,7 @@ parameter.
- By default the password is the same as your administrative MDM password.
- Start the gateway `service scaleio-gateway start`.
- With 1.32 we have noticed a restart of the gateway may be necessary as well
after an initial install with `service scaleio-gateway restart`.
after an initial install with `service scaleio-gateway restart`.

### Activating the Driver
To activate the ScaleIO driver please follow the instructions for
Expand Down
14 changes: 11 additions & 3 deletions drivers/storage/scaleio/scaleio.go
Expand Up @@ -63,22 +63,25 @@ func (d *driver) Init(r *core.RexRay) error {
"endpoint": d.endpoint(),
"insecure": d.insecure(),
"useCerts": d.useCerts(),
"apiVersion": d.apiVersion(),
})

var err error

if d.client, err = goscaleio.NewClientWithArgs(
d.endpoint(),
d.apiVersion(),
d.insecure(),
d.useCerts()); err != nil {
return goof.WithFieldsE(fields, "error constructing new client", err)
}

if _, err := d.client.Authenticate(
&goscaleio.ConfigConnect{
d.endpoint(),
d.userName(),
d.password()}); err != nil {
Endpoint: d.endpoint(),
Username: d.userName(),
Password: d.password(),
}); err != nil {
fields["userName"] = d.userName()
if d.password() != "" {
fields["password"] = "******"
Expand Down Expand Up @@ -784,6 +787,10 @@ func (d *driver) endpoint() string {
return d.r.Config.GetString("scaleio.endpoint")
}

func (d *driver) apiVersion() string {
return d.r.Config.GetString("scaleio.apiVersion")
}

func (d *driver) insecure() bool {
return d.r.Config.GetBool("scaleio.insecure")
}
Expand Down Expand Up @@ -841,6 +848,7 @@ func configRegistration() *gofig.Registration {
r.Key(gofig.String, "", "", "", "scaleio.endpoint")
r.Key(gofig.Bool, "", false, "", "scaleio.insecure")
r.Key(gofig.Bool, "", false, "", "scaleio.useCerts")
r.Key(gofig.String, "", "", "", "scaleio.apiVersion")
r.Key(gofig.String, "", "", "", "scaleio.userID")
r.Key(gofig.String, "", "", "", "scaleio.userName")
r.Key(gofig.String, "", "", "", "scaleio.password")
Expand Down
2 changes: 1 addition & 1 deletion glide.yaml
Expand Up @@ -24,7 +24,7 @@ import:
repo: https://github.com/clintonskitson/goamz
vcs: git
- package: github.com/emccode/goscaleio
ref: 37a71bf801a533473f94e4d4dcee2372c141e261
ref: 5b02f78c9e4b331a05271145196c15c6614b9eff
repo: https://github.com/emccode/goscaleio.git
vcs: git
- package: github.com/emccode/goxtremio
Expand Down