On Fri, Oct 16, 2020 at 10:23:18AM -0500, Eric Blake wrote:
A rather trivial decoding; we may enhance it further if qemu extends things to give an integer depth alongside its tri-state encoding. ---
I'll wait to push this to libnbd until the counterpart qemu patches land upstream, although it looks like I've got positive review.
info/nbdinfo.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 24ec129..1afdf98 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -780,6 +780,13 @@ extent_description (const char *metacontext, uint32_t type) case 1: return "dirty"; } } + else if (strcmp (metacontext, "qemu:allocation-depth") == 0) { + switch (type & 3) { + case 0: return "unallocated"; + case 1: return "local"; + case 2: return "backing"; + } + }
return NULL; /* Don't know - description field will be omitted. */ }
ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org