From 8408f96615267ab410063e411468526e90ff8d41 Mon Sep 17 00:00:00 2001
From: Russell Bryant <rbryant@redhat.com>
Date: Mon, 27 Jan 2014 13:58:32 -0500
Subject: [PATCH] Add a new node type for precise with saucy kernel

One of the types of failures in the top gate bug is due to a kernel
crash in network namespace code.  This patch installs a newer kernel on
the devstack nodes.  It installs the backported kernel and its headers
that are made available for hardware enablement purposes.  This gets
from a 3.2.0 kernel to a 3.11.0 kernel.

The patch is written as a new node prep script.  A new node type is also
defined that can be used by an experimental job.  This will allow us to
make sure everything is working before flipping the switch on using this
kernel everywhere.

The normal neutron devstack jobs are now listed in experimental.  When
run in the experimental pipeline, they should use the new node type that
uses the new kernel.

Change-Id: I9652b4183153687cc1e9a9a270ae0f78d8928620
Related-bug: #1254890
---
 .../jenkins_job_builder/config/projects.yaml  |  5 ++++
 .../scripts/prepare_devstack_new_kernel.sh    | 27 +++++++++++++++++++
 .../prepare_node_devstack_new_kernel.sh       | 22 +++++++++++++++
 .../openstack_project/files/zuul/layout.yaml  |  4 +++
 .../templates/nodepool/nodepool.yaml.erb      |  7 +++++
 5 files changed, 65 insertions(+)
 create mode 100644 modules/openstack_project/files/nodepool/scripts/prepare_devstack_new_kernel.sh
 create mode 100644 modules/openstack_project/files/nodepool/scripts/prepare_node_devstack_new_kernel.sh

diff --git a/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml b/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml
index e6c0950557..f7999ee568 100644
--- a/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml
+++ b/modules/openstack_project/files/jenkins_job_builder/config/projects.yaml
@@ -1125,6 +1125,11 @@
           node: 'devstack-precise || devstack-precise-check'
           branch-designator: ''
           branch-override: default
+      - devstack-jobs:
+          pipeline: experimental
+          node: 'devstack-precise-saucy-kernel'
+          branch-designator: ''
+          branch-override: default
       # Stable check jobs for testing devstack gate
       - devstack-jobs:
           pipeline: check
diff --git a/modules/openstack_project/files/nodepool/scripts/prepare_devstack_new_kernel.sh b/modules/openstack_project/files/nodepool/scripts/prepare_devstack_new_kernel.sh
new file mode 100644
index 0000000000..1dc1fec1e7
--- /dev/null
+++ b/modules/openstack_project/files/nodepool/scripts/prepare_devstack_new_kernel.sh
@@ -0,0 +1,27 @@
+#!/bin/bash -xe
+
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+#
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ -f /usr/bin/apt-get ]; then
+    if [ "$(lsb_release -c -s)" = "precise" ]; then
+        sudo DEBIAN_FRONTEND=noninteractive apt-get \
+          --option "Dpkg::Options::=--force-confold" \
+          --assume-yes install linux-generic-lts-saucy
+    fi
+fi
+
+/opt/nodepool-scripts/prepare_devstack.sh "$@"
diff --git a/modules/openstack_project/files/nodepool/scripts/prepare_node_devstack_new_kernel.sh b/modules/openstack_project/files/nodepool/scripts/prepare_node_devstack_new_kernel.sh
new file mode 100644
index 0000000000..09a1b225a3
--- /dev/null
+++ b/modules/openstack_project/files/nodepool/scripts/prepare_node_devstack_new_kernel.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -xe
+
+# Copyright (C) 2011-2013 OpenStack Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+#
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+HOSTNAME=$1
+
+./prepare_node.sh $HOSTNAME
+sudo -u jenkins -i /opt/nodepool-scripts/prepare_devstack_new_kernel.sh $HOSTNAME
diff --git a/modules/openstack_project/files/zuul/layout.yaml b/modules/openstack_project/files/zuul/layout.yaml
index f247590612..6cce27be07 100644
--- a/modules/openstack_project/files/zuul/layout.yaml
+++ b/modules/openstack_project/files/zuul/layout.yaml
@@ -785,6 +785,10 @@ projects:
       - gate-grenade-dsvm-neutron-forward
       - neutron-upstream-translation-update
       - check-neutron-dsvm-functional
+      - experimental-tempest-dsvm-neutron
+      - experimental-tempest-dsvm-neutron-pg
+      - experimental-tempest-dsvm-neutron-isolated
+      - experimental-tempest-dsvm-neutron-pg-isolated
     pre-release:
       - neutron-tarball
     release:
diff --git a/modules/openstack_project/templates/nodepool/nodepool.yaml.erb b/modules/openstack_project/templates/nodepool/nodepool.yaml.erb
index 815a6ab8ad..4326832c5c 100644
--- a/modules/openstack_project/templates/nodepool/nodepool.yaml.erb
+++ b/modules/openstack_project/templates/nodepool/nodepool.yaml.erb
@@ -37,6 +37,13 @@ providers:
         setup: prepare_node_devstack.sh
         username: jenkins
         private-key: /home/nodepool/.ssh/id_rsa
+      - name: devstack-precise-saucy-kernel
+        base-image: 'Ubuntu 12.04 LTS (Precise Pangolin)'
+        min-ram: 8192
+        name-filter: 'Performance'
+        setup: prepare_node_devstack_new_kernel.sh
+        username: jenkins
+        private-key: /home/nodepool/.ssh/id_rsa
   - name: rax-ord
     region-name: 'ORD'
     service-type: 'compute'