From 2e70895e71e59477ba01f607712b796784232b0a Mon Sep 17 00:00:00 2001 From: Anton Myagkov Date: Wed, 2 Oct 2024 10:15:18 +0000 Subject: [PATCH] fix: NodeExpandVolume --- .../tools/csi_driver/internal/driver/node.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cloud/blockstore/tools/csi_driver/internal/driver/node.go b/cloud/blockstore/tools/csi_driver/internal/driver/node.go index b312e6566b..058c07019a 100644 --- a/cloud/blockstore/tools/csi_driver/internal/driver/node.go +++ b/cloud/blockstore/tools/csi_driver/internal/driver/node.go @@ -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{}, @@ -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 } }