Change:
<!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . --Is this a BUG REPORT or FEATURE REQUEST?: /kind bug What happened: When user uses fc volume plugin, device file on operating system such as /dev/sdX remains after deleting a Pod. After deleting the Pod, PVC and PV, cluster admin or external-provisioner might delete the disk from the storage, therefore the block device on the worker node should be cleaned up. The photon volume plugin already has this functionality in the removeFromScsiSubsystem(). Also the gce volume plugin has similar functionality in the udevadmChangeToDrive() too. photon: echo 1 /sys/block/<dev name/device/delete gce: udevadm trigger --action=change --property-match=DEVNAME=%s Also os-brick library in the OpenStack Cinder component uses same way with photon driver. What you expected to happen: The device file on operating system such as /dev/sdX will be cleaned up after deleting PVs. Environment: Kubernetes version (use ):Cloud provider or hardware configuration**: KVM OS (e.g. from /etc/os-release): Fedora 25 Kernel (e.g. ):Install tools: local-up- Others:
There are no sig labels on this issue. Please by: a sig: e.g., to notify the contributor experience sig, OR the label manually: e.g., to apply the label Note: Method 1 will trigger an email to the group. You can find the group list and label list . The in the method 1 has to be replaced with one of these: bugs, feature-requests, pr-reviews, test-failures, proposals
/sig storage
I'll work on this.
Reiterating the mentions to trigger a notification: <detailsIn response to : I'll work on this. Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details

Discussion:
} func (detacher *fcDetacher) UnmountDevice(deviceMountPath string) error { <del> return volumeutil.UnmountPath(deviceMountPath, detacher.mounter) </del> <ins> // Specify device name for DetachDisk later devName, _, err := mount.GetDeviceNameFromMount(detacher.mounter, deviceMountPath) if err != nil { glog.Errorf("fc: failed to get device from mnt: %snError: %v", deviceMountPath, err) return err } // Unmount for deviceMountPath(=globalPDPath) err = volumeutil.UnmountPath(deviceMountPath, detacher.mounter) if err != nil { return fmt.Errorf("fc: failed to unmount: %snError: %v", deviceMountPath, err) } unMounter := volumeSpecToUnmounter(detacher.mounter) err = detacher.manager.DetachDisk(*unMounter, devName) if err != nil { return fmt.Errorf("fc: failed to detach disk: %snError: %v", devName, err) } glog.V(4).Infof("fc: successfully detached disk: %s", devName) return nil </ins> } func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost) (*fcDiskMounter, error) {

mounter:  &mount.SafeFormatAndMount{Interface: host.GetMounter(), Runner: exec.New()}, }, nil } <ins> func volumeSpecToUnmounter(mounter mount.Interface) *fcDiskUnmounter { return &fcDiskUnmounter{ fcDisk: &fcDisk{ io: &osIOHandler{}, }, mounter: mounter, } } </ins>

// Attaches the disk to the kubelet's host machine. AttachDisk(b fcDiskMounter) (string, error) // Detaches the disk from the kubelet's host machine. <del> DetachDisk(disk fcDiskUnmounter, mntPath string) error </del> <ins> DetachDisk(disk fcDiskUnmounter, devName string) error </ins> } // utility to mount a disk based filesystem

return "", "" } <ins> // Removes a scsi device based upon /dev/sdX name func removeFromScsiSubsystem(deviceName string, io ioHandler) { fileName := "/sys/block/" + deviceName + "/device/delete" glog.V(4).Infof("fc: remove device from scsi-subsystem: path: %s", fileName) data := []byte("1") io.WriteFile(fileName, data, 0666) } </ins> // rescan scsi bus func scsiHostRescan(io ioHandler) { scsi_path := "/sys/class/scsi_host/"

return devicePath, err } <del> func (util *FCUtil) DetachDisk(c fcDiskUnmounter, mntPath string) error { if err := c.mounter.Unmount(mntPath); err != nil { return fmt.Errorf("fc detach disk: failed to unmount: %snError: %v", mntPath, err) </del> <ins> func (util *FCUtil) DetachDisk(c fcDiskUnmounter, devName string) error { // Remove scsi device from the node. if !strings.HasPrefix(devName, "/dev/") { return fmt.Errorf("fc detach disk: invalid device name: %s", devName) </ins> } <ins> arr := strings.Split(devName, "/") dev := arr[len(arr)-1] removeFromScsiSubsystem(dev, c.io) </ins> return nil }