@@ -638,12 +638,12 @@ func (p *Plugin) nodeExpandVolume(
638638 devicePath := publishInfo .DevicePath
639639 if convert .ToBool (publishInfo .LUKSEncryption ) {
640640 if ! luks .IsLegacyDevicePath (devicePath ) {
641- devicePath , err = p .devices .GetLUKSDevicePathForVolume ( ctx , volumeId )
641+ devicePath , err = p .devices .GetLUKSDeviceForMultipathDevice ( devicePath )
642642 if err != nil {
643643 Logc (ctx ).WithFields (LogFields {
644644 "volumeId" : volumeId ,
645645 "publishedPath" : publishInfo .DevicePath ,
646- }).WithError (err ).Error ("Failed to get LUKS device path for volume ." )
646+ }).WithError (err ).Error ("Failed to get LUKS device path from device path ." )
647647 return status .Error (codes .Internal , err .Error ())
648648 }
649649 }
@@ -1465,18 +1465,15 @@ func (p *Plugin) nodeUnstageFCPVolume(
14651465 publishInfo .DevicePath = dmPath
14661466 }
14671467 } else {
1468- // If not using luks legacy device path we need to find the LUKS mapper device.
1469- luksMapperPath , err = p .devices .GetLUKSDevicePathForVolume ( ctx , req . GetVolumeId () )
1468+ // If not using LUKS legacy device path, we need to find the LUKS mapper device.
1469+ luksMapperPath , err = p .devices .GetLUKSDeviceForMultipathDevice ( publishInfo . DevicePath )
14701470 if err != nil {
1471- // If the LUKS device is not found, the functional difference is negligible to unstage.
1472- // But it may be useful to log at different levels for observability.
1473- log := Logc (ctx ).WithFields (fields ).WithError (err )
1474- if errors .IsNotFoundError (err ) {
1475- log .Warn ("Failed to get LUKS device path for volume." )
1476- } else {
1477- log .Debug ("Could not determine LUKS device path for volume." )
1471+ if ! errors .IsNotFoundError (err ) {
1472+ Logc (ctx ).WithFields (fields ).WithError (err ).Warn (
1473+ "Could not determine LUKS device path from multipath device. " +
1474+ "Continuing with device removal." )
14781475 }
1479- log . Debug ( "Continuing with device removal ." )
1476+ Logc ( ctx ). WithFields ( fields ). Info ( "No LUKS device path found from multipath device ." )
14801477 }
14811478 }
14821479 err = p .devices .EnsureLUKSDeviceClosedWithMaxWaitLimit (ctx , luksMapperPath )
@@ -1519,10 +1516,11 @@ func (p *Plugin) nodeUnstageFCPVolume(
15191516 "multipathDevice" : deviceInfo .MultipathDevice ,
15201517 }
15211518
1522- luksMapperPath , err = p .devices .GetLUKSDevicePathForVolume ( ctx , req . GetVolumeId () )
1519+ luksMapperPath , err = p .devices .GetLUKSDeviceForMultipathDevice ( deviceInfo . MultipathDevice )
15231520 if err != nil {
15241521 if ! errors .IsNotFoundError (err ) {
1525- Logc (ctx ).WithFields (fields ).WithError (err ).Error ("Failed to get LUKS device path from multipath device." )
1522+ Logc (ctx ).WithFields (fields ).
1523+ WithError (err ).Error ("Failed to get LUKS device path from multipath device." )
15261524 return err
15271525 }
15281526 Logc (ctx ).WithFields (fields ).Info ("No LUKS device path found from multipath device." )
@@ -1971,7 +1969,7 @@ func (p *Plugin) nodeUnstageISCSIVolume(
19711969 if convert .ToBool (publishInfo .LUKSEncryption ) {
19721970 var err error
19731971 var luksMapperPath string
1974- fields := LogFields {"device" : publishInfo .DevicePath , "volume" : req . GetVolumeId () }
1972+ fields := LogFields {"device" : publishInfo .DevicePath }
19751973 // Set device path to dm device to correctly verify legacy volumes.
19761974 if luks .IsLegacyDevicePath (publishInfo .DevicePath ) {
19771975 luksMapperPath = publishInfo .DevicePath
@@ -1985,22 +1983,17 @@ func (p *Plugin) nodeUnstageISCSIVolume(
19851983 publishInfo .DevicePath = dmPath
19861984 }
19871985 } else {
1988- // Use the volume ID to get the LUKS mapper path.
1989- // This should always work if the mapper is still present.
1990- luksMapperPath , err = p .devices .GetLUKSDevicePathForVolume (ctx , req .GetVolumeId ())
1986+ // If not using LUKS legacy device path, we need to find the LUKS mapper device.
1987+ luksMapperPath , err = p .devices .GetLUKSDeviceForMultipathDevice (publishInfo .DevicePath )
19911988 if err != nil {
1992- // If the LUKS device is not found, the functional difference is negligible to unstage.
1993- // But it may be useful to log at different levels for observability.
1994- log := Logc (ctx ).WithFields (fields ).WithError (err )
1995- if errors .IsNotFoundError (err ) {
1996- log .Warn ("Failed to get LUKS device path for volume." )
1997- } else {
1998- log .Debug ("Could not determine LUKS device path for volume." )
1989+ if ! errors .IsNotFoundError (err ) {
1990+ Logc (ctx ).WithFields (fields ).WithError (err ).Warn (
1991+ "Could not determine LUKS device path from multipath device. " +
1992+ "Continuing with device removal." )
19991993 }
2000- log . Debug ( "Continuing with device removal ." )
1994+ Logc ( ctx ). WithFields ( fields ). Info ( "No LUKS device path found from multipath device ." )
20011995 }
20021996 }
2003-
20041997 err = p .devices .EnsureLUKSDeviceClosedWithMaxWaitLimit (ctx , luksMapperPath )
20051998 if err != nil {
20061999 Logc (ctx ).WithError (err ).Debug ("Unable to remove LUKS device. Continuing with tracking file removal." )
@@ -2051,7 +2044,7 @@ func (p *Plugin) nodeUnstageISCSIVolume(
20512044 "multipathDevice" : deviceInfo .MultipathDevice ,
20522045 }
20532046
2054- luksMapperPath , err = p .devices .GetLUKSDevicePathForVolume ( ctx , req . GetVolumeId () )
2047+ luksMapperPath , err = p .devices .GetLUKSDeviceForMultipathDevice ( deviceInfo . MultipathDevice )
20552048 if err != nil {
20562049 if ! errors .IsNotFoundError (err ) {
20572050 Logc (ctx ).WithFields (fields ).WithError (err ).Error ("Failed to get LUKS device path from multipath device." )
@@ -3063,19 +3056,14 @@ func (p *Plugin) nodeUnstageNVMeVolume(
30633056 "publishedPath" : publishInfo .DevicePath ,
30643057 }
30653058
3066- // Use the volume ID to get the LUKS mapper path.
3067- // This should always work if the mapper is still present.
3068- luksMapperPath , err = p .devices .GetLUKSDevicePathForVolume (ctx , req .GetVolumeId ())
3059+ luksMapperPath , err = p .devices .GetLUKSDevicePathForDevicePath (ctx , devicePath )
30693060 if err != nil {
3070- // If the LUKS device is not found, the functional difference is negligible to unstage.
3071- // But it may be useful to log at different levels for observability.
3072- log := Logc (ctx ).WithFields (fields ).WithError (err )
3073- if errors .IsNotFoundError (err ) {
3074- log .Warn ("Failed to get LUKS device path for volume." )
3075- } else {
3076- log .Debug ("Could not determine LUKS device path for volume." )
3061+ if ! errors .IsNotFoundError (err ) {
3062+ Logc (ctx ).WithFields (fields ).WithError (err ).Error ("Failed to get LUKS device path from device path." )
3063+ return & csi.NodeUnstageVolumeResponse {}, err
30773064 }
3078- log .Debug ("Continuing with device removal." )
3065+ Logc (ctx ).WithFields (fields ).WithError (err ).Debug ("Failed to get LUKS device path from device path. " +
3066+ "Device may already be removed." )
30793067 }
30803068
30813069 if luksMapperPath != "" {
0 commit comments