Skip to contentSkip to conversation

RFC: making QMP query-block more useful

Qemu-devel Eric Blake 3 participants 3 messages Oct 5, 2012 – Oct 9, 2012

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

Right now, 'query-block' has no way to filter to a single device, but conversely, for each device, it shows only the first backing file, rather than the entire backing chain. Jeff and I were lamenting this fact on IRC while debugging his block-commit stuff.

Would it be worth enhancing the QMP to be:

##
# @query-block:
#
# Get a list of BlockInfo for various virtual block devices. #
# @devices: #optional If provided, limit the output to the given
# device names (since 1.3)
#
# @recurse: #optional Provide recursive information on any backing
# chains (since 1.3, default false)
#
# Returns: a list of @BlockInfo describing each virtual block device #
# Since: 0.14.0
##
{ 'command': 'query-block',
'arguments': { '*names': ['str'], 'recurse': 'bool' }, 'returns': ['BlockInfo'] }

as well as enhancing BlockDeviceInfo to be self-recursive, by adding backing_chain as in:

# @backing_chain: #optional, only present if @backing_file is present and 'query-block' requested recursion (since 1.3)

{ 'type': 'BlockDeviceInfo',
'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str',

            '*backing_file': 'str', 'backing_file_depth': 'int',
            '*backing_chain' : 'BlockDeviceInfo',
            'encrypted': 'bool', 'encryption_key_missing': 'bool',
            'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
            'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} }

Or would such modifications require the creation of a new QMP command, instead of altering 'query-block'?

Likewise, can 'qemu-img info' be enhanced to add a recursion flag?

Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#1 lore raw
Quoted 34 lines · Eric Blake

Right now, 'query-block' has no way to filter to a single device, but conversely, for each device, it shows only the first backing file, rather than the entire backing chain. Jeff and I were lamenting this fact on IRC while debugging his block-commit stuff.

Would it be worth enhancing the QMP to be:

##
# @query-block:
#
# Get a list of BlockInfo for various virtual block devices. #
# @devices: #optional If provided, limit the output to the given
# device names (since 1.3)
#
# @recurse: #optional Provide recursive information on any backing
# chains (since 1.3, default false)
#
# Returns: a list of @BlockInfo describing each virtual block device #
# Since: 0.14.0
##
{ 'command': 'query-block',
'arguments': { '*names': ['str'], 'recurse': 'bool' }, 'returns': ['BlockInfo'] }

as well as enhancing BlockDeviceInfo to be self-recursive, by adding backing_chain as in:

# @backing_chain: #optional, only present if @backing_file is present and 'query-block' requested recursion (since 1.3)

{ 'type': 'BlockDeviceInfo',
'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str',

Quoted 8 lines
            '*backing_file': 'str', 'backing_file_depth': 'int',
            '*backing_chain' : 'BlockDeviceInfo',
            'encrypted': 'bool', 'encryption_key_missing': 'bool',
            'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
            'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} }

Or would such modifications require the creation of a new QMP command, instead of altering 'query-block'?

I think I'd probably go for creating a new command myself. I agree that both the changes you describe would be useful for libvirt needs.

Quoted 1 line

Likewise, can 'qemu-img info' be enhanced to add a recursion flag?

Sounds like a good idea.

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#2 lore raw
Quoted 41 lines · On Mon, 8 Oct 2012 12:02:12 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 40 lines · Eric Blake

Right now, 'query-block' has no way to filter to a single device, but conversely, for each device, it shows only the first backing file, rather than the entire backing chain. Jeff and I were lamenting this fact on IRC while debugging his block-commit stuff.

Would it be worth enhancing the QMP to be:

##
# @query-block:
#
# Get a list of BlockInfo for various virtual block devices. #
# @devices: #optional If provided, limit the output to the given
# device names (since 1.3)
#
# @recurse: #optional Provide recursive information on any backing
# chains (since 1.3, default false)
#
# Returns: a list of @BlockInfo describing each virtual block device #
# Since: 0.14.0
##
{ 'command': 'query-block',
'arguments': { '*names': ['str'], 'recurse': 'bool' }, 'returns': ['BlockInfo'] }

as well as enhancing BlockDeviceInfo to be self-recursive, by adding backing_chain as in:

# @backing_chain: #optional, only present if @backing_file is present and 'query-block' requested recursion (since 1.3)

{ 'type': 'BlockDeviceInfo',
'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str',

            '*backing_file': 'str', 'backing_file_depth': 'int',
            '*backing_chain' : 'BlockDeviceInfo',
            'encrypted': 'bool', 'encryption_key_missing': 'bool',
            'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
            'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} }
Quoted 5 lines
Quoted 2 lines

Or would such modifications require the creation of a new QMP command, instead of altering 'query-block'?

I think I'd probably go for creating a new command myself. I agree that both the changes you describe would be useful for libvirt needs.

I vote for a new command too.