
Am I the only one who finds the default behaviour of virsh list really confusing and annoying? That is, I would like --all to be the default. regards john

On Mon, Mar 03, 2008 at 09:09:49PM +0000, John Levon wrote:
Am I the only one who finds the default behaviour of virsh list really confusing and annoying? That is, I would like --all to be the default.
Me too, but can we change it without breaking scripts or similar? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

On Mon, Mar 03, 2008 at 09:44:31PM +0000, Richard W.M. Jones wrote:
Am I the only one who finds the default behaviour of virsh list really confusing and annoying? That is, I would like --all to be the default.
Me too, but can we change it without breaking scripts or similar?
Well, you've hit upon a good question here. Is virsh interactive, or scriptable? Within Sun we generally attempt to clearly delineate these things, precisely for reasons like the above. 'virsh list' would have grown a '-p' option, that printed a machine-parsable output. That way, you can change the human output as needed (for example, you can translate 'blocked' into $LANG). Anyway, in this case, I think fixing up virsh list would be less pain than leaving it. Anything that's trying to parse human-readable output needs to be written carefully. For example, I don't think you'd have the same objection to adding a field to 'vcpuinfo', but that's just as likely to break scripts. I'm happy to hear contradictory opinions :) In the longer term it would be good to make sure all new commands have the above considerations when reviewing the visible CLI. Perhaps we can go back and add -p options to things as appropriate too. regards john

On Mon, Mar 03, 2008 at 10:31:56PM +0000, John Levon wrote:
On Mon, Mar 03, 2008 at 09:44:31PM +0000, Richard W.M. Jones wrote:
Am I the only one who finds the default behaviour of virsh list really confusing and annoying? That is, I would like --all to be the default.
Me too, but can we change it without breaking scripts or similar?
Well, you've hit upon a good question here. Is virsh interactive, or scriptable? Within Sun we generally attempt to clearly delineate these things, precisely for reasons like the above.
well to me clearly it was designed to be both, clearly it's intended to be interactive since we link with libhistory if found, and also the command parsing infrastructure was designed so that any command can also be used as separated executions.
'virsh list' would have grown a '-p' option, that printed a machine-parsable output. That way, you can change the human output as needed (for example, you can translate 'blocked' into $LANG).
Hum, I don't think there is anything preventing adding such an option
Anyway, in this case, I think fixing up virsh list would be less pain than leaving it. Anything that's trying to parse human-readable output needs to be written carefully. For example, I don't think you'd have the same objection to adding a field to 'vcpuinfo', but that's just as likely to break scripts. I'm happy to hear contradictory opinions :)
Disagreed, adding a field at the end probably won't break most scripts using sed/awk to extract data, but showing stopped machines will. But we can add a 'virsh show' command doing a complete listing, then it's just a matter of rerouting a few synapses, easier done than changing running code ;-)
In the longer term it would be good to make sure all new commands have the above considerations when reviewing the visible CLI. Perhaps we can go back and add -p options to things as appropriate too.
Definitely ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Mar 04, 2008 at 01:19:48AM -0500, Daniel Veillard wrote:
Well, you've hit upon a good question here. Is virsh interactive, or scriptable? Within Sun we generally attempt to clearly delineate these things, precisely for reasons like the above.
well to me clearly it was designed to be both, clearly it's intended to
This is almost always a bad idea IMHO.
Disagreed, adding a field at the end probably won't break most scripts using sed/awk to extract data, but showing stopped machines will. But we can add a 'virsh show' command doing a complete listing, then it's just a matter of rerouting a few synapses, easier done than changing running code ;-)
virsh show doesn't help at all, as it's not any easier to remember than '--all'. The whole problem is that it's non-obvious (and completely different to xm) that the list doesn't include non-running domains. regards, john
participants (3)
-
Daniel Veillard
-
John Levon
-
Richard W.M. Jones