From 4a69d386c55f01ef3645ad500d232f27fc7c2444 Mon Sep 17 00:00:00 2001 From: Michael Polenchuk Date: Wed, 15 Feb 2017 18:36:58 +0400 Subject: [fuel-plugin] Employ dedicated reboot task * Use native reboot task after kernel setup to avoid unexpected behavior. * Add support for removing installed kernel (get back to original one). * Create symlink to the headers to enable dkms modules to get source files of the kernel. Change-Id: Icdf8db267c69a55337910bc3aed15d56eb783ae5 Signed-off-by: Michael Polenchuk --- .../puppet/manifests/kvm-install.pp | 46 ++++++++++++++-------- fuel-plugin/deployment_tasks.yaml | 19 +++++++-- fuel-plugin/pre_build_hook | 8 ---- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/fuel-plugin/deployment_scripts/puppet/manifests/kvm-install.pp b/fuel-plugin/deployment_scripts/puppet/manifests/kvm-install.pp index 4c04aa0a6..fba3e38ce 100644 --- a/fuel-plugin/deployment_scripts/puppet/manifests/kvm-install.pp +++ b/fuel-plugin/deployment_scripts/puppet/manifests/kvm-install.pp @@ -1,18 +1,32 @@ $kvm_settings = hiera('fuel-plugin-kvm') -if $operatingsystem == 'Ubuntu' { - if $kvm_settings['use_kvm'] { - package { 'linux-headers-4.4.6-rt14nfv': - ensure => "1.0.OPNFV", - notify => Reboot['after_run'], - } -> - package { 'linux-image-4.4.6-rt14nfv': - ensure => "1.0.OPNFV", - notify => Reboot['after_run'], - } - reboot { 'after_run': - apply => finished, - } - } else { - } -} elsif $operatingsystem == 'CentOS' { + +case $::operatingsystem { + 'Ubuntu': { + $version = '4.4.6-rt14nfv' + $kernel_kit = ["linux-headers-${version}", "linux-image-${version}"] + $kernel_src = "/usr/src/linux-headers-${version}" + $kernel_src_link = "/lib/modules/${version}/build" + } + default: { + fail("Unsupported operating system: ${::osfamily}/${::operatingsystem}") + } + +} + +if $kvm_settings['use_kvm'] { + $ensure_pkg = '1.0.OPNFV' + $ensure_link = 'link' +} else { + $ensure_pkg = 'purged' + $ensure_link = 'absent' +} + +package { $kernel_kit: + ensure => $ensure_pkg, + before => File[$kernel_src_link], +} + +file { $kernel_src_link: + ensure => $ensure_link, + target => $kernel_src, } diff --git a/fuel-plugin/deployment_tasks.yaml b/fuel-plugin/deployment_tasks.yaml index 55f91ff21..ab63a9b1f 100644 --- a/fuel-plugin/deployment_tasks.yaml +++ b/fuel-plugin/deployment_tasks.yaml @@ -2,11 +2,22 @@ type: puppet version: 2.1.0 role: [compute] - required_for: [post_deployment_end] - requires: [post_deployment_start] + requires: [pre_deployment_start] + required_for: [pre_deployment_end] condition: - yaql_exp: changed($.get('fuel-plugin-kvm')) + yaql_exp: &kvm changed($.get('fuel-plugin-kvm')) parameters: puppet_manifest: puppet/manifests/kvm-install.pp puppet_modules: puppet/modules:/etc/puppet/modules - timeout: 1200 + timeout: 300 + +- id: node_reboot + type: reboot + version: 2.1.0 + role: [compute] + requires: [kvm_install] + required_for: [pre_deployment_end] + condition: + yaql_exp: *kvm + parameters: + timeout: 900 diff --git a/fuel-plugin/pre_build_hook b/fuel-plugin/pre_build_hook index 259862f8f..a3c883283 100755 --- a/fuel-plugin/pre_build_hook +++ b/fuel-plugin/pre_build_hook @@ -4,10 +4,6 @@ set -eux BUILD_FOR=${BUILD_FOR:-ubuntu} DIR="$(dirname `readlink -f $0`)" -MODULES="${DIR}/deployment_scripts/puppet/modules" - -REBOOT_VER='1.2.1' -REBOOT_URL="https://github.com/puppetlabs/puppetlabs-reboot/archive/${REBOOT_VER}.tar.gz" function build_pkg { case $1 in @@ -29,7 +25,3 @@ for system in $BUILD_FOR do build_pkg $system done - -rm -rf ${MODULES}/reboot -mkdir -p ${MODULES}/reboot -wget -qO- ${REBOOT_URL} | tar -C ${MODULES}/reboot --strip-components=1 -zxvf - -- cgit 1.2.3-korg