[libvirt] virStoragePoolDefParseString() fails with the following pool xml

Sharadha Prabhakar (3P) sharadha.prabhakar at citrix.com
Fri Mar 19 11:49:34 UTC 2010


I just added target path to pool XML. It doesn't resolve the issue.
virStoragePoolDefParseString() returns NULL.

-----Original Message-----
From: Daniel P. Berrange [mailto:berrange at redhat.com] 
Sent: 19 March 2010 11:16
To: Sharadha Prabhakar (3P)
Cc: libvir-list at redhat.com
Subject: Re: [libvirt] virStoragePoolDefParseString() fails with the following pool xml

On Fri, Mar 19, 2010 at 10:37:15AM +0000, Sharadha Prabhakar (3P) wrote:
> Hi,
> I have the following Pool XML 
> 
> <pool type='netfs'>
>   <name>NFS ISO library</name>
>   <uuid>6142b786-378d-9def-bc96-2d0dc0466c13</uuid>
>   <capacity>838729728</capacity>
>   <allocation>838729728</allocation>
>   <available>148315040</available>
>   <source>
>     <host name='telos'/>
>     <dir path='/images/autoinstall'/>
>     <format type='auto'/>
>   </source>
>   <target>
>     <permissions>
>       <mode>00</mode>
>       <owner>0</owner>
>       <group>0</group>
>     </permissions>
>   </target>
> </pool>
> 
> I'm passing this string to virStoragePoolDefParseString() to get a virStoragePoolDefPtr
> But it returns NULL. Can anyone explain if there's something wrong with the XML format?
> I ran gdb and I kind of figured out that it fails at
> if (virStoragePoolDefParseSource(ctxt, &ret->source, ret->type,
>                                          source_node) < 0) in virStoragePoolDefParseXML()
> in ~/src/conf/storage_conf.c

I think you've got the wrong place here. If I feed your XML to 'virsh pool-define'
using the QEMU driver, then I get


error: XML description for missing storage pool target path is not well formed or invalid


which is from

 static virStoragePoolDefPtr
 virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {

    ....

    if ((ret->target.path = virXPathString("string(./target/path)", ctxt)) == NULL) {
        virStorageReportError(VIR_ERR_XML_ERROR,
                              "%s", _("missing storage pool target path"));
        goto cleanup;
    }


You need to add at least  <target>/</target>  as we previously discussed


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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