Adds Warning when NetworkManager is active on hosts

Fixes: rhbz#1117115
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
(cherry picked from commit 2faa9a2cb6)
(cherry picked from commit ff7caad9f1)

Conflicts:
	packstack/plugins/neutron_350.py

Change-Id: I7e0fed8b47dabb492f2f3e683f8e8d65497ad816
This commit is contained in:
Gael Chamoulaud
2014-07-15 22:31:11 +02:00
parent d49931d69e
commit e20697ba6c
2 changed files with 44 additions and 0 deletions

View File

@@ -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"

View File

@@ -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'))