lxd
lxd copied to clipboard
Custom volume refresh only uses snapshot name for detecting differences in source/dest snapshots
Currently when doing lxc storage volume copy --refresh
the only thing used to decide if a snapshot should be synced from source to destination is the snapshot name. Unlike instance copy refresh that also uses snapshot creation date time (which is also flawed but less so).
This leads to a scenario where one can delete a snapshot that was previously copied to another volume and re-create it with the same name, and the new snapshot won't get copied on a subsequent --refresh
operation.
Whilst adding a creation date time to custom volume snapshots would allow us to improve the situation (by allowing us to notice if a snapshot is newer than the previously synced one), and it is something we should do for consistency with instance snapshots anyway, it is still not full-proof because in theory it is possible to have two source volumes with snapshots of the same name and creation date time and then syncing the first volume to the target and then subsequently doing a refresh using the other volume as a source to the same target wouldn't copy the different snapshot of same name and creation datetime, despite the contents being totally different.
What I think we need, for both instance snapshots (and associated volume snapshots) and custom volume snapshots is a snapshot UUID stored in the volume's config, that will allow us differentiate when a source snapshot is different from the current target snapshot.