diff --git a/packstack/installer/output_messages.py b/packstack/installer/output_messages.py index 40daf6fef..cf6420398 100644 --- a/packstack/installer/output_messages.py +++ b/packstack/installer/output_messages.py @@ -55,6 +55,9 @@ INFO_CINDER_VOLUMES_EXISTS="Did not create a cinder volume group, one already ex INFO_REMOVE_REMOTE_VAR="Removing %s on %s (if it is a remote host)" WARN_WEAK_PASS="Warning: Weak Password." +WARN_NM_ENABLED=("Warning: NetworkManager is active on %s. OpenStack " + "networking currently does not work on systems that have " + "the Network Manager service enabled.") ERR_PING = "Error: the provided hostname is unreachable" ERR_SSH = "Error: could not connect to the ssh server: %s" diff --git a/packstack/plugins/neutron_350.py b/packstack/plugins/neutron_350.py index f00752a61..efd4b7e93 100644 --- a/packstack/plugins/neutron_350.py +++ b/packstack/plugins/neutron_350.py @@ -10,10 +10,13 @@ import re import uuid from packstack.installer import utils +from packstack.installer import exceptions from packstack.installer import validators from packstack.installer import processors +from packstack.installer import output_messages from packstack.installer.utils import split_hosts +from packstack.modules.common import filtered_hosts from packstack.modules.shortcuts import get_mq from packstack.modules.ospluginutils import (getManifestTemplate, appendManifestFile, @@ -602,6 +605,8 @@ def initSequences(controller): 'functions': [create_metering_agent_manifests]}, {'title': 'Adding Neutron Metadata Agent manifest entries', 'functions': [create_metadata_manifests]}, + {'title': 'Checking if NetworkManager is enabled and running', + 'functions': [check_nm_status]}, ] controller.addSequence("Installing OpenStack Neutron", [], [], neutron_steps) @@ -980,3 +985,39 @@ def create_metadata_manifests(config, messages): manifestdata = getManifestTemplate('neutron_metadata.pp') manifestfile = "%s_neutron.pp" % (host,) appendManifestFile(manifestfile, manifestdata + "\n") + + +def check_nm_status(config, messages): + hosts_with_nm = [] + for host in filtered_hosts(config): + server = utils.ScriptRunner(host) + server.append("systemctl") + rc, out = server.execute(can_fail=False) + server.clear() + + if rc < 1: + server.append("systemctl is-enabled NetworkManager") + rc, is_enabled = server.execute(can_fail=False) + is_enabled = is_enabled.strip("\n ") + server.clear() + + server.append("systemctl is-active NetworkManager") + rc, is_active = server.execute(can_fail=False) + is_active = is_active.strip("\n ") + + if is_enabled == "enabled" or is_active == "active": + hosts_with_nm.append(host) + else: + server.clear() + server.append("service NetworkManager status") + rc, out = server.execute(can_fail=False) + + if rc < 1: + hosts_with_nm.append(host) + + server.clear() + + if hosts_with_nm: + hosts_list = ', '.join("%s" % x for x in hosts_with_nm) + msg = output_messages.WARN_NM_ENABLED + messages.append(utils.color_text(msg % hosts_list, 'yellow'))