diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 0de02f6..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,69 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/Microsoft/go-winio" - packages = ["."] - revision = "7da180ee92d8bd8bb8c37fc560e673e6557c392f" - version = "v0.4.7" - -[[projects]] - name = "github.com/Sirupsen/logrus" - packages = ["."] - revision = "d682213848ed68c0a260ca37d6dd5ace8423f5ba" - version = "v1.0.4" - -[[projects]] - name = "github.com/coreos/go-systemd" - packages = ["activation"] - revision = "40e2722dffead74698ca12a750f64ef313ddce05" - version = "v16" - -[[projects]] - name = "github.com/docker/go-connections" - packages = ["sockets"] - revision = "3ede32e2033de7505e6500d6c868c2b9ed9f169d" - version = "v0.3.0" - -[[projects]] - branch = "master" - name = "github.com/docker/go-plugins-helpers" - packages = ["sdk","volume"] - revision = "61cb8e2334204460162c8bd2417cd43cb71da66f" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - revision = "00c29f56e2386353d58c599509e8dc3801b0d716" - -[[projects]] - branch = "master" - name = "github.com/rackspace/gophercloud" - packages = [".","openstack","openstack/blockstorage/v2/extensions/volumeactions","openstack/blockstorage/v2/volumes","openstack/identity/v2/tenants","openstack/identity/v2/tokens","openstack/identity/v3/tokens","openstack/utils","pagination","testhelper","testhelper/client"] - revision = "e00690e87603abe613e9f02c816c7c4bef82e063" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - revision = "91a49db82a88618983a78a06c1cbd4e00ab749ab" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["proxy"] - revision = "d25186b37f34ebdbbea8f488ef055638dfab272d" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix","windows"] - revision = "dd2ff4accc098aceecb86b36eaa7829b2a17b1c9" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "c6938eff0f4cb78518e0425c0491ab6c0383331e7b06172487147474a95f8f42" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 7d0fefe..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,38 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -[[constraint]] - name = "github.com/Sirupsen/logrus" - version = "1.0.4" - -[[constraint]] - branch = "master" - name = "github.com/docker/go-plugins-helpers" - -[[constraint]] - branch = "master" - name = "github.com/mitchellh/mapstructure" - -[[constraint]] - branch = "master" - name = "github.com/rackspace/gophercloud" diff --git a/driver.go b/driver.go index d51b4d5..a12023d 100644 --- a/driver.go +++ b/driver.go @@ -3,13 +3,13 @@ package main import ( "encoding/json" "errors" - log "github.com/Sirupsen/logrus" + log "github.com/sirupsen/logrus" "github.com/mitchellh/mapstructure" - "github.com/rackspace/gophercloud" - "github.com/rackspace/gophercloud/openstack" - "github.com/rackspace/gophercloud/openstack/blockstorage/v2/extensions/volumeactions" - "github.com/rackspace/gophercloud/openstack/blockstorage/v2/volumes" - "github.com/rackspace/gophercloud/pagination" + "github.com/gophercloud/gophercloud" + "github.com/gophercloud/gophercloud/openstack" + "github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions" + "github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes" + "github.com/gophercloud/gophercloud/pagination" "io/ioutil" "net" "os" @@ -267,7 +267,7 @@ func (d CinderDriver) Remove(r *volume.RemoveRequest) error { log.Errorf("Failed to retrieve volume named: ", r.Name, "during Remove operation", err) return err } - errRes := volumes.Delete(d.Client, vol.ID) + errRes := volumes.Delete(d.Client, vol.ID, volumes.DeleteOpts{}) log.Debugf("Response from Delete: %+v\n", errRes) if errRes.Err != nil { log.Errorf("Failed to Delete volume: %s\nEncountered error: %s", vol, errRes) @@ -332,22 +332,22 @@ func (d CinderDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, erro log.Debugf("iface: %+v\n Addrs: %+v", netDev, IPs) log.Debug("Gather up initiator IQNs...") - initiator, err := GetInitiatorIqns() + initiators, err := GetInitiatorIqns() if err != nil { log.Error("Failed to retrieve Initiator name!") return &volume.MountResponse{}, err } // TODO(ebalduf): Change assumption that we have only one Initiator defined log.Debugf("Value of IPs is=%+v\n", IPs) - connectorOpts := volumeactions.ConnectorOpts{ + connectorOpts := volumeactions.InitializeConnectionOpts{ IP: d.Conf.InitiatorIP, Host: hostname, - Initiator: initiator[0], + Initiator: initiators[0], Wwpns: []string{}, Wwnns: "", - Multipath: false, - Platform: "x86", - OSType: "linux", + Multipath: gophercloud.Disabled, + Platform: "x86_64", + OSType: "linux2", } log.Debug("Issue InitializeConnection...") response := volumeactions.InitializeConnection(d.Client, vol.ID, &connectorOpts) @@ -454,22 +454,22 @@ func (d CinderDriver) Unmount(r *volume.UnmountRequest) error { // need to get rid of the hard coded Platform/OSType and fix this up for // things like say Windows log.Debugf("IPs=%+v\n", IPs) - connectorOpts := volumeactions.ConnectorOpts{ + connectorOpts := volumeactions.TerminateConnectionOpts{ IP: d.Conf.InitiatorIP, Host: hostname, Initiator: initiators[0], Wwpns: []string{}, Wwnns: "", - Multipath: false, - Platform: "x86", - OSType: "linux", + Multipath: gophercloud.Disabled, + Platform: "x86_64", + OSType: "linux2", } log.Debugf("Unreserve volume: %s", vol.ID) volumeactions.Unreserve(d.Client, vol.ID) log.Debugf("Terminate connection for volume: %s", vol.ID) volumeactions.TerminateConnection(d.Client, vol.ID, &connectorOpts) log.Debugf("Detach volume: %s", vol.ID) - volumeactions.Detach(d.Client, vol.ID) + volumeactions.Detach(d.Client, vol.ID, &volumeactions.DetachOpts{}) return nil } diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a1eaa6e --- /dev/null +++ b/go.mod @@ -0,0 +1,19 @@ +module github.com/j-griffith/cinder-docker-driver + +go 1.18 + +require ( + github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651 + github.com/gophercloud/gophercloud v0.25.0 + github.com/mitchellh/mapstructure v1.5.0 + github.com/sirupsen/logrus v1.9.0 +) + +require ( + github.com/Microsoft/go-winio v0.5.2 // indirect + github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/stretchr/testify v1.8.0 // indirect + golang.org/x/net v0.0.0-20220728030405-41545e8bf201 // indirect + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..5632b8c --- /dev/null +++ b/go.sum @@ -0,0 +1,47 @@ +github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651 h1:YcvzLmdrP/b8kLAGJ8GT7bdncgCAiWxJZIlt84D+RJg= +github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651/go.mod h1:LFyLie6XcDbyKGeVK6bHe+9aJTYCxWLBg5IrJZOaXKA= +github.com/gophercloud/gophercloud v0.25.0 h1:C3Oae7y0fUVQGSsBrb3zliAjdX+riCSEh4lNMejFNI4= +github.com/gophercloud/gophercloud v0.25.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220728030405-41545e8bf201 h1:bvOltf3SADAfG05iRml8lAB3qjoEX5RCyN4K6G5v3N0= +golang.org/x/net v0.0.0-20220728030405-41545e8bf201/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index a1c3a55..1873772 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,7 @@ package main import ( "flag" "fmt" - log "github.com/Sirupsen/logrus" + log "github.com/sirupsen/logrus" "github.com/docker/go-plugins-helpers/volume" "os" "path/filepath" diff --git a/utils.go b/utils.go index f4b7140..0bb2f48 100644 --- a/utils.go +++ b/utils.go @@ -3,8 +3,8 @@ package main import ( "errors" "fmt" - log "github.com/Sirupsen/logrus" - "github.com/rackspace/gophercloud/openstack/blockstorage/v2/volumes" + log "github.com/sirupsen/logrus" + "github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes" "net" "os" "os/exec"