Skip to content

Commit

Permalink
Fix: CSI - Update to conform to latest civogo client code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Praveen005 committed Jan 20, 2025
1 parent fd56387 commit bbe7f3a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

require (
github.com/BurntSushi/toml v0.3.1
github.com/civo/civogo v0.3.67
github.com/civo/civogo v0.3.92
github.com/container-storage-interface/spec v1.6.0
github.com/golang/protobuf v1.5.4
github.com/joho/godotenv v1.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/civo/civogo v0.3.67 h1:R6MepF20Od7KQdcEKpr3GD8zKy1Jly0SuBDubZkEU2s=
github.com/civo/civogo v0.3.67/go.mod h1:S/iYmGvQOraxdRtcXeq/2mVX01/ia2qfpQUp2SsTLKA=
github.com/civo/civogo v0.3.92 h1:fiA9nsyvEU9vVwA8ssIDSGt6gsWs6meqgaKrimAEaI0=
github.com/civo/civogo v0.3.92/go.mod h1:7UCYX+qeeJbrG55E1huv+0ySxcHTqq/26FcHLVelQJM=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down
8 changes: 7 additions & 1 deletion pkg/driver/controller_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,13 @@ func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.Controlle
Str("volume_status", volume.Status).
Str("reqested_instance_id", req.NodeId).
Msg("Requesting volume to be attached in Civo API")
_, err = d.CivoClient.AttachVolume(req.VolumeId, req.NodeId)

volConfig := civogo.VolumeAttachConfig{
InstanceID: req.NodeId,
Region: d.Region,
}

_, err = d.CivoClient.AttachVolume(req.VolumeId, volConfig)
if err != nil {
log.Error().Err(err).Msg("Unable to attach volume in Civo API")
return nil, err
Expand Down
13 changes: 11 additions & 2 deletions pkg/driver/controller_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ func TestControllerUnpublishVolume(t *testing.T) {
})
assert.Nil(t, err)

_, err = d.CivoClient.AttachVolume(volume.ID, "instance-1")
volConfig := civogo.VolumeAttachConfig{
InstanceID: "instance-1",
Region: d.Region,
}

_, err = d.CivoClient.AttachVolume(volume.ID, volConfig)
assert.Nil(t, err)

_, err = d.ControllerUnpublishVolume(context.Background(), &csi.ControllerUnpublishVolumeRequest{
Expand All @@ -185,7 +190,11 @@ func TestControllerUnpublishVolume(t *testing.T) {
})
assert.Nil(t, err)

_, err = d.CivoClient.AttachVolume(volume.ID, "other-instance")
volConfig := civogo.VolumeAttachConfig{
InstanceID: "other-instance",
Region: d.Region,
}
_, err = d.CivoClient.AttachVolume(volume.ID, volConfig)
assert.Nil(t, err)

_, err = d.ControllerUnpublishVolume(context.Background(), &csi.ControllerUnpublishVolumeRequest{
Expand Down

0 comments on commit bbe7f3a

Please sign in to comment.