Use ubuntu-minimal instead of ubuntu-core
Support of ubuntu-core was dropped and now it is impossible to continue using it. Therefore, start using ubuntu-minimal OS element for building image. Also, add 'other-requirements.txt' file with list of required system packages to be installed prior to buidling image. Change-Id: Ief7059b9e6cc2aad03c81225663f5313a8d2f5f2 Closes-Bug: #1586351
This commit is contained in:
parent
b08dd7d217
commit
5ddd59814a
10
README.rst
10
README.rst
@ -1,18 +1,22 @@
|
|||||||
Manila image elements project
|
Manila image elements project
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
This repo is a place for Manila-related for diskimage-builder elements.
|
This repo is a place for Manila-related diskimage-builder elements.
|
||||||
|
|
||||||
* Free software: Apache license
|
* Free software: Apache license
|
||||||
* Source: http://git.openstack.org/cgit/manila-image-elements
|
* Source: http://git.openstack.org/cgit/manila-image-elements
|
||||||
* Bugs: http://bugs.launchpad.net/manila-image
|
* Bugs: http://bugs.launchpad.net/manila-image-elements
|
||||||
* Built Images: http://tarballs.openstack.org/manila-image-elements/images
|
* Built Images: http://tarballs.openstack.org/manila-image-elements/images
|
||||||
|
|
||||||
|
|
||||||
Build instructions
|
Build instructions
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Script for creating Ubuntu based image with our elements and default parameters. You should only need to run this command:
|
Script for creating Ubuntu based image with our elements and default parameters.
|
||||||
|
|
||||||
|
Before building image make sure all system dependencies,
|
||||||
|
listed in other-requirements.txt file, are installed.
|
||||||
|
After it, you should only need to run this command:
|
||||||
|
|
||||||
.. sourcecode:: bash
|
.. sourcecode:: bash
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ MANILA_USER_AUTHORIZED_KEYS="None"
|
|||||||
|
|
||||||
# Manila image settings
|
# Manila image settings
|
||||||
MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
|
MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
|
||||||
MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-core"}
|
MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-minimal"}
|
||||||
MANILA_IMG_OS_VER=${MANILA_IMG_OS_VER:-"trusty"}
|
MANILA_IMG_OS_VER=${MANILA_IMG_OS_VER:-"trusty"}
|
||||||
MANILA_IMG_NAME=${MANILA_IMG_NAME:-"manila-service-image"}
|
MANILA_IMG_NAME=${MANILA_IMG_NAME:-"manila-service-image"}
|
||||||
MANILA_LXD_METADATA_PACKAGE_NAME=${MANILA_LXD_METADATA_PACKAGE_NAME:-"manila-lxd-meta"}
|
MANILA_LXD_METADATA_PACKAGE_NAME=${MANILA_LXD_METADATA_PACKAGE_NAME:-"manila-lxd-meta"}
|
||||||
@ -62,7 +62,7 @@ if [ "$MANILA_IMAGE_TYPE" = "lxd" ]; then
|
|||||||
MANILA_ENABLE_ZFS_SUPPORT="no"
|
MANILA_ENABLE_ZFS_SUPPORT="no"
|
||||||
export INSTALL_KERNEL=false
|
export INSTALL_KERNEL=false
|
||||||
else
|
else
|
||||||
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces cleanup-kernel-initrd"
|
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces"
|
||||||
IMAGE_FORMAT="qcow2"
|
IMAGE_FORMAT="qcow2"
|
||||||
fi
|
fi
|
||||||
OPTIONAL_ELEMENTS=
|
OPTIONAL_ELEMENTS=
|
||||||
@ -101,11 +101,6 @@ if [ "$DISABLE_IMG_COMPRESSION" = "yes" ]; then
|
|||||||
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -u"
|
OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -u"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MANILA_IMG_OS" = "manila-ubuntu-core" ] && [ "$MANILA_IMG_OS_VER" != "trusty" ]; then
|
|
||||||
echo "manila-ubuntu-core doesn't support '$MANILA_IMG_OS_VER' release."
|
|
||||||
echo "Change MANILA_IMG_OS to 'ubuntu' if you need another release."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify dependencies
|
# Verify dependencies
|
||||||
# -------------------
|
# -------------------
|
||||||
if [ -e /etc/os-release ]; then
|
if [ -e /etc/os-release ]; then
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
==================
|
|
||||||
manila-ubuntu-core
|
|
||||||
==================
|
|
||||||
|
|
||||||
Provides minimalistic Ubuntu 14.04 LTS based on Ubuntu Core image.
|
|
||||||
|
|
||||||
Overrides:
|
|
||||||
* To use different mirrors rather than the default of archive.ubuntu.com and
|
|
||||||
security.ubuntu.com, use the environment variable DIB\_DISTRIBUTION\_MIRROR
|
|
@ -1,3 +0,0 @@
|
|||||||
cache-url
|
|
||||||
dib-run-parts
|
|
||||||
dpkg
|
|
@ -1,3 +0,0 @@
|
|||||||
export DISTRO_NAME=ubuntu
|
|
||||||
export DIB_RELEASE=${DIB_RELEASE:-trusty}
|
|
||||||
export INSTALL_KERNEL=${INSTALL_KERNEL:-true}
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
apt-get -y autoremove
|
|
@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
sudo sed -i -E "s/#\s(deb.+universe)$/\1/g" /etc/apt/sources.list
|
|
||||||
|
|
||||||
apt-get update
|
|
||||||
apt-get upgrade -y
|
|
||||||
|
|
||||||
if $INSTALL_KERNEL ; then
|
|
||||||
apt-get install linux-image-generic -y
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt-get install \
|
|
||||||
python \
|
|
||||||
sudo \
|
|
||||||
openssh-server \
|
|
||||||
rpcbind \
|
|
||||||
vim \
|
|
||||||
-y
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# This package is broken and causes real issues on update:
|
|
||||||
# https://bugs.launchpad.net/ubuntu/+source/apt-xapian-index/+bug/1227420
|
|
||||||
apt-get --yes remove apt-xapian-index || :
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# The grub post-kernel install hook will barf if the block device can't be
|
|
||||||
# found (as happens in a chroot).
|
|
||||||
# Temporarily remove grub, to avoid that confusion.
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
if dpkg-query -W grub-pc; then
|
|
||||||
apt-get -y remove grub-pc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if dpkg-query -W grub2-common; then
|
|
||||||
apt-get -y remove grub2-common
|
|
||||||
fi
|
|
@ -1,62 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# These are useful, or at worst not harmful, for all images we build.
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
[ -n "$ARCH" ]
|
|
||||||
[ -n "$TARGET_ROOT" ]
|
|
||||||
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cdimage.ubuntu.com/ubuntu-core/releases/}
|
|
||||||
DIB_RELEASE="trusty" # Note(u_glide): another releases not supported/tested
|
|
||||||
DIB_RELEASE_NUM="14.04"
|
|
||||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-ubuntu-core-$DIB_RELEASE_NUM-core-$ARCH.tar.gz}
|
|
||||||
SHA256SUMS=${SHA256SUMS:-http://${DIB_CLOUD_IMAGES##http?(s)://}/$DIB_RELEASE/release/SHA256SUMS}
|
|
||||||
CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
|
||||||
CACHED_FILE_LOCK=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE.lock
|
|
||||||
CACHED_SUMS=$DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH
|
|
||||||
|
|
||||||
function get_ubuntu_tarball {
|
|
||||||
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then
|
|
||||||
echo "Not checking freshness of cached $CACHED_FILE."
|
|
||||||
else
|
|
||||||
echo "Fetching Base Image"
|
|
||||||
$TMP_HOOKS_PATH/bin/cache-url $SHA256SUMS $CACHED_SUMS
|
|
||||||
$TMP_HOOKS_PATH/bin/cache-url \
|
|
||||||
$DIB_CLOUD_IMAGES/$DIB_RELEASE/release/$BASE_IMAGE_FILE $CACHED_FILE
|
|
||||||
pushd $DIB_IMAGE_CACHE
|
|
||||||
if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
|
|
||||||
# It is likely that an upstream http(s) proxy has given us a skewed
|
|
||||||
# result - either a cached SHA file or a cached image. Use cache-busting
|
|
||||||
# to get (as long as caches are compliant...) fresh files.
|
|
||||||
# Try the sha256sum first, just in case that is the stale one (avoiding
|
|
||||||
# downloading the larger image), and then if the sums still fail retry
|
|
||||||
# the image.
|
|
||||||
$TMP_HOOKS_PATH/bin/cache-url -f $SHA256SUMS $CACHED_SUMS
|
|
||||||
if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
|
|
||||||
$TMP_HOOKS_PATH/bin/cache-url -f \
|
|
||||||
$DIB_CLOUD_IMAGES/$DIB_RELEASE/release/$BASE_IMAGE_FILE $CACHED_FILE
|
|
||||||
grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check -
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
# Extract the base image (use --numeric-owner to avoid UID/GID mismatch between
|
|
||||||
# image tarball and host OS e.g. when building Ubuntu image on an openSUSE host)
|
|
||||||
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
|
||||||
}
|
|
||||||
|
|
||||||
(
|
|
||||||
echo "Getting $CACHED_FILE_LOCK: $(date)"
|
|
||||||
# Wait up to 20 minutes for another process to download
|
|
||||||
if ! flock -w 1200 9 ; then
|
|
||||||
echo "Did not get $CACHED_FILE_LOCK: $(date)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
get_ubuntu_tarball
|
|
||||||
) 9> $CACHED_FILE_LOCK
|
|
22
elements/manila-ubuntu-minimal/README.rst
Executable file
22
elements/manila-ubuntu-minimal/README.rst
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
=====================
|
||||||
|
manila-ubuntu-minimal
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Create a minimal image based on Ubuntu. Default is trusty but DIB_RELEASE
|
||||||
|
is mapped to any series of Ubuntu.
|
||||||
|
|
||||||
|
If necessary, a custom apt keyring and debootstrap script can be supplied
|
||||||
|
to the debootstrap command via DIB_APT_KEYRING and
|
||||||
|
DIB_DEBIAN_DEBOOTSTRAP_SCRIPT respectively. Both options require the use of
|
||||||
|
absolute rather than relative paths.
|
||||||
|
|
||||||
|
Use of this element will also require the tool 'debootstrap' to be available
|
||||||
|
on your system.
|
||||||
|
|
||||||
|
The DIB_OFFLINE or more specific DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE variables
|
||||||
|
can be set to prefer the use of a pre-cached root filesystem tarball.
|
||||||
|
|
||||||
|
The DIB_DEBOOTSTRAP_EXTRA_ARGS environment variable may be used to pass
|
||||||
|
extra arguments to the debootstrap command used to create the base
|
||||||
|
filesystem image. If --keyring is used in DIB_DEBOOTSTRAP_EXTRA_ARGS,
|
||||||
|
it will override DIB_APT_KEYRING if that is used as well.
|
1
elements/manila-ubuntu-minimal/element-deps
Executable file
1
elements/manila-ubuntu-minimal/element-deps
Executable file
@ -0,0 +1 @@
|
|||||||
|
ubuntu-minimal
|
8
elements/manila-ubuntu-minimal/package-installs.yaml
Executable file
8
elements/manila-ubuntu-minimal/package-installs.yaml
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
openssh-server:
|
||||||
|
sudo:
|
||||||
|
rpcbind:
|
||||||
|
vim:
|
||||||
|
iptables:
|
||||||
|
inetutils-ping:
|
||||||
|
net-tools:
|
||||||
|
python:
|
@ -8,4 +8,4 @@ set -o pipefail
|
|||||||
|
|
||||||
# Update 'hosts' file with dn-ip predefinitions
|
# Update 'hosts' file with dn-ip predefinitions
|
||||||
hosts_config="/etc/hosts"
|
hosts_config="/etc/hosts"
|
||||||
echo "127.0.0.1 localhost localhost.localdomain" >> $hosts_config
|
echo "127.0.0.1 ubuntu localhost localhost.localdomain" >> $hosts_config
|
38
elements/manila-ubuntu-minimal/pre-install.d/00-ubuntu-apt-update
Executable file
38
elements/manila-ubuntu-minimal/pre-install.d/00-ubuntu-apt-update
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# 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 [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-http://archive.ubuntu.com/ubuntu}
|
||||||
|
|
||||||
|
# We should manage this in a betterer way
|
||||||
|
cat << EOF >/etc/apt/sources.list
|
||||||
|
deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE main restricted universe
|
||||||
|
deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-updates main restricted universe
|
||||||
|
deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports main restricted universe
|
||||||
|
deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-security main restricted universe
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Need to update to retrieve the signed Release file
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
apt-get clean
|
||||||
|
apt-get dist-upgrade -y
|
2
other-requirements.txt
Normal file
2
other-requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Package 'debootstrap' is required for 'ubuntu-minimal' element.
|
||||||
|
debootstrap
|
Loading…
x
Reference in New Issue
Block a user