diff --git a/devstack/files/hooks/qemu.py b/devstack/files/hooks/qemu.py index 2e21d7e12c..872d5e1014 100755 --- a/devstack/files/hooks/qemu.py +++ b/devstack/files/hooks/qemu.py @@ -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