Snapshot size (usage) in API

I’m researching LXDs snapshot implementation on Ceph RBD (again) and I’m running into a few complications that I hope I can potentially solve.

Since snapshots are behaving like normal volumes it would be good to be able to get the current size out of the API. I couldn’t find a way to do that currently. I understand that thanks to the whole COW it might be tricky to calculate this exactly based on the underlying storage engine. Although Ceph with it’s rbd du can be quite specific.

NAME                                                          PROVISIONED  USED
custom_default_5fc89aead1e4024716cdd31e-media@snapshot_snap0       93 GiB  25 GiB
custom_default_5fc89aead1e4024716cdd31e-media                      93 GiB  24 MiB
<TOTAL>                                                            93 GiB  25 GiB

I would love to implement some of this stuff if nobody is working on it yet but I’m honestly not quite sure how. Where in the API would this attribute make the most sense? And if it makes sense at all which value would we get? Would we just take the value and show it for the volume we are snapshotting? With the diff on the snapshot itself? Or do we show it exactly as, in this instance, rbd show it to us?

Any guidance would be appreciated.

https://github.com/lxc/lxd/issues/7708 should cover that I think?

Hah, that’s perfect. I will see if I can help/take-over there :slight_smile: