Making externally created zfs snapshots known to lxc?

is there any way to make an externally created zfs snapshot (e.g. with sanoid or znapzend or manually) visible in lxc info or available to lxc copy etc?

I’d like to use a bit more sofisticated snapshotting policy than currently possible through snapshots.schedule, but it would be nice to still have them easily accessible through the API/lxc cmdline.

Not easily, you’d need to inject the matching DB records for the volume snapshot, the instance snapshot and a copy of all the instance config and devices at the time of the snapshot.

Could you use your custom snapshot policy to execute lxc snapshot <instance> <snapshot name> when needed with the chosen snapshot name, rather than take the storage snapshots directly?

I could, of course, but that woud mean I have to write everything from scratch and not reuse already debugged solutions. But I guess I will have to, I thought adding a snapshot was just a line in a database but wasn’t thinking that the config also needs to be stored, which makes “registering” snapshots independently of making them not really terribly robust, as I would have to guess what the config was at the time.

What I need is nothing terribly complicated, I just want a standard backup setup: keep x dailies, y weeklies, z monthlies and so on. Maybe extending snapshot.schedule to include a pattern and expiry per schedule would suffice for most people, I already see that I’m not the only one, see for example: Snapshots.schedule