Allow more time for disk operations
Currently, when called to mount a disk, the driver does in quick succession:
- a disk detach (see #10 (closed));
- a disk attach;
lsblk /dev/xvdx1to see whether the disk already contains a filesystem.
I have seen an instance where 3. fails, even though 2. apparently succeeds. It's possible that we're going too fast, and that the instance kernel is not yet aware of the disk being attached.
Between 2. and 3. we should wait a while and/or check that the device file
If we don't remove step 1. altogether (see #10 (closed)), perhaps we should wait a second or two between 1. and 2. as well. We could theoretically even do a similar wait loop at that point to confirm that the device is no longer visible on the current instance (which would return immediately if the disk was actually previously attached to a different instance), but it's not straightforward to know which device to look for; you'd have to parse the new mountpoint to get the PV ID which is hidden in there, and check
/proc/mounts for any mounts containing that ID (if it's not already removed).