Skip to content

Commit

Permalink
fix: NodeExpandVolume
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmyagkov committed Oct 2, 2024
1 parent 2ad8e33 commit 2e70895
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cloud/blockstore/tools/csi_driver/internal/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,11 @@ func (s *nodeService) NodeExpandVolume(
return nil, err
}

endpointDir := s.getEndpointDir(podId, req.VolumeId)
unixSocketPath := filepath.Join(endpointDir, nbsSocketName)
endpointDirOld := s.getEndpointDir(podId, req.VolumeId)
unixSocketPathOld := filepath.Join(endpointDirOld, nbsSocketName)

endpointDirNew := s.getEndpointDir(s.nodeID, req.VolumeId)
unixSocketPathNew := filepath.Join(endpointDirNew, nbsSocketName)

listEndpointsResp, err := s.nbsClient.ListEndpoints(
ctx, &nbsapi.TListEndpointsRequest{},
Expand All @@ -1235,9 +1238,17 @@ func (s *nodeService) NodeExpandVolume(
}

nbdDevicePath := ""
unixSocketPath := ""
for _, endpoint := range listEndpointsResp.Endpoints {
if endpoint.UnixSocketPath == unixSocketPath {
if endpoint.UnixSocketPath == unixSocketPathOld {
nbdDevicePath = endpoint.GetNbdDeviceFile()
unixSocketPath = unixSocketPathOld
break
}

if endpoint.UnixSocketPath == unixSocketPathNew {
nbdDevicePath = endpoint.GetNbdDeviceFile()
unixSocketPath = unixSocketPathNew
break
}
}
Expand Down

0 comments on commit 2e70895

Please sign in to comment.