]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Skip keepalived_respawns test
authorArie Bregman <abregman@redhat.com>
Tue, 1 Dec 2015 07:47:55 +0000 (09:47 +0200)
committerArie Bregman <abregman@redhat.com>
Tue, 8 Dec 2015 17:34:00 +0000 (19:34 +0200)
keepalived fails to respawn after crash for > 1.2.11 version.

When keepalived starts, it spawns vrrp thread to monitor vrrp forked
process. It also creates a vrrp pid file. When the process is killed, and
it's restarted, the the new keepalived process runs with -P, so
when we validate whether we are already running,  we check vrrp pid file.
Since we never clean up the file before starting the process, and the process
dies without a chance to clean up the file as part of its signal
handler, respawn never works.

keepalived_respawns test should be skipped until bug is resolved.
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1286729

Change-Id: Ic111573e0cd5ad5bfe70b0f38ec0203c10d52e34
Related-Bug: #1511311

neutron/tests/functional/agent/linux/test_keepalived.py

index 4c0b9605da66cacddee6665d43e422613a5e5845..9b13cc9ac27b186bd1ce014f9747b02cd2d4ffec 100644 (file)
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from distutils import version
+import re
+
 from oslo_config import cfg
 from oslo_log import log as logging
+import testtools
 
 from neutron.agent.linux import external_process
 from neutron.agent.linux import keepalived
@@ -26,6 +30,18 @@ from neutron.tests.unit.agent.linux import test_keepalived
 LOG = logging.getLogger(__name__)
 
 
+def keepalived_version_not_supported():
+    try:
+        cmd = ['keepalived', '--version']
+        out = utils.execute(cmd, return_stderr=True)
+        ver = re.search(r"Keepalived v(\d+\.\d+\.\d+)", out[1]).group(1)
+        return version.LooseVersion(ver) >= version.LooseVersion("1.2.11")
+    except (OSError, RuntimeError, IndexError, ValueError) as e:
+        LOG.debug("Exception while checking keepalived version. "
+                  "Exception: %s", e)
+        return False
+
+
 class KeepalivedManagerTestCase(base.BaseTestCase,
                                 test_keepalived.KeepalivedConfBaseMixin):
 
@@ -53,6 +69,7 @@ class KeepalivedManagerTestCase(base.BaseTestCase,
         self.assertEqual(self.expected_config.get_config_str(),
                          self.manager.get_conf_on_disk())
 
+    @testtools.skipIf(keepalived_version_not_supported(), 'bug/1511311')
     def test_keepalived_respawns(self):
         self.manager.spawn()
         process = self.manager.get_process()