@usrflo thank you so much for sharing this!
My two cents:
This assumes that the “backup” container was originally imported using lxc export --optimized-storage
at the origin ( with a subsequent lxc import ...
at destination ), and that the incremental deltas are sent via zfs send | zfs recv
; the script tries to go through the list of the new snapshots at destination, and to lxd sql
add them to the “global” database, if they are missing.
PS. I definitely wouldn’t call it production quality, more like a (working) proof of concept thing.
One thing it misses in this version is that it uses the present date as a stub, when in fact it shall get the snapshot date from zfs
properties, and convert it to an sqlite
timestamp.
Not too hard to add, but at the moment I’m more concerned about the fragility of the whole lxd sql
approach, as I mentioned here.