[libvirt] Domain XML format using defined storage volume + RFC

Daniel P. Berrange berrange at redhat.com
Tue May 20 19:44:52 UTC 2008


On Mon, May 19, 2008 at 11:53:07PM +0200, Stefan de Konink wrote:
> Daniel P. Berrange schreef:
> >On Fri, May 16, 2008 at 01:00:16AM +0200, Stefan de Konink wrote:
> >
> >>+                        }
> >>+                    }
> >>+                }
> >>             } else if ((target == NULL) &&
> >>                        (xmlStrEqual(cur->name, BAD_CAST "target"))) {
> >>                 target = xmlGetProp(cur, BAD_CAST "dev");
> >>@@ -1411,7 +1426,8 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, 
> >>xmlNodePtr node,
> >>                 virBufferVSprintf(buf, "(uname 'phy:%s')", source);
> >>             else
> >>                 virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", source);
> >>-        }
> >>+        } else if (typ == 2)
> >>+            virBufferVSprintf(buf, "(uname 'phy:%s')", source);
> >
> >This is leaking the 'source' string, 
> 
> It is not leaking imho, since 'down under' there is an xmlFree(source).

Oh yes, you are correct.

> >and a volume can be either a file
> >or a physical device, so fixing it to be 'phy:' is not correct.
> 
> How can we know if the volume is a file or a device?

virStorageVolGetInfo() will tell you via the 'info' field of the struct
it fills
 
> >We also need to apply the reverse mapping when generating the XML. eg
> >do a virStorageVolLookupByPath() to discover the volume/pool. 
> 
> Mmm... that sounds not trivial... (I mean duplicate wise).

This is true - until we merge all the XML processing for drivers together
there will be a non-trivial bit of duplication

Dan.
-- 
|: Red Hat, Engineering, Boston   -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