On 03/11/2009 09:55 AM, Daniel P. Berrange wrote:
- Application connects to libvirt (virConnectOpen() - in src/libvirt.c we activate a hypervisor driver based on the URI given. If successful, we then try to activate a number of secondary drivers (eg virtual network, storage, node device) - in src/libvirt.c, virConenctPtr is populted with callbacks for each of the activated drivers Now.... - Application calls virNetworkCreateXML() - in src/libvirt.c, this runs virNetworkCreateXML code - this uses the networkDriver callback sets, invoking the networkCreateXML() callback, eg conn->networkDriver->networkCreateXML() For something like the network driver, in the application process the driver that's activated will be the generic remote driver. - So, networkCreateXML() is pointing to remoteNetworkCreateXML() in src/remote_driver.c - remoteNetworkCreateXML() now serializes the parameters into XDR format, and makes an RPC call REMOTE_PROC_NETWORK_CREATE_XML
I had figured out everything up to here with no problems...
The RPC calls are handling by the libvirtd daemon. - libvirtd gets REMOTE_PROC_NETWORK_CREATE_XML and dispatches it to remoteDispatchNetworkCreateXML() in qemud/remote.c
This is where I got stuck. As DV says, the dispatch table is generated, and doesn't reference the enum value directly (it's just implied via the index into the table). Also, the name of the remoteDispatchxxx function is generated, and the way that it's generated causes "XML" to be "Xml".
Anyway, thanks to both of you for filling in the missing links. I think I understand how it works now!
- libvirtd itself uses libvirt.so, so it once against calls into the public API virNetworkCreateXML() as the application did much earlier. - in src/libvirt.c, this runs virNetworkCreateXML code - this uses the networkDriver callback sets, invoking the networkCreateXML() callback, eg conn->networkDriver->networkCreateXML() When run inside libvirtd though, libvirt.so does not activate the 'remote' driver. Instead it activates the real driver, in this case provided by src/network_driver.c - So, networkCreateXML() is pointing to networkCreate() in src/network_driver.c - networkCreate() finally does whatever interesting stuff needs to be done to complete the operation. Summarizing app -> libvirt.so -> remote driver -> XDR ->... ... TCP socket ... ... XDR -> libvirtd -> libvirt.so -> network driver Daniel
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list