From 8947ee3b317240faad7daa96027db46c779e467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Tue, 28 Jul 2015 16:12:46 +0200 Subject: [PATCH] Use dummy interface When using nova-network, dummy interface has to be used for Nova private interfaces, because otherwice 'lo' interface is being used. Using 'lo' is not requirement and it worked on older platform, but does not work on CentOS7 and newest Fedora releases during spawning instances following error appears: TRACE nova.openstack.common.threadgroup NovaException: Failed to add interface: can't add lo to bridge br100: Invalid argument Change-Id: Iea3cf2b0e85af642523154bed933f11d19650504 Resolves-bug: rhbz#1153128 Resolves-bug: #1376596 Resolves-bug: #1477681 --- packstack/installer/run_setup.py | 4 +-- packstack/plugins/nova_300.py | 47 ++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/packstack/installer/run_setup.py b/packstack/installer/run_setup.py index cb373d0ab..ed9fd61a7 100644 --- a/packstack/installer/run_setup.py +++ b/packstack/installer/run_setup.py @@ -748,9 +748,9 @@ def single_step_aio_install(options, logFile): if not options.novanetwork_pubif: options.novanetwork_pubif = utils.device_from_ip(options.install_hosts) if not options.novacompute_privif: - options.novacompute_privif = "lo" + options.novacompute_privif = '' if not options.novanetwork_privif: - options.novanetwork_privif = "lo" + options.novanetwork_privif = '' # If we are doing an all-in-one install, do demo provisioning # unless specifically told not to diff --git a/packstack/plugins/nova_300.py b/packstack/plugins/nova_300.py index 82e5fafe3..6e0ce29ce 100644 --- a/packstack/plugins/nova_300.py +++ b/packstack/plugins/nova_300.py @@ -164,8 +164,8 @@ def initConfig(controller): "PROMPT": ("Enter the Private interface for Flat DHCP on the Nova" " compute servers"), "OPTION_LIST": [], - "VALIDATORS": [validators.validate_not_empty], - "DEFAULT_VALUE": secondary_netif, + "VALIDATORS": [], + "DEFAULT_VALUE": '', "MASK_INPUT": False, "LOOSE_VALIDATION": True, "CONF_NAME": "CONFIG_NOVA_COMPUTE_PRIVIF", @@ -201,8 +201,8 @@ def initConfig(controller): "PROMPT": ("Enter the Private interface for network manager on " "the Nova network server"), "OPTION_LIST": [], - "VALIDATORS": [validators.validate_not_empty], - "DEFAULT_VALUE": secondary_netif, + "VALIDATORS": [], + "DEFAULT_VALUE": '', "MASK_INPUT": False, "LOOSE_VALIDATION": True, "CONF_NAME": "CONFIG_NOVA_NETWORK_PRIVIF", @@ -402,6 +402,36 @@ def bring_up_ifcfg(host, device): raise ScriptRuntimeError(msg) +def dummy_interface(host): + """Creates dummy interface on given hosts. + + Returns interface name. + """ + # Only single dummy interface will be created, hence the name is hardcoded + ifname = 'dummy' + script = ( + 'DEVICE={0}\n' + 'BOOTPROTO=none\n' + 'ONBOOT=yes\n' + 'TYPE=Ethernet\n' + 'NM_CONTROLLED=no\n'.format(ifname) + ) + server = utils.ScriptRunner(host) + server.append( + 'ip link show {ifname} || (' + 'modprobe dummy && ' + 'ip link set name {ifname} dev dummy0 && ' + 'ip link set dev dummy address 06:66:DE:AF:66:60' + ')'.format(**locals()) + ) + server.append( + 'cat > /etc/sysconfig/network-scripts/ifcfg-{ifname} ' + '<