Bug 529817

Summary: RFE: virsh: add options for machine readable output
Product: [Community] Virtualization Tools Reporter: Alexander Todorov <atodorov>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: berrange, crobinso, mkletzan, phrdina, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-21 06:48:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 636082    

Description Alexander Todorov 2009-10-20 08:49:04 UTC
Description of problem:
Virsh does not produce machine readable output for other tools/applications to consume. A --colon or --csv switch will solve the issue. For example some lvm tools(lvdisplay) separate output by colon while other tools use the csv option. 

IRC quote:
(11,41,45) rjones: atodorov, definitely I agree with you ... in the virt tools I write, I'm using the --csv option to generate CSV output (eg. see virt-df)

Looks like --csv is preferred to make it consistent across all tools. 

Version-Release number of selected component (if applicable):
libvirt-0.6.3-20.el5 (but the RFE is valid for all later vesions)

How reproducible:
Always

Additional info:
I'm personally interested in the virsh list command because I'm using bash but this RFE should be implemented for all commands if possible.

Comment 1 Daniel Veillard 2009-10-20 14:14:59 UTC
just a note that "for all commands if possible" won't be possible for XML dump
commands. --csv patches welcome they should just be sent upstream to 
  libvir-list

Daniel

Comment 2 Pavel Hrdina 2016-03-21 06:48:08 UTC
I don't think that virsh is a correct tool to do that.  Virsh is a CLI for users, not for programs and if someone wants to use libvirt in his program, he should use one of our API.  For scripting probably the best one is libvirt-python.