]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virStorageSource: note that capacity/allocation/physical are stale caches
authorDenis V. Lunev <den@openvz.org>
Mon, 11 May 2026 21:55:24 +0000 (23:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 May 2026 11:39:23 +0000 (13:39 +0200)
These three fields are cached values that do not reflect reality unless
the caller refreshes them. 'allocation' is in addition ultra-unreliable:
any guest write into a previously unallocated part of a sparse image
invalidates it, even right after a refresh.

Document this on the struct so new callers do not trust the values.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/storage_source_conf.h

index 5ddcebb282d9bd6bf0f15ee217acfab8a4e34fe5..fa71a9ef394d56e828f11a3166a88010ecaccf3c 100644 (file)
@@ -326,6 +326,8 @@ struct _virStorageSource {
 
     virStoragePerms *perms;
     virStorageTimestamps *timestamps;
+
+    /* Cached, unreliable. Refresh before use. */
     unsigned long long capacity; /* in bytes, 0 if unknown */
     unsigned long long allocation; /* in bytes, 0 if unknown */
     unsigned long long physical; /* in bytes, 0 if unknown */