From 6fa583381ecd97f3703532d75879841a57070e8f Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanino Date: Wed, 17 Jan 2018 10:18:51 -0500 Subject: [PATCH] Update comments for getting and removing loopback device at iSCSI,FC,RBD This PR add comments for the background why plugin gets loopback device and removes loopback device even if operation_generator has same functionality. --- pkg/volume/fc/fc_util.go | 5 +++++ pkg/volume/iscsi/iscsi_util.go | 8 ++++++-- pkg/volume/rbd/rbd.go | 6 ++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/volume/fc/fc_util.go b/pkg/volume/fc/fc_util.go index 050989d353f..5c13c2cad8f 100644 --- a/pkg/volume/fc/fc_util.go +++ b/pkg/volume/fc/fc_util.go @@ -348,6 +348,11 @@ func (util *FCUtil) DetachBlockFCDisk(c fcDiskUnmapper, mapPath, devicePath stri glog.V(4).Infof("fc: find destination device path from symlink: %v", dstPath) // Get loopback device which takes fd lock for device beofore detaching a volume from node. + // TODO: This is a workaround for issue #54108 + // Currently local attach plugins such as FC, iSCSI, RBD can't obtain devicePath during + // GenerateUnmapDeviceFunc() in operation_generator. As a result, these plugins fail to get + // and remove loopback device then it will be remained on kubelet node. To avoid the problem, + // local attach plugins needs to remove loopback device during TearDownDevice(). var devices []string blkUtil := volumeutil.NewBlockVolumePathHandler() dm := c.deviceUtil.FindMultipathDeviceForDevice(dstPath) diff --git a/pkg/volume/iscsi/iscsi_util.go b/pkg/volume/iscsi/iscsi_util.go index b42ca1e5b4c..cfecfe57f84 100644 --- a/pkg/volume/iscsi/iscsi_util.go +++ b/pkg/volume/iscsi/iscsi_util.go @@ -512,8 +512,12 @@ func (util *ISCSIUtil) DetachBlockISCSIDisk(c iscsiDiskUnmapper, mapPath string) if mappedDevicePath := c.deviceUtil.FindMultipathDeviceForDevice(devicePath); mappedDevicePath != "" { devicePath = mappedDevicePath } - // Get loopback device which takes fd lock for devicePath before - // detaching a volume from node. + // Get loopback device which takes fd lock for devicePath before detaching a volume from node. + // TODO: This is a workaround for issue #54108 + // Currently local attach plugins such as FC, iSCSI, RBD can't obtain devicePath during + // GenerateUnmapDeviceFunc() in operation_generator. As a result, these plugins fail to get + // and remove loopback device then it will be remained on kubelet node. To avoid the problem, + // local attach plugins needs to remove loopback device during TearDownDevice(). blkUtil := volumeutil.NewBlockVolumePathHandler() loop, err := volumeutil.BlockVolumePathHandler.GetLoopDevice(blkUtil, devicePath) if err != nil { diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index 12c2898e3d1..51e102054e7 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -921,6 +921,12 @@ func (rbd *rbdDiskUnmapper) TearDownDevice(mapPath, _ string) error { if err != nil { return fmt.Errorf("rbd: failed to get loopback for device: %v, err: %v", device, err) } + // Get loopback device which takes fd lock for device beofore detaching a volume from node. + // TODO: This is a workaround for issue #54108 + // Currently local attach plugins such as FC, iSCSI, RBD can't obtain devicePath during + // GenerateUnmapDeviceFunc() in operation_generator. As a result, these plugins fail to get + // and remove loopback device then it will be remained on kubelet node. To avoid the problem, + // local attach plugins needs to remove loopback device during TearDownDevice(). blkUtil := volutil.NewBlockVolumePathHandler() loop, err := volutil.BlockVolumePathHandler.GetLoopDevice(blkUtil, device) if err != nil {