Update qemu hook to facilitate Multicast

mdns AND IPv6 Neighbour Discovery Protocol use multicast packets
and the macvtap interface drops these packets by default.

Since there is no way to tell libvirt to make this better,
lets at least use the hook to make the macvtap interface
change such that multicast packets will pass.

With this, iPXE should work... and mdns should be testable in CI.

Change-Id: I397d211675fd7668b8fd19e989d740d6bad2c70e
This commit is contained in:
Julia Kreger 2019-06-13 19:29:21 +00:00
parent a3b875ab23
commit c59dc1386f

View File

@ -17,8 +17,10 @@
import datetime
import os
import re
import subprocess
import sys
# This script is run as a libvirt hook.
# More information here: https://libvirt.org/hooks.html
@ -42,6 +44,18 @@ def main():
guest_name = sys.argv[1]
action = sys.argv[2]
if action == "started":
interfaces = str(
subprocess.check_output(
['ip', 'link', 'show', 'type', 'macvtap']
)).split("\n")
for iface_line in interfaces:
if 'macvtap' in iface_line:
iface_string = iface_line.split('@')
ifaces = iface_string[0].split(' ')
subprocess.call(['ip', 'link', 'set', 'dev', ifaces[1],
'multicast', 'on', 'allmulticast', 'on'])
if action != "release":
return