The attached patch improves error handling in the XM config file
parser (src/conf.c).
Currently it has a custom error function called virConfError which has
three problems. Firstly the conf argument is ignored and therefore
pointless to even pass. Secondly the function takes a line number
parameter (for reporting the line number where parsing failed), but
this is swallowed and not printed in error messages. Thirdly, and
most importantly, the name of the file where the error occurs is not
printed by default unless the caller happens to print it.
If there is an _empty_ file in /etc/xen we get this error:
# virsh list --all
libvir: error : failed to read configuration file /etc/xen/foobar
but if the spurious file under /etc/xen is non-empty, like a script,
you get completely anonymous errors such as:
libvir: error : configuration file syntax error: expecting an assignment
or:
libvir: error : configuration file syntax error: expecting a value
The patch fixes this by printing out the filename and line number if
these are available from the parser context (and the parser context is
passed to virConfError instead of the unused virConfPtr). With this
patch you'll get errors for the second case like this:
# virsh list --inactive
libvir: error : /etc/xen/foobar:1: expecting a value
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/