@@ -86,7 +86,7 @@ func (hp *hostPath) GetMetadataAllocated(req *csi.GetMetadataAllocatedRequest, s
86
86
if errors .Is (cbErr , io .EOF ) {
87
87
klog .V (4 ).Info ("reached EOF while getting allocated block metadata, returning" )
88
88
// send allocated blocks found till EOF
89
- if err := sendGetMetadataAllocatedResponse (stream , vol .VolSize , cb ); err != nil {
89
+ if err := sendGetMetadataAllocatedResponse (stream , vol .VolSize , hp . config . SnapshotMetadataBlockType , cb ); err != nil {
90
90
return err
91
91
}
92
92
return nil
@@ -95,7 +95,7 @@ func (hp *hostPath) GetMetadataAllocated(req *csi.GetMetadataAllocatedRequest, s
95
95
return status .Error (codes .Internal , "failed to get allocated block metadata" )
96
96
}
97
97
// stream response to client
98
- if err := sendGetMetadataAllocatedResponse (stream , vol .VolSize , cb ); err != nil {
98
+ if err := sendGetMetadataAllocatedResponse (stream , vol .VolSize , hp . config . SnapshotMetadataBlockType , cb ); err != nil {
99
99
return err
100
100
}
101
101
}
@@ -173,7 +173,7 @@ func (hp *hostPath) GetMetadataDelta(req *csi.GetMetadataDeltaRequest, stream cs
173
173
if errors .Is (cbErr , io .EOF ) {
174
174
klog .V (4 ).Info ("reached EOF while getting changed block metadata, returning" )
175
175
// send changed blocks found till EOF
176
- if err := sendGetMetadataDeltaResponse (stream , vol .VolSize , cb ); err != nil {
176
+ if err := sendGetMetadataDeltaResponse (stream , vol .VolSize , hp . config . SnapshotMetadataBlockType , cb ); err != nil {
177
177
return err
178
178
}
179
179
return nil
@@ -182,30 +182,40 @@ func (hp *hostPath) GetMetadataDelta(req *csi.GetMetadataDeltaRequest, stream cs
182
182
return status .Error (codes .Internal , "failed to get changed block metadata" )
183
183
}
184
184
// stream response to client
185
- if err := sendGetMetadataDeltaResponse (stream , vol .VolSize , cb ); err != nil {
185
+ if err := sendGetMetadataDeltaResponse (stream , vol .VolSize , hp . config . SnapshotMetadataBlockType , cb ); err != nil {
186
186
return err
187
187
}
188
188
}
189
189
}
190
190
191
- func sendGetMetadataDeltaResponse (stream csi.SnapshotMetadata_GetMetadataDeltaServer , volSize int64 , cb []* csi.BlockMetadata ) error {
191
+ func sendGetMetadataDeltaResponse (
192
+ stream csi.SnapshotMetadata_GetMetadataDeltaServer ,
193
+ volSize int64 ,
194
+ blockMetadataType csi.BlockMetadataType ,
195
+ cb []* csi.BlockMetadata ,
196
+ ) error {
192
197
if len (cb ) == 0 {
193
198
return nil
194
199
}
195
200
resp := csi.GetMetadataDeltaResponse {
196
- BlockMetadataType : csi . BlockMetadataType_FIXED_LENGTH ,
201
+ BlockMetadataType : blockMetadataType ,
197
202
VolumeCapacityBytes : volSize ,
198
203
BlockMetadata : cb ,
199
204
}
200
205
return stream .Send (& resp )
201
206
}
202
207
203
- func sendGetMetadataAllocatedResponse (stream csi.SnapshotMetadata_GetMetadataAllocatedServer , volSize int64 , cb []* csi.BlockMetadata ) error {
208
+ func sendGetMetadataAllocatedResponse (
209
+ stream csi.SnapshotMetadata_GetMetadataAllocatedServer ,
210
+ volSize int64 ,
211
+ blockMetadataType csi.BlockMetadataType ,
212
+ cb []* csi.BlockMetadata ,
213
+ ) error {
204
214
if len (cb ) == 0 {
205
215
return nil
206
216
}
207
217
resp := csi.GetMetadataAllocatedResponse {
208
- BlockMetadataType : csi . BlockMetadataType_FIXED_LENGTH ,
218
+ BlockMetadataType : blockMetadataType ,
209
219
VolumeCapacityBytes : volSize ,
210
220
BlockMetadata : cb ,
211
221
}
0 commit comments