[Libvir] [PATCH] parse URI once in src/libvirt.c, pass parsed URI to all drivers

Richard W.M. Jones rjones at redhat.com
Tue Oct 16 10:06:26 UTC 2007


The basic change here is that the virDrvOpen call (the internal "open" 
call for drivers) now takes the parsed xmlURIPtr instead of the raw name 
string.

  typedef virDrvOpenStatus
         (*virDrvOpen)           (virConnectPtr conn,
-                                const char *name,
+                     	         xmlURIPtr uri,
                                  int flags);

So we avoid the redundant URI parsing which was going on inside all the 
drivers, and also the ad-hoc "does-it-look-like-a-URI" string comparisons.

That's straightforward enough except that all of the drivers were saving 
the name string in their private data so that they could implement the 
virConnectGetURI call.  I've changed this so that the name is copied and 
saved in the main virConnect structure, and virConnectGetURI will return 
that unless the driver wants to override it.

You need another patch (coming shortly) to allow URIs like 
xen://localhost (without the trailing slash) to work, which was IIRC the 
original point of this discussion.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-driver-uri.patch
Type: text/x-patch
Size: 27288 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071016/a334a77a/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071016/a334a77a/attachment-0003.bin>


More information about the libvir-list mailing list