I am trying to create libvirt VMs using the foreman with openvswitch interfaces.
To start a VM with an interface on br1 (the ovs bridge), you have to specify the line
virtualport type=‘openvswitch’
Currently - this is not an option that I am able to set from the foreman UI, and the VM’s XML file needs to be manually edited.
Is there a way to do this programmatically?
Problem:
Create VM’s with
virtualport type=‘openvswitch’
line in the VM’s XML definition file.
Expected outcome:
Foreman and Proxy versions:
Version 3.9.1
Foreman and Proxy plugin versions:
Version
3.9.1
Active features
ACD
Ansible
DHCP
DNS
Dynflow
Logs
Openscap
Pulpcore
Puppet
Puppet CA
Realm
Script
TFTP
Distribution and version:
RHEL 8
Other relevant data:
ikonia
August 9, 2024, 9:15pm
2
if you define the interface in libvirt, when you provision the guest the network the interfaces tab will have ‘interface type’ and ‘network’ as an option when you set the ‘deploy on’ option to a libvirt host.
I do this currently myself, although I use a bridge device rather than an open switch.
Yes I am doing the same thing currently.
However - for VxLAN over Open vSwitch there is an extra line that needs to be added to the VM’s XML file.
This is the Standard Port Type
<interface type='bridge'>
<mac address='52:54:00:0d:39:1a'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
This is the OpenvSwitch Port
<interface type='bridge'>
<mac address='52:54:00:63:14:9c'/>
<source bridge='br1'/>
<virtualport type='openvswitch' /> ** Note the Extra Line here
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x0b' slot='0x00' function='0x0'/>
</interface>
Currently I am having to manually edit the XML file to get the VM to boot with an OVS Bridge.
Figured this one out.
Created a new Network in LibVirt with the OVS-Bridge as the source network. Now when I provision I can specify the OVS VXLAN network via the Foreman UI and it provisions the VM correctly.
1 Like
ikonia
August 24, 2024, 4:21pm
5
how does the OVS bridge present itself to foreman, just a bridge interface in the drop down like a standard bridge ?
Here is what I did.
On My host - I created a new Network and used the Bridge that I created using OpenvSwitch (br1) as the source bridge. XML Below:
ovs-network.xml
<network>
<name>ovs-vxlan-10</name>
<uuid>8641bc18-364e-4580-abea-0638402e0f5c</uuid>
<forward mode='bridge'/>
<bridge name='br1'/>
<virtualport type='openvswitch'/>
</network>
Then run virsh commands to define the network in QEMU and start up the network.
Once the network is recognized in Libvirt it shows up in Foreman as a Virtual (NAT) Network in the Interfaces tab during provisioning.
Now anytime I provision a guest VM with this network it is automatically configured with the correct “virtualport type” flag on the XML File.