[libvirt] [PATCH 2/3]: Fix storage_conf parsing for empty <source>

This patch fixes a minor bug in the storage_conf parsing. Creating logical volume pool XML without a source definition is a valid operation (for example, if you just want to scan an already existing LVM group), but this bug was making the parser reject that XML. Bugfix from Dan Berrange, tested by me. Signed-off-by: Chris Lalancette <clalance@redhat.com>

On Fri, Sep 19, 2008 at 10:36:40AM +0200, Chris Lalancette wrote:
This patch fixes a minor bug in the storage_conf parsing. Creating logical volume pool XML without a source definition is a valid operation (for example, if you just want to scan an already existing LVM group), but this bug was making the parser reject that XML. Bugfix from Dan Berrange, tested by me.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Index: src/storage_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_conf.c,v retrieving revision 1.14 diff -u -r1.14 storage_conf.c --- a/src/storage_conf.c 5 Sep 2008 12:03:45 -0000 1.14 +++ b/src/storage_conf.c 19 Sep 2008 08:18:41 -0000 @@ -295,7 +295,7 @@ xmlNodePtr *nodeset = NULL; int nsource, i;
- if ((nsource = virXPathNodeSet(conn, "/pool/source/device", ctxt, &nodeset)) <= 0) { + if ((nsource = virXPathNodeSet(conn, "/pool/source/device", ctxt, &nodeset)) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s", _("cannot extract storage pool source devices")); goto cleanup;
ACK, I even re-factored virXPathNodeSet to allow it to return 0 - previously it would not, but somehow I lost this bit here. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Sep 19, 2008 at 10:36:40AM +0200, Chris Lalancette wrote:
This patch fixes a minor bug in the storage_conf parsing. Creating logical volume pool XML without a source definition is a valid operation (for example, if you just want to scan an already existing LVM group), but this bug was making the parser reject that XML. Bugfix from Dan Berrange, tested by me.
+1. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

On Fri, Sep 19, 2008 at 11:17:09AM +0100, Richard W.M. Jones wrote:
On Fri, Sep 19, 2008 at 10:36:40AM +0200, Chris Lalancette wrote:
This patch fixes a minor bug in the storage_conf parsing. Creating logical volume pool XML without a source definition is a valid operation (for example, if you just want to scan an already existing LVM group), but this bug was making the parser reject that XML. Bugfix from Dan Berrange, tested by me.
Makes sense, so applied and commited, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (4)
-
Chris Lalancette
-
Daniel P. Berrange
-
Daniel Veillard
-
Richard W.M. Jones