[libvirt] [PATCH] qemu: Refactor parsing of block device IO tuning parameters.

Jiri Denemark jdenemar at redhat.com
Thu Aug 9 09:39:57 UTC 2012


On Thu, Aug 09, 2012 at 10:48:42 +0200, Peter Krempa wrote:
> This patch refactors the JSON parsing function that extracts the block
> IO tuning parameters from qemu's output. The most impacting change
> concerns the error message that is returned if the reply from qemu does
> not contain the needed data. The data for IO parameter tuning were added
> in qemu 1.1 and the previous error message was confusing.
> 
> This patch also breaks long lines and extracts a multiple time used code
> pattern to a macro.
> ---
> Old error message looks like:
> # virsh blkdeviotune asdf hda
> error: Unable to get block I/O throttle parameters
> error: internal error cannot read total_bytes_sec
> 
> and the new:
> # virsh blkdeviotune asdf hda
> error: Unable to get block I/O throttle parameters
> error: internal error block_io_throttle field 'total_bytes_sec' missing in qemu's output

I think the old/new error messages can be included directly in the commit
message. Anyway, I wonder if we should take this as an opportunity to fix the
"internal error", however I'm not sure what is the best code to use. It seems
we use OPERATION_INVALID in such cases, which could be good enough.

ACK

Jirka




More information about the libvir-list mailing list