From 2bb0bb206bbdab9dc34be5f2ff5aa9b92aadad3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pab=C3=B3n?= Date: Thu, 27 Feb 2020 21:05:41 -0800 Subject: [PATCH] Remove GPL3 package and coprhd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a check in travis to make sure that no GPL packages are added Signed-off-by: Luis Pabón --- .travis.yml | 3 +- vendor/gopkg.in/jmcvetta/napping.v3/README.md | 75 ---- vendor/gopkg.in/jmcvetta/napping.v3/VERSION | 1 - vendor/gopkg.in/jmcvetta/napping.v3/api.go | 62 ---- vendor/gopkg.in/jmcvetta/napping.v3/doc.go | 32 -- .../gopkg.in/jmcvetta/napping.v3/request.go | 95 ----- .../gopkg.in/jmcvetta/napping.v3/session.go | 337 ------------------ vendor/gopkg.in/jmcvetta/napping.v3/util.go | 16 - vendor/vendor.json | 6 - volume/drivers/coprhd/coprhd.go | 293 --------------- volume/drivers/drivers.go | 16 +- 11 files changed, 8 insertions(+), 928 deletions(-) delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/README.md delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/VERSION delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/api.go delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/doc.go delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/request.go delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/session.go delete mode 100644 vendor/gopkg.in/jmcvetta/napping.v3/util.go delete mode 100644 volume/drivers/coprhd/coprhd.go diff --git a/.travis.yml b/.travis.yml index b6fac3721..13af1f63e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,10 @@ install: - go get -u github.com/vbatts/git-validation script: - git-validation -run DCO,short-subject - - go fmt $(go list ./... | grep -v vendor) | wc -l | grep 0 + - go fmt $(go list ./... | grep -v vendor) | wc -l | grep "^0" - make docker-proto - git diff $(find . -name "*.pb.*go" -o -name "api.swagger.json" | grep -v vendor) | wc -l | grep "^0" + - git grep -rw GPL vendor | grep LICENSE | egrep -v "yaml.v2" | wc -l | grep "^0" - make sdk-check-version - make install - make vet diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/README.md b/vendor/gopkg.in/jmcvetta/napping.v3/README.md deleted file mode 100644 index 877088823..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# Napping: HTTP for Gophers - -Package `napping` is a [Go][] client library for interacting with -[RESTful APIs][]. Napping was inspired by Python's excellent [Requests][] -library. - - -## Status - -[![Drone Build Status](https://drone.io/github.com/jmcvetta/napping/status.png)](https://drone.io/github.com/jmcvetta/napping/latest) -[![Travis Build Status](https://travis-ci.org/jmcvetta/napping.png)](https://travis-ci.org/jmcvetta/napping) -[![Coverage Status](https://coveralls.io/repos/jmcvetta/restclient/badge.png)](https://coveralls.io/r/jmcvetta/napping) - -Used by, and developed in conjunction with, [Neoism][]. - - -## Installation - -### Requirements - -Napping requires Go 1.2 or later. - - -### Development - -``` -go get github.com/jmcvetta/napping -``` - -### Stable - -Napping is versioned using [`gopkg.in`](http://gopkg.in). - -Current release is `v3`. - -``` -go get gopkg.in/jmcvetta/napping.v3 -``` - - -## Documentation - -See [![GoDoc](http://godoc.org/github.com/jmcvetta/napping?status.png)](http://godoc.org/github.com/jmcvetta/napping) -for automatically generated API documentation. - -Check out [github_auth_token][auth-token] for a working example -showing how to retrieve an auth token from the Github API. - - -## Support - -Paid support, development, and consulting services are available from [Silicon -Beach Heavy Industries](http://siliconheavy.com). - - - -## Contributing - -Contributions in the form of Pull Requests are gladly accepted. Before -submitting a PR, please ensure your code passes all tests, and that your -changes do not decrease test coverage. I.e. if you add new features also add -corresponding new tests. - - -## License - -This is Free Software, released under the terms of the [GPL v3][]. - - -[Go]: http://golang.org -[RESTful APIs]: http://en.wikipedia.org/wiki/Representational_state_transfer#RESTful_web_APIs -[Requests]: http://python-requests.org -[GPL v3]: http://www.gnu.org/copyleft/gpl.html -[auth-token]: https://github.com/jmcvetta/napping/blob/master/examples/github_auth_token/github_auth_token.go -[Neoism]: https://github.com/jmcvetta/neoism diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/VERSION b/vendor/gopkg.in/jmcvetta/napping.v3/VERSION deleted file mode 100644 index 29b317f0b..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/VERSION +++ /dev/null @@ -1 +0,0 @@ -v3.0.5 diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/api.go b/vendor/gopkg.in/jmcvetta/napping.v3/api.go deleted file mode 100644 index cf9569f93..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/api.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released -// under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for -// details. Resist intellectual serfdom - the ownership of ideas is akin to -// slavery. - -package napping - -/* -This module implements the Napping API. -*/ - -import ( - "net/url" -) - -// Send composes and sends and HTTP request. -func Send(r *Request) (*Response, error) { - s := Session{} - return s.Send(r) -} - -// Get sends a GET request. -func Get(url string, p *url.Values, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Get(url, p, result, errMsg) -} - -// Options sends an OPTIONS request. -func Options(url string, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Options(url, result, errMsg) -} - -// Head sends a HEAD request. -func Head(url string, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Head(url, result, errMsg) -} - -// Post sends a POST request. -func Post(url string, payload, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Post(url, payload, result, errMsg) -} - -// Put sends a PUT request. -func Put(url string, payload, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Put(url, payload, result, errMsg) -} - -// Patch sends a PATCH request. -func Patch(url string, payload, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Patch(url, payload, result, errMsg) -} - -// Delete sends a DELETE request. -func Delete(url string, p *url.Values, result, errMsg interface{}) (*Response, error) { - s := Session{} - return s.Delete(url, p, result, errMsg) -} diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/doc.go b/vendor/gopkg.in/jmcvetta/napping.v3/doc.go deleted file mode 100644 index 492a0b908..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/doc.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released -// under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for -// details. Resist intellectual serfdom - the ownership of ideas is akin to -// slavery. - -/* -Package napping is a client library for interacting with RESTful APIs. - -Example: - - type Foo struct { - Bar string - } - type Spam struct { - Eggs int - } - payload := Foo{ - Bar: "baz", - } - result := Spam{} - url := "http://foo.com/bar" - resp, err := napping.Post(url, &payload, &result, nil) - if err != nil { - panic(err) - } - if resp.Status() == 200 { - println(result.Eggs) - } - -See the "examples" folder for a more complete example. -*/ -package napping diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/request.go b/vendor/gopkg.in/jmcvetta/napping.v3/request.go deleted file mode 100644 index 091c1efd1..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/request.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released -// under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for -// details. Resist intellectual serfdom - the ownership of ideas is akin to -// slavery. - -package napping - -import ( - "bytes" - "encoding/json" - "net/http" - "net/url" - "strings" - "time" -) - -// A Params is a map containing URL parameters. -type Params map[string]string - -func (p Params) AsUrlValues() url.Values { - result := url.Values{} - for key, value := range p { - result.Set(key, value) - } - return result -} - -// A Request describes an HTTP request to be executed, data structures into -// which the result will be unmarshalled, and the server's response. By using -// a single object for both the request and the response we allow easy access -// to Result and Error objects without needing type assertions. -type Request struct { - Url string // Raw URL string - Method string // HTTP method to use - Params *url.Values // URL query parameters - Payload interface{} // Data to JSON-encode and POST - - // Can be set to true if Payload is of type *bytes.Buffer and client wants - // to send it as-is - RawPayload bool - - // Result is a pointer to a data structure. On success (HTTP status < 300), - // response from server is unmarshaled into Result. - Result interface{} - - // CaptureResponseBody can be set to capture the response body for external use. - CaptureResponseBody bool - - // ResponseBody exports the raw response body if CaptureResponseBody is true. - ResponseBody *bytes.Buffer - - // Error is a pointer to a data structure. On error (HTTP status >= 300), - // response from server is unmarshaled into Error. - Error interface{} - - // Optional - Userinfo *url.Userinfo - Header *http.Header - - // The following fields are populated by Send(). - timestamp time.Time // Time when HTTP request was sent - status int // HTTP status for executed request - response *http.Response // Response object from http package - body []byte // Body of server's response (JSON or otherwise) -} - -// A Response is a Request object that has been executed. -type Response Request - -// Timestamp returns the time when HTTP request was sent. -func (r *Response) Timestamp() time.Time { - return r.timestamp -} - -// RawText returns the body of the server's response as raw text. -func (r *Response) RawText() string { - return strings.TrimSpace(string(r.body)) -} - -// Status returns the HTTP status for the executed request, or 0 if request has -// not yet been sent. -func (r *Response) Status() int { - return r.status -} - -// HttpResponse returns the underlying Response object from http package. -func (r *Response) HttpResponse() *http.Response { - return r.response -} - -// Unmarshal parses the JSON-encoded data in the server's response, and stores -// the result in the value pointed to by v. -func (r *Response) Unmarshal(v interface{}) error { - return json.Unmarshal(r.body, v) -} diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/session.go b/vendor/gopkg.in/jmcvetta/napping.v3/session.go deleted file mode 100644 index e99dd3d36..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/session.go +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released -// under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for -// details. Resist intellectual serfdom - the ownership of ideas is akin to -// slavery. - -package napping - -/* -This module provides a Session object to manage and persist settings across -requests (cookies, auth, proxies). -*/ - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "errors" - "io/ioutil" - "log" - "net/http" - "net/url" - "strings" - "time" -) - -type Session struct { - Client *http.Client - Log bool // Log request and response - - // Optional - Userinfo *url.Userinfo - - // Optional defaults - can be overridden in a Request - Header *http.Header - Params *url.Values -} - -// Send constructs and sends an HTTP request. -func (s *Session) Send(r *Request) (response *Response, err error) { - r.Method = strings.ToUpper(r.Method) - // - // Create a URL object from the raw url string. This will allow us to compose - // query parameters programmatically and be guaranteed of a well-formed URL. - // - u, err := url.Parse(r.Url) - if err != nil { - s.log("URL", r.Url) - s.log(err) - return - } - // - // Default query parameters - // - p := url.Values{} - if s.Params != nil { - for k, v := range *s.Params { - p[k] = v - } - } - // - // Parameters that were present in URL - // - if u.Query() != nil { - for k, v := range u.Query() { - p[k] = v - } - } - // - // User-supplied params override default - // - if r.Params != nil { - for k, v := range *r.Params { - p[k] = v - } - } - // - // Encode parameters - // - u.RawQuery = p.Encode() - // - // Attach params to response - // - r.Params = &p - // - // Create a Request object; if populated, Data field is JSON encoded as - // request body - // - header := http.Header{} - if s.Header != nil { - for k, _ := range *s.Header { - v := s.Header.Get(k) - header.Set(k, v) - } - } - var req *http.Request - var buf *bytes.Buffer - if r.Payload != nil { - if r.RawPayload { - var ok bool - // buf can be nil interface at this point - // so we'll do extra nil check - buf, ok = r.Payload.(*bytes.Buffer) - if !ok { - err = errors.New("Payload must be of type *bytes.Buffer if RawPayload is set to true") - return - } - } else { - var b []byte - b, err = json.Marshal(&r.Payload) - if err != nil { - s.log(err) - return - } - buf = bytes.NewBuffer(b) - } - if buf != nil { - req, err = http.NewRequest(r.Method, u.String(), buf) - } else { - req, err = http.NewRequest(r.Method, u.String(), nil) - } - if err != nil { - s.log(err) - return - } - // Overwrite the content type to json since we're pushing the payload as json - header.Set("Content-Type", "application/json") - } else { // no data to encode - req, err = http.NewRequest(r.Method, u.String(), nil) - if err != nil { - s.log(err) - return - } - - } - // - // Merge Session and Request options - // - var userinfo *url.Userinfo - if u.User != nil { - userinfo = u.User - } - if s.Userinfo != nil { - userinfo = s.Userinfo - } - // Prefer Request's user credentials - if r.Userinfo != nil { - userinfo = r.Userinfo - } - if r.Header != nil { - for k, v := range *r.Header { - header.Set(k, v[0]) // Is there always guarnateed to be at least one value for a header? - } - } - if header.Get("Accept") == "" { - header.Add("Accept", "application/json") // Default, can be overridden with Opts - } - req.Header = header - // - // Set HTTP Basic authentication if userinfo is supplied - // - if userinfo != nil { - pwd, _ := userinfo.Password() - req.SetBasicAuth(userinfo.Username(), pwd) - if u.Scheme != "https" { - s.log("WARNING: Using HTTP Basic Auth in cleartext is insecure.") - } - } - // - // Execute the HTTP request - // - - // Debug log request - s.log("--------------------------------------------------------------------------------") - s.log("REQUEST") - s.log("--------------------------------------------------------------------------------") - s.log("Method:", req.Method) - s.log("URL:", req.URL) - s.log("Header:", req.Header) - s.log("Form:", req.Form) - s.log("Payload:") - if r.RawPayload && s.Log && buf != nil { - s.log(base64.StdEncoding.EncodeToString(buf.Bytes())) - } else { - s.log(pretty(r.Payload)) - } - r.timestamp = time.Now() - var client *http.Client - if s.Client != nil { - client = s.Client - } else { - client = &http.Client{} - s.Client = client - } - resp, err := client.Do(req) - if err != nil { - s.log(err) - return - } - defer resp.Body.Close() - r.status = resp.StatusCode - r.response = resp - - // - // Unmarshal - // - r.body, err = ioutil.ReadAll(resp.Body) - if err != nil { - s.log(err) - return - } - if string(r.body) != "" { - if resp.StatusCode < 300 && r.Result != nil { - err = json.Unmarshal(r.body, r.Result) - } - if resp.StatusCode >= 400 && r.Error != nil { - json.Unmarshal(r.body, r.Error) // Should we ignore unmarshall error? - } - } - if r.CaptureResponseBody { - r.ResponseBody = bytes.NewBuffer(r.body) - } - rsp := Response(*r) - response = &rsp - - // Debug log response - s.log("--------------------------------------------------------------------------------") - s.log("RESPONSE") - s.log("--------------------------------------------------------------------------------") - s.log("Status: ", response.status) - s.log("Header:") - s.log(pretty(response.HttpResponse().Header)) - s.log("Body:") - - if response.body != nil { - raw := json.RawMessage{} - if json.Unmarshal(response.body, &raw) == nil { - s.log(pretty(&raw)) - } else { - s.log(pretty(response.RawText())) - } - } else { - s.log("Empty response body") - } - - return -} - -// Get sends a GET request. -func (s *Session) Get(url string, p *url.Values, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "GET", - Url: url, - Params: p, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Options sends an OPTIONS request. -func (s *Session) Options(url string, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "OPTIONS", - Url: url, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Head sends a HEAD request. -func (s *Session) Head(url string, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "HEAD", - Url: url, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Post sends a POST request. -func (s *Session) Post(url string, payload, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "POST", - Url: url, - Payload: payload, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Put sends a PUT request. -func (s *Session) Put(url string, payload, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "PUT", - Url: url, - Payload: payload, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Patch sends a PATCH request. -func (s *Session) Patch(url string, payload, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "PATCH", - Url: url, - Payload: payload, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Delete sends a DELETE request. -func (s *Session) Delete(url string, p *url.Values, result, errMsg interface{}) (*Response, error) { - r := Request{ - Method: "DELETE", - Url: url, - Params: p, - Result: result, - Error: errMsg, - } - return s.Send(&r) -} - -// Debug method for logging -// Centralizing logging in one method -// avoids spreading conditionals everywhere -func (s *Session) log(args ...interface{}) { - if s.Log { - log.Println(args...) - } -} diff --git a/vendor/gopkg.in/jmcvetta/napping.v3/util.go b/vendor/gopkg.in/jmcvetta/napping.v3/util.go deleted file mode 100644 index bde14ca71..000000000 --- a/vendor/gopkg.in/jmcvetta/napping.v3/util.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released -// under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for -// details. Resist intellectual serfdom - the ownership of ideas is akin to -// slavery. - -package napping - -import ( - "encoding/json" -) - -// pretty pretty-prints an interface using the JSON marshaler -func pretty(v interface{}) string { - b, _ := json.MarshalIndent(v, "", "\t") - return string(b) -} diff --git a/vendor/vendor.json b/vendor/vendor.json index f076a34a3..acc69ccc8 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -2654,12 +2654,6 @@ "revision": "d2d2541c53f18d2a059457998ce2876cc8e67cbf", "revisionTime": "2018-03-26T17:23:32Z" }, - { - "checksumSHA1": "tr9VfMj5HNs7UqT6MrGnqMSakOE=", - "path": "gopkg.in/jmcvetta/napping.v3", - "revision": "6c845f879618cc607cbc2bb1d8e817e618505341", - "revisionTime": "2016-02-12T23:58:06Z" - }, { "checksumSHA1": "wMNF3SsJSGCd/niEpHwY/dtyjGY=", "path": "gopkg.in/square/go-jose.v2", diff --git a/volume/drivers/coprhd/coprhd.go b/volume/drivers/coprhd/coprhd.go deleted file mode 100644 index 716600761..000000000 --- a/volume/drivers/coprhd/coprhd.go +++ /dev/null @@ -1,293 +0,0 @@ -package coprhd - -import ( - "crypto/tls" - "fmt" - "net/http" - "net/url" - - napping "gopkg.in/jmcvetta/napping.v3" - - "github.com/sirupsen/logrus" - - "github.com/libopenstorage/openstorage/api" - "github.com/libopenstorage/openstorage/volume" - "github.com/libopenstorage/openstorage/volume/drivers/common" - "github.com/portworx/kvdb" -) - -const ( - // Name of the driver - Name = "coprhd" - // Type of the driver - Type = api.DriverType_DRIVER_TYPE_BLOCK - - // LoginUri path to create a authentication token - loginUri = "login.json" - // LoginUri path to create volume - createVolumeUri = "block/volumes.json" -) - -// ApiError represents the default api error code -type ApiError struct { - Code string `json:"code"` - Retryable string `json:"retryable"` - Description string `json:"description"` - Details string `json:"details"` -} - -// CreateVolumeArgs represents the json parameters for the create volume REST call -type CreateVolumeArgs struct { - ConsistencyGroup string `json:"consistency_group"` - Count int `json:"count"` - Name string `json:"name"` - Project string `json:"project"` - Size string `json:"size"` - VArray string `json:"varray"` - VPool string `json:"vpool"` -} - -// CreateVolumeReply is the reply from the create volume REST call -type CreateVolumeReply struct { - Task []struct { - Resource struct { - Name string `json:"name"` - Id string `json:"id"` - } `json:"resource"` - } `json:"task"` -} - -type driver struct { - volume.IODriver - volume.StoreEnumerator - volume.StatsDriver - volume.QuiesceDriver - volume.CredsDriver - volume.CloudBackupDriver - volume.CloudMigrateDriver - volume.FilesystemTrimDriver - volume.FilesystemCheckDriver - consistencyGroup string - project string - varray string - vpool string - url string - httpClient *http.Client - creds *url.Userinfo -} - -// Init initializes the driver -func Init(params map[string]string) (volume.VolumeDriver, error) { - restUrl, ok := params["restUrl"] - if !ok { - return nil, fmt.Errorf("rest api 'url' configuration parameter must be set") - } - - user, ok := params["user"] - if !ok { - return nil, fmt.Errorf("rest auth 'user' must be set") - } - - pass, ok := params["password"] - if !ok { - return nil, fmt.Errorf("rest auth 'password' must be set") - } - - consistencyGroup, ok := params["consistency_group"] - if !ok { - return nil, fmt.Errorf("'consistency_group' configuration parameter must be set") - } - - project, ok := params["project"] - if !ok { - return nil, fmt.Errorf("'project' configuration parameter must be set") - } - - varray, ok := params["varray"] - if !ok { - return nil, fmt.Errorf("'varray' configuration parameter must be set") - } - - vpool, ok := params["vpool"] - if !ok { - return nil, fmt.Errorf("'vpool' configuration parameter must be set") - } - - d := &driver{ - IODriver: volume.IONotSupported, - StoreEnumerator: common.NewDefaultStoreEnumerator(Name, kvdb.Instance()), - StatsDriver: volume.StatsNotSupported, - QuiesceDriver: volume.QuiesceNotSupported, - CredsDriver: volume.CredsNotSupported, - CloudBackupDriver: volume.CloudBackupNotSupported, - CloudMigrateDriver: volume.CloudMigrateNotSupported, - FilesystemTrimDriver: volume.FilesystemTrimNotSupported, - FilesystemCheckDriver: volume.FilesystemCheckNotSupported, - consistencyGroup: consistencyGroup, - project: project, - varray: varray, - vpool: vpool, - url: restUrl, - creds: url.UserPassword(user, pass), - httpClient: &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - }, - }, - } - - return d, nil -} - -func (d *driver) Name() string { - return Name -} - -func (d *driver) Type() api.DriverType { - return Type -} - -func (d *driver) Version() (*api.StorageVersion, error) { - return &api.StorageVersion{ - Driver: d.Name(), - Version: "1.0.0", - }, nil -} - -func (d *driver) Create( - locator *api.VolumeLocator, - source *api.Source, - spec *api.VolumeSpec, -) (string, error) { - - s, err := d.getAuthSession() - - if err != nil { - logrus.Errorf("Failed to create session: %s", err.Error()) - return "", err - } - - e := ApiError{} - - res := &CreateVolumeReply{} - - sz := int64(spec.Size / (1024 * 1024 * 1000)) - - payload := CreateVolumeArgs{ - d.consistencyGroup, // ConsistencyGroup - 1, // Count - locator.Name, // Name - d.project, // Project - fmt.Sprintf("%.6dGB", sz), // Volume Size - d.varray, // Virtual Block Array - d.vpool, // Virtual Block Pool - } - - url := d.url + createVolumeUri - - resp, err := s.Post(url, &payload, res, &e) - - if resp.Status() != http.StatusAccepted { - - return "", fmt.Errorf("Failed to create volume: %d", resp.Status()) - } - - return res.Task[0].Resource.Id, err -} - -func (d *driver) Delete(volumeID string) error { - return nil -} - -func (d *driver) Attach(volumeID string, attachOptions map[string]string) (path string, err error) { - return "", nil -} - -func (d *driver) MountedAt(mountpath string) string { - return "" -} - -func (d *driver) Detach(volumeID string, options map[string]string) error { - return nil -} - -func (d *driver) Mount(volumeID string, mountpath string, options map[string]string) error { - return nil -} - -func (d *driver) Unmount(volumeID string, mountpath string, options map[string]string) error { - - return nil -} - -func (d *driver) Set( - volumeID string, - locator *api.VolumeLocator, - spec *api.VolumeSpec) error { - return volume.ErrNotSupported -} - -func (d *driver) Shutdown() { - logrus.Infof("%s Shutting down", Name) -} - -func (d *driver) Snapshot( - volumeID string, - readonly bool, - locator *api.VolumeLocator, - noRetry bool, -) (string, error) { - return "", nil -} - -func (d *driver) Restore(volumeID string, snapID string) error { - return volume.ErrNotSupported -} - -func (d *driver) SnapshotGroup(groupID string, labels map[string]string, volumeIDs []string) (*api.GroupSnapCreateResponse, error) { - - return nil, volume.ErrNotSupported -} - -func (d *driver) Status() [][2]string { - return [][2]string{} -} - -// getAuthSession returns an authenticated API Session -func (d *driver) getAuthSession() (session *napping.Session, err error) { - e := ApiError{} - - s := napping.Session{ - Userinfo: d.creds, - Client: d.httpClient, - } - - url := d.url + loginUri - - resp, err := s.Get(url, nil, nil, &e) - - if err != nil { - return - } - - token := resp.HttpResponse().Header.Get("X-SDS-AUTH-TOKEN") - - h := http.Header{} - - h.Set("X-SDS-AUTH-TOKEN", token) - - session = &napping.Session{ - Client: d.httpClient, - Header: &h, - } - - return -} - -func (d *driver) Catalog(volumeID, path, depth string) (api.CatalogResponse, error) { - return api.CatalogResponse{}, volume.ErrNotSupported -} - -func (d *driver) VolService(volumeID string, vtreq *api.VolumeServiceRequest) (*api.VolumeServiceResponse, error) { - return nil, volume.ErrNotSupported -} diff --git a/volume/drivers/drivers.go b/volume/drivers/drivers.go index 3156811ff..4bda8cee3 100644 --- a/volume/drivers/drivers.go +++ b/volume/drivers/drivers.go @@ -7,7 +7,6 @@ import ( "github.com/libopenstorage/openstorage/volume" "github.com/libopenstorage/openstorage/volume/drivers/btrfs" "github.com/libopenstorage/openstorage/volume/drivers/buse" - "github.com/libopenstorage/openstorage/volume/drivers/coprhd" "github.com/libopenstorage/openstorage/volume/drivers/fake" "github.com/libopenstorage/openstorage/volume/drivers/nfs" "github.com/libopenstorage/openstorage/volume/drivers/pwx" @@ -28,8 +27,6 @@ var ( {DriverType: btrfs.Type, Name: btrfs.Name}, // BUSE driver provisions storage from local volumes and implements block in user space. {DriverType: buse.Type, Name: buse.Name}, - // COPRHD driver - {DriverType: coprhd.Type, Name: coprhd.Name}, // NFS driver provisions storage from an NFS server. {DriverType: nfs.Type, Name: nfs.Name}, // PWX driver provisions storage from PWX cluster. @@ -42,13 +39,12 @@ var ( volumeDriverRegistry = volume.NewVolumeDriverRegistry( map[string]func(map[string]string) (volume.VolumeDriver, error){ - btrfs.Name: btrfs.Init, - buse.Name: buse.Init, - coprhd.Name: coprhd.Init, - nfs.Name: nfs.Init, - pwx.Name: pwx.Init, - vfs.Name: vfs.Init, - fake.Name: fake.Init, + btrfs.Name: btrfs.Init, + buse.Name: buse.Init, + nfs.Name: nfs.Init, + pwx.Name: pwx.Init, + vfs.Name: vfs.Init, + fake.Name: fake.Init, }, ) )