hpe-storage / python-hpedockerplugin

HPE Native Docker Plugin
Apache License 2.0
36 stars 64 forks source link

Fix shared volume mount #673

Closed wdurairaj closed 5 years ago

wdurairaj commented 5 years ago

Analysis:

Etcd record
{"key":"/volumes/2a3f5cd7-c172-479f-a787-63126d94281b","value":"{\"id\": \"2a3f5cd7-c172-479f-a787-63126d94281b\", \"name\": \"2a3f5cd7-c172-479f-a787-63126d94281b\", \"3par_vol_name\": \"dcv-Kj9c18FyR5.nh2MSbZQoGw\", \"host\": \"\", \"size\": 1, \"availability_zone\": \"\", \"status\": \"\", \"attach_status\": \"\", \"display_name\": \"m_conf_delay_vol1\", \"volume_id\": \"\", \"volume_type\": null, \"volume_attachment\": null, \"provider_location\": null, \"path_info\": \"{\\\"name\\\": \\\"m_conf_delay_vol1\\\", \\\"path\\\": \\\"/dev/dm-3\\\", \\\"device_info\\\": {\\\"type\\\": \\\"block\\\", \\\"scsi_wwn\\\": \\\"360002ac00000000001008506000187b7\\\", \\\"multipath_id\\\": \\\"360002ac00000000001008506000187b7\\\", \\\"path\\\": \\\"/dev/disk/by-id/dm-uuid-mpath-360002ac00000000001008506000187b7\\\"}
path = /dev/dm-3
mount_dir = "/opt/hpe/data/hpedocker-dm-uuid-mpath-360002ac00000000001008506000187b7"

Now the code verifies like

# mount -l  > /tmp/mount_output.txt
# grep -E /dev/dm-3 /tmp/mount_output.txt | grep -E /opt/hpe/data/hpedocker-dm-uuid-mpath-360002ac00000000001008506000187b7

This command fails , due to absence of entry /dev/dm-3, since the mount output containing only a symlink to the actual /dev/dm-3 entry which was either /dev/mapper/360002ac00000000001008506000187b7 or /dev/disk/by-id/dm-uuid-mpath-360002ac00000000001008506000187b7