Re: [PATCH v3 08/18] blockjob: add new --raw flag to virsh blockjob

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/31/14 06:02, Eric Blake wrote:
> The current output of 'blockjob [--info]' is a single line
> designed for human consumption; it's not very nice for machine
> parsing.  Furthermore, I have plans to modify the line in
> response to the new flag for controlling bandwidth units.
> Solve that by adding a --raw parameter, which outputs
> information closer to the C struct.
> 
> $ virsh blockjob testvm1 vda --raw
>  type=Block Copy
>  bandwidth=1
>  cur=197120
>  end=197120
> 
> The information is indented, because I'd like for a later patch
> to add a mode that iterates over all the vm's disks with status
> for each; in that mode, each block name would be listed unindented
> before information (if any) about that block.
> 
> Now that we have a raw mode, we can guarantee that it won't change
> format over time.  Any app that cares about parsing the output can
> try --raw, and if it fails, know that it was talking to an older
> virsh and fall back to parsing the human-readable format which had
> not changed until now; meanwhile, when not using --raw, we have
> freed future virsh to change the output to whatever makes sense.
> 
> My first change to human mode: this command now guarantees a line
> is printed on successful use of the API, even when the API did
> not find a current block job (consistent with the rest of virsh).
> 
> Bonus: https://bugzilla.redhat.com/show_bug.cgi?id=1135441
> complained that this message was confusing:
> 
> $ virsh blockjob test1 hda  --async --bandwidth 10
> error: conflict between --abort, --info, and --bandwidth modes
> 
> even though the man page already documents that --async implies
> abort mode, all because '--abort' wasn't present in the command
> line.  Since I'm adding another case where options are tied
> to or imply a mode, I changed that error to:
> 
> error: conflict between abort, info, and bandwidth modes
> 
> * tools/virsh-domain.c (cmdBlockJob): Add --raw parameter; tweak
> error wording.
> * tools/virsh.pod (blockjob): Document it.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  tools/virsh-domain.c | 31 +++++++++++++++++++++++--------
>  tools/virsh.pod      | 19 ++++++++++++-------
>  2 files changed, 35 insertions(+), 15 deletions(-)
> 

ACK,

Peter


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]