Check if network namespaces are supported

Make sure that network namespaces are supported when
installing neutron componented and use_namespaces
option is enabled. Otherwise, raise install exception.

Change-Id: I19e7e3276f99db685f3406c1924722255bf174f8
This commit is contained in:
Stanislav Kudriashev 2013-11-13 14:44:35 +02:00
parent 93049be89d
commit f509ba21ce
3 changed files with 34 additions and 0 deletions

View File

@ -15,6 +15,7 @@
# under the License. # under the License.
from anvil import colorizer from anvil import colorizer
from anvil import exceptions
from anvil import log as logging from anvil import log as logging
from anvil import shell as sh from anvil import shell as sh
@ -45,6 +46,23 @@ class NeutronInstaller(binstall.PythonInstallComponent, NeutronPluginMixin):
super(NeutronInstaller, self).__init__(*args, **kargs) super(NeutronInstaller, self).__init__(*args, **kargs)
self.configurator = qconf.NeutronConfigurator(self) self.configurator = qconf.NeutronConfigurator(self)
def pre_install(self):
# Check if network namespaces are supported.
if self.get_option("use_namespaces", default_value=True):
try:
# "ip netns" command is used for network namespace management.
# We are trying to execute this command and if it was executed
# successfully then network namespaces support is enabled.
sh.execute(["ip", "netns"])
except exceptions.ProcessExecutionError:
raise exceptions.InstallException(
"Network namespaces are not supported in your system. "
"Please, install kernel and iproute with network "
"namespaces support. To install them from RDO you can "
"use the following script: "
"./tools/install-neutron-ns-packages.sh")
super(NeutronInstaller, self).pre_install()
def post_install(self): def post_install(self):
super(NeutronInstaller, self).post_install() super(NeutronInstaller, self).post_install()
if self.get_bool_option("db-sync"): if self.get_bool_option("db-sync"):

0
tools/configure-openvswitch.sh Normal file → Executable file
View File

View File

@ -0,0 +1,16 @@
#!/bin/bash
# This script is used to install 'kernel' and 'iproute'
# with network namespaces support for openstack-neutron
# from RDO havana repository.
set -e
echo "Adding RDO havana repo..."
sudo rpm -i --force http://rdo.fedorapeople.org/openstack-havana/rdo-release-havana.rpm
sudo yum clean all
echo "Installing 'kernel' and 'iproute' from RDO..."
sudo yum install -y kernel iproute
echo "Kernel updated. Please, reboot into it!"