Patchwork [2/3] qapi: Add ImageInfo.

login
register
mail settings
Submitter Benoit Canet
Date Aug. 15, 2012, 2:54 p.m.
Message ID <1345042466-31743-3-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/177685/
State New
Headers show

Comments

Benoit Canet - Aug. 15, 2012, 2:54 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 qapi-schema.json |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
Eric Blake - Aug. 15, 2012, 4:17 p.m.
On 08/15/2012 08:54 AM, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  qapi-schema.json |   33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 8d4df19..488da90 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -150,6 +150,39 @@
>              'vm-clock-sec': 'int' } }
>  
>  ##
> +# @ImageInfo:
> +#
> +# Information about a QEMU image file
> +#
> +# @filename: name of the image file
> +#
> +# @format: format of the image file
> +#
> +# @dirty-flag: true if image is not cleanly closed
> +#
> +# @cluster-size: size of a cluster in bytes
> +#
> +# @encrypted: true if the image is encrypted
> +#
> +# @actual-size: actual size on disk in bytes of the image
> +#
> +# @virtual-size: maximum capacity in bytes of the image
> +#
> +# @backing-filename: name of the backing file

Should this be #optional, in the case where there is no backing file?

Missing @backing-filename-format, when that is recorded (as long as
we're going for machine-parseable, print everything useful, even if
qemu-img info doesn't print it right now).  Definitely #optional, since
it won't be present when @backing-filename is missing, and even when a
backing file name is present, the format might not have been recorded.

> +#
> +# @snapshots: list of VM snapshots

Should this be #optional, in the case where there are no snapshots?

> +#
> +# Since: 1.3

So no way it will make 1.2 hard freeze today :)
Benoît Canet - Aug. 15, 2012, 4:49 p.m.
> > +#
> > +# Since: 1.3
> 
> So no way it will make 1.2 hard freeze today :)

I would like to.Just tell me if it would be possible :)

> 
> -- 
> Eric Blake   eblake@redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
Eric Blake - Aug. 15, 2012, 5:47 p.m.
On 08/15/2012 10:17 AM, Eric Blake wrote:
> On 08/15/2012 08:54 AM, Benoît Canet wrote:
>> Signed-off-by: Benoit Canet <benoit@irqsave.net>
>> ---
>>  qapi-schema.json |   33 +++++++++++++++++++++++++++++++++
>>  1 file changed, 33 insertions(+)

>> +# @ImageInfo:
>> +#
>> +# Information about a QEMU image file
>> +#
>> +# @filename: name of the image file
>> +#
>> +# @format: format of the image file

These always exist.

>> +#
>> +# @dirty-flag: true if image is not cleanly closed

This exists for QED and qcow2v3, but not for raw or qcow2 without v3
extensions, so probably worth marking #optional

>> +#
>> +# @cluster-size: size of a cluster in bytes

This exists for qcow2, but not for raw, so probably worth marking #optional

>> +#
>> +# @encrypted: true if the image is encrypted

Again, probably #optional

>> +#
>> +# @actual-size: actual size on disk in bytes of the image

Always exists.  But is this the size of the contents seen by the guest,
or the size of the metadata seen by the host?  Both numbers are useful.

>> +#
>> +# @virtual-size: maximum capacity in bytes of the image

Tough call.  For qcow2, this would be read from the metadata.  For raw,
do we list the current size of the file, or do we list the size of free
space on the file system containing the file, or do we omit it for raw?

>> +#
>> +# @backing-filename: name of the backing file
> 
> Should this be #optional, in the case where there is no backing file?
> 
> Missing @backing-filename-format, when that is recorded (as long as
> we're going for machine-parseable, print everything useful, even if
> qemu-img info doesn't print it right now).  Definitely #optional, since
> it won't be present when @backing-filename is missing, and even when a
> backing file name is present, the format might not have been recorded.
> 
>> +#
>> +# @snapshots: list of VM snapshots
> 
> Should this be #optional, in the case where there are no snapshots?
> 
>> +#
>> +# Since: 1.3
> 
> So no way it will make 1.2 hard freeze today :)

Actually, I'd like to see this in 1.2, if we can muster up enough other
reviewers.

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index 8d4df19..488da90 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -150,6 +150,39 @@ 
             'vm-clock-sec': 'int' } }
 
 ##
+# @ImageInfo:
+#
+# Information about a QEMU image file
+#
+# @filename: name of the image file
+#
+# @format: format of the image file
+#
+# @dirty-flag: true if image is not cleanly closed
+#
+# @cluster-size: size of a cluster in bytes
+#
+# @encrypted: true if the image is encrypted
+#
+# @actual-size: actual size on disk in bytes of the image
+#
+# @virtual-size: maximum capacity in bytes of the image
+#
+# @backing-filename: name of the backing file
+#
+# @snapshots: list of VM snapshots
+#
+# Since: 1.3
+#
+##
+
+{ 'type': 'ImageInfo',
+  'data': {'filename': 'str', 'format': 'str', 'dirty-flag': 'bool',
+           'cluster-size': 'int', 'encrypted': 'bool',
+           'actual-size': 'int', 'virtual-size': 'int',
+           'backing-filename': 'str', 'snapshots': ['SnapshotInfo'] } }
+
+##
 # @StatusInfo:
 #
 # Information about VCPU run state