From f509ba21ce40bae66b1a91e763320f1d38bab9f5 Mon Sep 17 00:00:00 2001 From: Stanislav Kudriashev Date: Wed, 13 Nov 2013 14:44:35 +0200 Subject: [PATCH] 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 --- anvil/components/neutron.py | 18 ++++++++++++++++++ tools/configure-openvswitch.sh | 0 tools/install-neutron-ns-packages.sh | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) mode change 100644 => 100755 tools/configure-openvswitch.sh create mode 100755 tools/install-neutron-ns-packages.sh diff --git a/anvil/components/neutron.py b/anvil/components/neutron.py index 81a4771a..50eecf00 100644 --- a/anvil/components/neutron.py +++ b/anvil/components/neutron.py @@ -15,6 +15,7 @@ # under the License. from anvil import colorizer +from anvil import exceptions from anvil import log as logging from anvil import shell as sh @@ -45,6 +46,23 @@ class NeutronInstaller(binstall.PythonInstallComponent, NeutronPluginMixin): super(NeutronInstaller, self).__init__(*args, **kargs) 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): super(NeutronInstaller, self).post_install() if self.get_bool_option("db-sync"): diff --git a/tools/configure-openvswitch.sh b/tools/configure-openvswitch.sh old mode 100644 new mode 100755 diff --git a/tools/install-neutron-ns-packages.sh b/tools/install-neutron-ns-packages.sh new file mode 100755 index 00000000..9bc7dabf --- /dev/null +++ b/tools/install-neutron-ns-packages.sh @@ -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!"