IBM / ubiquity

Ubiquity
Apache License 2.0
90 stars 26 forks source link

Feature/ub 1941 unmount fix #298

Closed 27149chen closed 5 years ago

27149chen commented 5 years ago

Description of the issue There is an issue with the new rescan method introduced in PR https://github.com/IBM/ubiquity/pull/294 that the unmount didn't clean up the physical devices. More detail : In the new cleanup proceduce, we get the multipath devices belonging to the same volume from multipath -ll output, but it happens in ActionAfterDetach, before that, a multipath -f is called, which will remove the volume record from the multipath -ll output. So that we can't get what we want, and the command "echo 1 > /sys/block/sdx/device/delete" won't be called. It will lead to stale info (stale paths in /dev/disk/by-path/) on host.

Description of the optimal solution - will not done in this PR Change the order of the flex unmount as follow:

  1. multipath -f
  2. echo 1 > /sys/block/sdx/device/delete
  3. unmap

rescan or cleanup in ActionAfterDetach doesn't help much.

Description of the solution But reordering the steps is a big change, will do it in next release. For the current release, I'll use a local cache to store the informations required in the cleanup phase(vol wwn\lun\multipath device and list of physical devices), so that we can cleanup the paths even if it is not in the multipath -ll output.

Detail about the cache The cache is a "map[volumeWWn]*VolumeMountProperties" (in fact it is a sync.Map, which is like a Go map[interface{}]interface{} but is safe for concurrent use by multiple goroutines without additional locking or coordination).Each key-value stands for a volume which is mounted to the current host by flex. The value VolumeMountProperties is a struct which has 4 attributes: WWN, LunNUbmer, DeviceMapper("mpthx"), Devices (["sda", "sdb", ...]) and stands for a multipath device and all its paths.


This change is Reviewable

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 66.484% when pulling 82e54ee39a2571e5d5b0d9efe415a61c51eaca76 on feature/UB-1941_unmount_fix into 91b55dc79980d23ad6668457a0002c956f3591c8 on dev.

shay-berman commented 5 years ago

@27149chen opened up PR #299 with improved solution based on the comments. So this PR was closed and a new one opened https://github.com/IBM/ubiquity/pull/299.