Remove downloading debian-installer components

In Fuel 7.0 we dropped classic provisioning mode,
fully switching to IBP. Remove pre-provision task
of downloading of debian-installer parts and related
script.

Related-Bug: #1549346
Depends-On: I36ff56c1e4a0437b33fc8e31da3df6f311607307
Change-Id: I1001225edd737a29edc263fee48715ba52f53af7
This commit is contained in:
Vitaly Parakhin 2016-03-30 14:58:22 +03:00
parent 4f50d89d11
commit d9e1ac25c6
7 changed files with 1 additions and 211 deletions

View File

@ -1,63 +0,0 @@
#!/bin/sh
# Copyright 2015 Mirantis, 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.
# NOTE(kozhukalov): This script is needed only for 6.1.
# We are going to download debian-installer initrd and kernel just
# before starting actual provisioning and then put them where they
# will be available for cobbler.
set -eu
SCRIPT_NAME=`basename $0`
LOG_FILE="/var/log/${SCRIPT_NAME}.log"
LOCK_FILE="/var/lock/${SCRIPT_NAME}.lock"
usage(){
echo "Usage: ${SCRIPT_NAME} <kernel_uri> <initrd_uri>"
exit 1
}
lock(){
exec 200>$1
flock -w 600 -x 200 || return 1
return 0
}
log(){
echo "`date '+%Y-%m-%d %H:%M:%S'` $$ $1" | tee -a $LOG_FILE
}
log "Checking if another instance of ${SCRIPT_NAME} is running."
lock $LOCK_FILE || { log "Error: Another instance of ${SCRIPT_NAME} is running \
at the moment. Please try later." 1>&2 ; exit 1; }
log "Checking if all necessary command line arguments are available."
test $# -eq 2 || usage
REMOTE_KERNEL_URI=$1
REMOTE_INITRD_URI=$2
LOCAL_KERNEL_FILE=${LOCAL_KERNEL_FILE:-/var/www/nailgun/ubuntu/x86_64/images/linux}
LOCAL_INITRD_FILE=${LOCAL_INITRD_FILE:-/var/www/nailgun/ubuntu/x86_64/images/initrd.gz}
log "Trying to download $REMOTE_KERNEL_URI"
mkdir -p `dirname $LOCAL_KERNEL_FILE`
wget -O - -T 120 -a $LOG_FILE -v $REMOTE_KERNEL_URI > $LOCAL_KERNEL_FILE.tmp
log "Trying to download $REMOTE_INITRD_URI"
mkdir -p `dirname $LOCAL_INITRD_FILE`
wget -O - -T 120 -a $LOG_FILE -v $REMOTE_INITRD_URI > $LOCAL_INITRD_FILE.tmp
mv $LOCAL_KERNEL_FILE.tmp $LOCAL_KERNEL_FILE
mv $LOCAL_INITRD_FILE.tmp $LOCAL_INITRD_FILE

View File

@ -2096,16 +2096,9 @@
virt-what
vlan
generated:
repo_setup:
installer_kernel:
remote_relative: "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux"
local: "/var/www/nailgun/ubuntu/x86_64/images/linux"
installer_initrd:
remote_relative: "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz"
local: "/var/www/nailgun/ubuntu/x86_64/images/initrd.gz"
cobbler:
profile:
generator_arg: "ubuntu_1404_x86_64"
generator_arg: "ubuntu_bootstrap"
provision:
codename: "trusty"
image_data:

View File

@ -309,23 +309,6 @@ class ProvisioningSerializer61(ProvisioningSerializer):
cluster.id,
packages))
# NOTE(kozhukalov): This pre-provision task is going to be
# removed by 7.0 because we need this only for classic way of
# provision and only until we get rid of it. We are going
# to download debian-installer initrd and kernel just before
# starting actual provisioning.
is_download_debian_installer = all([
cluster.release.operating_system == consts.RELEASE_OS.ubuntu,
attrs['provision']['method'] == consts.PROVISION_METHODS.cobbler])
if is_download_debian_installer:
tasks.append(
tasks_templates.make_download_debian_installer_task(
[consts.MASTER_NODE_UID],
attrs['repo_setup']['repos'],
attrs['repo_setup']['installer_kernel'],
attrs['repo_setup']['installer_initrd']))
PriorityStrategy().one_by_one(tasks)
return tasks

View File

@ -14,8 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_serialization import jsonutils
import requests
import six
@ -284,32 +282,6 @@ def make_ironic_bootstrap_task(uids, cid):
'retries': 1}})
def make_download_debian_installer_task(
uids, repos, installer_kernel, installer_initrd):
# NOTE(kozhukalov): This task is going to go away by 7.0
# because we going to get rid of classic way of provision.
# NOTE(ikalnitsky): We can't use urljoin here because it works
# pretty bad in cases when 'uri' doesn't have a trailing slash.
remote_kernel = os.path.join(
repos[0]['uri'], installer_kernel['remote_relative'])
remote_initrd = os.path.join(
repos[0]['uri'], installer_initrd['remote_relative'])
return make_shell_task(uids, {
'parameters': {
'cmd': ('LOCAL_KERNEL_FILE={local_kernel} '
'LOCAL_INITRD_FILE={local_initrd} '
'download-debian-installer '
'{remote_kernel} {remote_initrd}').format(
local_kernel=installer_kernel['local'],
local_initrd=installer_initrd['local'],
remote_kernel=remote_kernel,
remote_initrd=remote_initrd),
'timeout': 10 * 60,
'retries': 1}})
def make_noop_task(uids, task):
"""Creates NoOp task for astute.

View File

@ -281,33 +281,6 @@ class TestProvisioningSerializer61(BaseIntegrationTest):
]),
serialized_info['pre_provision']))
def test_ubuntu_prov_task_for_cobbler(self):
release = self.env.create_release(
api=False, operating_system=consts.RELEASE_OS.ubuntu)
self.cluster = self.env.create_cluster(
api=False, release_id=release.id)
self.cluster.attributes.editable['provision']['method'] = \
consts.PROVISION_METHODS.cobbler
serialized_info = self.serializer.serialize(self.cluster, [])
self.assertIn('pre_provision', serialized_info)
self.assertTrue(filter(
lambda task: all([
task['uids'] == ['master'],
task['type'] == 'shell',
task['parameters']['cmd'].startswith(
'LOCAL_KERNEL_FILE')
]),
serialized_info['pre_provision']))
self.assertFalse(filter(
lambda task: all([
task['uids'] == ['master'],
task['type'] == 'shell',
task['parameters']['cmd'].startswith('fuel-image')
]),
serialized_info['pre_provision']))
def test_centos_prov_task_for_cobbler(self):
release = self.env.create_release(
api=False, operating_system=consts.RELEASE_OS.centos)

View File

@ -240,52 +240,6 @@ class TestMakeTask(base.BaseTestCase):
'interval': 1,
'cwd': '/'}})
def test_make_download_debian_installer_task(self):
remote_kernel = ('http://some/a/dists/trusty/main/'
'installer-amd64/current/images/'
'netboot/ubuntu-installer/amd64/linux')
remote_initrd = ('http://some/a/dists/trusty/main/'
'installer-amd64/current/images/'
'netboot/ubuntu-installer/amd64/initrd.gz')
relative_kernel = ('dists/trusty/main/installer-amd64/current/'
'images/netboot/ubuntu-installer/amd64/linux')
relative_initrd = ('dists/trusty/main/installer-amd64/current/'
'images/netboot/ubuntu-installer/amd64/initrd.gz')
local_kernel = '/var/www/nailgun/ubuntu/x86_64/images/linux'
local_initrd = '/var/www/nailgun/ubuntu/x86_64/images/initrd.gz'
# we have to be able to handle both cases with trailing slash
# and without it
for uri in ('http://some/a/', 'http://some/a'):
result = tasks_templates.make_download_debian_installer_task(
[1, 2, 3],
repos=[{'name': 'repo', 'uri': uri}],
installer_kernel={'remote_relative': relative_kernel,
'local': local_kernel},
installer_initrd={'remote_relative': relative_initrd,
'local': local_initrd})
self.assertEqual(result, {
'id': None,
'type': 'shell',
'uids': [1, 2, 3],
'parameters': {
'cmd': ('LOCAL_KERNEL_FILE={local_kernel} '
'LOCAL_INITRD_FILE={local_initrd} '
'download-debian-installer '
'{remote_kernel} {remote_initrd}').format(
local_kernel=local_kernel,
local_initrd=local_initrd,
remote_kernel=remote_kernel,
remote_initrd=remote_initrd),
'timeout': 600,
'retries': 1,
'interval': 1,
'cwd': '/',
}})
class TestMakeUbuntuPreferencesTask(base.BaseTestCase):

View File

@ -92,7 +92,6 @@ mkdir -p %{buildroot}/%{_sysconfdir}/nailgun
mkdir -p %{buildroot}%{_localstatedir}/log/nailgun
install -m 755 %{_builddir}/%{name}-%{version}/bin/fencing-agent.rb %{buildroot}/opt/nailgun/bin/fencing-agent.rb
install -m 644 %{_builddir}/%{name}-%{version}/bin/fencing-agent.cron %{buildroot}/%{_sysconfdir}/cron.d/fencing-agent
install -p -D -m 755 %{_builddir}/%{name}-%{version}/bin/download-debian-installer %{buildroot}%{_bindir}/download-debian-installer
install -p -D -m 644 %{_builddir}/%{name}-%{version}/nailgun/nailgun/settings.yaml %{buildroot}/%{_sysconfdir}/nailgun/settings.yaml
install -p -D -m 644 %{_builddir}/%{name}-%{version}/nailgun/nailgun/fixtures/openstack.yaml %{buildroot}%{_datadir}/fuel-openstack-metadata/openstack.yaml
python -c "import yaml; print filter(lambda r: r['fields'].get('name'), yaml.safe_load(open('%{_builddir}/%{name}-%{version}/nailgun/nailgun/fixtures/openstack.yaml')))[0]['fields']['version']" > %{buildroot}%{_sysconfdir}/fuel_openstack_version
@ -149,24 +148,3 @@ Fuel fencing agent
/etc/cron.d/fencing-agent
%defattr(-,root,root)
%package -n fuel-provisioning-scripts
Summary: Fuel provisioning scripts
Version: %{version}
Release: %{release}
URL: http://mirantis.com
License: Apache
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Requires: wget
%description -n fuel-provisioning-scripts
Fuel provisioning scripts package.
This is a part of Fuel All-in-one Controle plane
for Openstack. For more info go to http://wiki.openstack.org/Fuel
%files -n fuel-provisioning-scripts
%defattr(-,root,root)
%{_bindir}/download-debian-installer