csi: fix volume registration error (#26642)

This commit is contained in:
Michael Smithhisler
2025-08-27 15:00:16 -04:00
committed by GitHub
parent 5f34867420
commit 485356c3d3
6 changed files with 12 additions and 4 deletions

3
.changelog/26642.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
csi: fix EOF error when registering volumes
```

View File

@@ -503,6 +503,7 @@ type CSIVolumeRegisterRequest struct {
type CSIVolumeRegisterResponse struct {
Volumes []*CSIVolume
Warnings string
QueryMeta
}
type CSIVolumeDeregisterRequest struct {

View File

@@ -146,7 +146,7 @@ func (s *HTTPServer) csiVolumeRegister(resp http.ResponseWriter, req *http.Reque
setMeta(resp, &out.QueryMeta)
return nil, nil
return out, nil
}
func (s *HTTPServer) csiVolumeCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error) {

View File

@@ -35,9 +35,11 @@ func (c *VolumeRegisterCommand) csiRegister(client *api.Client, ast *ast.File, o
fmt.Sprintf("[bold][yellow]Volume Warnings:\n%s[reset]\n", resp.Warnings)))
}
vol = resp.Volumes[0] // note: the command only ever returns 1 volume from the API
for _, vol := range resp.Volumes {
// note: the command only ever returns 1 volume from the API
c.Ui.Output(fmt.Sprintf("Volume %q registered", vol.ID))
}
return 0
}

View File

@@ -371,6 +371,7 @@ func (v *CSIVolume) Register(args *structs.CSIVolumeRegisterRequest, reply *stru
return err
}
reply.Volumes = args.Volumes
reply.Index = index
v.srv.setQueryMeta(&reply.QueryMeta)
return nil

View File

@@ -879,9 +879,10 @@ type CSIVolumeRegisterRequest struct {
}
type CSIVolumeRegisterResponse struct {
Volumes []*CSIVolume
// Warnings are non-fatal messages from Enterprise policy enforcement
Warnings string
QueryMeta
}