CSI: fix decoding error on snapshot create
Consumers of the CSI HTTP API are expecting a response object and not a slice of snapshots. Fix the return value.
This commit is contained in:
parent
d2e479505c
commit
8af5bd1ad4
|
@ -115,13 +115,13 @@ func (v *CSIVolumes) Detach(volID, nodeID string, w *WriteOptions) error {
|
|||
}
|
||||
|
||||
// CreateSnapshot snapshots an external storage volume.
|
||||
func (v *CSIVolumes) CreateSnapshot(snap *CSISnapshot, w *WriteOptions) ([]*CSISnapshot, *WriteMeta, error) {
|
||||
func (v *CSIVolumes) CreateSnapshot(snap *CSISnapshot, w *WriteOptions) (*CSISnapshotCreateResponse, *WriteMeta, error) {
|
||||
req := &CSISnapshotCreateRequest{
|
||||
Snapshots: []*CSISnapshot{snap},
|
||||
}
|
||||
resp := &CSISnapshotCreateResponse{}
|
||||
meta, err := v.client.write("/v1/volumes/snapshot", req, resp, w)
|
||||
return resp.Snapshots, meta, err
|
||||
return resp, meta, err
|
||||
}
|
||||
|
||||
// DeleteSnapshot deletes an external storage volume snapshot.
|
||||
|
|
|
@ -292,7 +292,7 @@ func (s *HTTPServer) csiSnapshotCreate(resp http.ResponseWriter, req *http.Reque
|
|||
}
|
||||
|
||||
setMeta(resp, &out.QueryMeta)
|
||||
return out.Snapshots, nil
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (s *HTTPServer) csiSnapshotDelete(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
||||
|
|
|
@ -106,6 +106,6 @@ func (c *VolumeSnapshotCreateCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
c.Ui.Output(csiFormatSnapshots(snaps, verbose))
|
||||
c.Ui.Output(csiFormatSnapshots(snaps.Snapshots, verbose))
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -115,13 +115,13 @@ func (v *CSIVolumes) Detach(volID, nodeID string, w *WriteOptions) error {
|
|||
}
|
||||
|
||||
// CreateSnapshot snapshots an external storage volume.
|
||||
func (v *CSIVolumes) CreateSnapshot(snap *CSISnapshot, w *WriteOptions) ([]*CSISnapshot, *WriteMeta, error) {
|
||||
func (v *CSIVolumes) CreateSnapshot(snap *CSISnapshot, w *WriteOptions) (*CSISnapshotCreateResponse, *WriteMeta, error) {
|
||||
req := &CSISnapshotCreateRequest{
|
||||
Snapshots: []*CSISnapshot{snap},
|
||||
}
|
||||
resp := &CSISnapshotCreateResponse{}
|
||||
meta, err := v.client.write("/v1/volumes/snapshot", req, resp, w)
|
||||
return resp.Snapshots, meta, err
|
||||
return resp, meta, err
|
||||
}
|
||||
|
||||
// DeleteSnapshot deletes an external storage volume snapshot.
|
||||
|
|
Loading…
Reference in New Issue