This post is about setting up VDE network between qemu machines through a F2F job. Tools I used are dpipe, vde_switch, vde_plug, nc, everything wrapped into python code that is in turn called from F2F job.
- IPx - machine
- Sx - vde_switch Network layout: star-topology - central node is master VM, all slave nodes are connected to its switch using their switches. Master virtual machine configuration: provide IP addresses on VDE. Slave virtual machine configuration: acquire IP from master VM.
F2F job Idea The F2F job defines two possible roles for a host - master or slave. In a master role the host launches master virtual machine which serves as a dhcp server for the VDE network. In a slave role the host launches the slave virtual machine which acquires its IP from master VM and joins VDE network. I chose to use a separate vde_switch in front of each VM regardless of it being a master or slave VM to achieve uniform configuration layout across the network (machine-switch; switch-switch).
VM configuration F2F job handles distributing configuration parameters for virtual machines. An unique id is assigned to each of the slave hosts based on the order of joining the group and in turn each of the slaves configure necessary parameters for launching and connecting the VM. Each slave node needs to know ip and port for VDE switch and ID for calculating unique MAC for the VM. On the host of the master VM there is set up also a listening socket for each slave VM which is in turn connected to master switch.
Finally I want to add some bits I learned about scaling the VDE network using dhcp. In this post the VDE network consists of a single master machine and several slave machines. Because of the boot times for multiple slave machines are different (MAC-s are assigned in random order) then it is tedious to describe all possible situations for interface names in slave's /etc/network/interfaces because by default udev writes rules for MAC-ethX associations. What I did was that I reconfigured udev to forget MAC addresses for certain MAC ranges. It already had rules for not remembering interfaces for virtual machines (wild-card MAC ranges) but they are overridden by the rules for some generic cards (Realtek, etc) which still force them to be written out. After commenting out rules for generic cards, udev didn't remember any MAC-ethX associations and interfaces configuration file for slave machine could be written in a very minimal manner.
Sample F2F job and helper code can be found here and can be run using the code from f2f-mobile branch (usual configuration).