Re: virsh "net-create" explanation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.12.2012 16:36, Bilal Ahmad wrote:
> Hi all, 
> 
> I am new to libvirt and started looking at the source code. While
> tracing back the virsh command "net-create", I got stuck into a loop and
> I would really like someone to explain how this works. 
> 
> In the virsh-network.c, from:
> 
> network = virNetworkCreateXML(ctl->conn, buffer); 
> 
> I traced back to: 
> 
> if (conn->networkDriver && conn->networkDriver->networkCreateXML) {
>         virNetworkPtr ret;
>         ret = conn->networkDriver->networkCreateXML(conn, xmlDesc);

Some hypervisors manage networks on their own (e.g. VBox) while others
rely on our bridge driver. Since we've switched to C99 struct initialization,
you can simply grep for networkCreateXML:

$ git grep networkCreateXML

and you'll see which functions implements the functionality:

[...]
src/network/bridge_driver.c:    .networkCreateXML = networkCreate, /* 0.2.0 */
src/remote/remote_driver.c:    .networkCreateXML = remoteNetworkCreateXML, /* 0.3.0 */
src/test/test_driver.c:    .networkCreateXML = testNetworkCreate, /* 0.3.2 */
src/vbox/vbox_tmpl.c:    .networkCreateXML       = vboxNetworkCreateXML, /* 0.6.4 */

And now you can look deeper into networkCreate(), testNetworkCreate() or vboxNetworkCreateXML().
You can repeat the process with other driver methods and drivers as well.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]