[libvirt] [PATCH 2/3]: Fix storage_conf parsing for empty <source>
Daniel P. Berrange
berrange at redhat.com
Fri Sep 19 09:24:16 UTC 2008
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 at 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 :|
More information about the libvir-list
mailing list