diff --git a/api/csi.go b/api/csi.go index c9b0ea744..fd7c6679c 100644 --- a/api/csi.go +++ b/api/csi.go @@ -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. diff --git a/command/agent/csi_endpoint.go b/command/agent/csi_endpoint.go index c352a825e..658d53f59 100644 --- a/command/agent/csi_endpoint.go +++ b/command/agent/csi_endpoint.go @@ -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) { diff --git a/command/volume_snapshot_create.go b/command/volume_snapshot_create.go index 3499c91c0..4fcfdcd73 100644 --- a/command/volume_snapshot_create.go +++ b/command/volume_snapshot_create.go @@ -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 } diff --git a/vendor/github.com/hashicorp/nomad/api/csi.go b/vendor/github.com/hashicorp/nomad/api/csi.go index c9b0ea744..fd7c6679c 100644 --- a/vendor/github.com/hashicorp/nomad/api/csi.go +++ b/vendor/github.com/hashicorp/nomad/api/csi.go @@ -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.