Removes LXC/LXD support on manila-image-elements
The support for LXC/LXD was added as part of the initial effort to develop a container driver for Manila which was later on abandoned. Despite of that, the code in the manila-image-elements remained. This patch set removes LXC/LXD container support in manila-image-elements. Code-path used for generation of Docker images is preserved. This will help for the parallel effort of making manila-image-elements usable by end users. Change-Id: I99c6a7fbf2b2fb0cebb7b16d94c66f807e7ac7ef Closes-Bug: #1646615
This commit is contained in:
parent
4cc362a7f1
commit
288f6c2f97
@ -13,20 +13,6 @@ else
|
|||||||
fi
|
fi
|
||||||
export ELEMENTS_PATH=$_PREFIX/elements
|
export ELEMENTS_PATH=$_PREFIX/elements
|
||||||
|
|
||||||
# Detect which image should be created
|
|
||||||
# generic - qcow image for VM
|
|
||||||
# lxd - tar for LXD
|
|
||||||
MANILA_IMAGE_TYPE=${1:-"generic"}
|
|
||||||
|
|
||||||
if [ "$MANILA_IMAGE_TYPE" != "generic" ] && [ "$MANILA_IMAGE_TYPE" != "lxd" ]; then
|
|
||||||
echo -e "Image type $MANILA_IMAGE_TYPE is not supported."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Build image: $MANILA_IMAGE_TYPE"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Collect configuration
|
# Collect configuration
|
||||||
# --------------------
|
# --------------------
|
||||||
# Development options:
|
# Development options:
|
||||||
@ -45,7 +31,6 @@ MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
|
|||||||
MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-minimal"}
|
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 features
|
# Manila features
|
||||||
MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"}
|
MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"}
|
||||||
@ -56,15 +41,8 @@ MANILA_ENABLE_ZFS_SUPPORT=${MANILA_ENABLE_ZFS_SUPPORT:-"no"}
|
|||||||
|
|
||||||
# Verify configuration
|
# Verify configuration
|
||||||
# --------------------
|
# --------------------
|
||||||
if [ "$MANILA_IMAGE_TYPE" = "lxd" ]; then
|
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces"
|
||||||
REQUIRED_ELEMENTS="manila-container $MANILA_IMG_OS"
|
IMAGE_FORMAT="qcow2"
|
||||||
IMAGE_FORMAT="tar"
|
|
||||||
MANILA_ENABLE_ZFS_SUPPORT="no"
|
|
||||||
export INSTALL_KERNEL=false
|
|
||||||
else
|
|
||||||
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces"
|
|
||||||
IMAGE_FORMAT="qcow2"
|
|
||||||
fi
|
|
||||||
OPTIONAL_ELEMENTS=
|
OPTIONAL_ELEMENTS=
|
||||||
OPTIONAL_DIB_ARGS=
|
OPTIONAL_DIB_ARGS=
|
||||||
|
|
||||||
@ -73,11 +51,7 @@ if [ "$MANILA_ENABLE_CIFS_SUPPORT" != "yes" ] && [ "$MANILA_ENABLE_NFS_SUPPORT"
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then
|
if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then
|
||||||
if [ "$MANILA_IMAGE_TYPE" = "lxd" ]; then
|
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs"
|
||||||
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-ganesha-nfs manila-unfs3"
|
|
||||||
else
|
|
||||||
OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
|
if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then
|
||||||
@ -212,38 +186,3 @@ disk-image-create \
|
|||||||
$OPTIONAL_DIB_ARGS \
|
$OPTIONAL_DIB_ARGS \
|
||||||
-o $MANILA_IMG_NAME \
|
-o $MANILA_IMG_NAME \
|
||||||
$OPTIONAL_ELEMENTS $REQUIRED_ELEMENTS
|
$OPTIONAL_ELEMENTS $REQUIRED_ELEMENTS
|
||||||
|
|
||||||
if [ "$MANILA_IMAGE_TYPE" = "lxd" ]; then
|
|
||||||
LXD_IMAGE_DIR=$_PREFIX/lxd-image.d
|
|
||||||
mkdir $LXD_IMAGE_DIR >/dev/null 2>&1 || rm -fR $LXD_IMAGE_DIR/*
|
|
||||||
mkdir $LXD_IMAGE_DIR/rootfs >/dev/null 2>&1 || rm -fR $LXD_IMAGE_DIR/rootfs/*
|
|
||||||
|
|
||||||
# Create LXD metadata package
|
|
||||||
cp -R $_PREFIX/data/lxd/meta/* $LXD_IMAGE_DIR
|
|
||||||
|
|
||||||
# Update creation timestamp in metafile
|
|
||||||
sed -i "s/%CREATION_DATE%/$(date +%s)/g" $LXD_IMAGE_DIR/metadata.yaml
|
|
||||||
|
|
||||||
# Create package
|
|
||||||
echo "Creating LXD metadata package..."
|
|
||||||
tar -cf $_PREFIX/$MANILA_LXD_METADATA_PACKAGE_NAME.tar \
|
|
||||||
-C $LXD_IMAGE_DIR templates metadata.yaml
|
|
||||||
echo "Done. Metadata could be found here: $_PREFIX/$MANILA_LXD_METADATA_PACKAGE_NAME.tar"
|
|
||||||
|
|
||||||
# Create sys and proc directories required by LXD
|
|
||||||
mkdir -p $LXD_IMAGE_DIR/tmp/sys >/dev/null 2>&1 || echo "sys folder already exists in rootfs."
|
|
||||||
mkdir -p $LXD_IMAGE_DIR/tmp/proc >/dev/null 2>&1 || echo "proc folder already exists in rootfs."
|
|
||||||
|
|
||||||
sudo $_PREFIX/tools/add_to_rootfs_tar $_PREFIX/$MANILA_IMG_NAME.tar \
|
|
||||||
$LXD_IMAGE_DIR/tmp/sys /./sys/
|
|
||||||
|
|
||||||
sudo $_PREFIX/tools/add_to_rootfs_tar $_PREFIX/$MANILA_IMG_NAME.tar \
|
|
||||||
$LXD_IMAGE_DIR/tmp/proc /./proc/
|
|
||||||
|
|
||||||
rm -fR $LXD_IMAGE_DIR/tmp
|
|
||||||
|
|
||||||
# Compress rootfs
|
|
||||||
echo "Compressing rootfs package..."
|
|
||||||
sudo xz -f $_PREFIX/$MANILA_IMG_NAME.tar
|
|
||||||
echo "Done. rootfs could be found here: $_PREFIX/$MANILA_IMG_NAME.tar.xz"
|
|
||||||
fi
|
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
{
|
|
||||||
"architecture": "i686",
|
|
||||||
"creation_date": %CREATION_DATE%,
|
|
||||||
"properties": {
|
|
||||||
"architecture": "i686",
|
|
||||||
"description": "Openstack Manila LXD image (ubuntu trusty i686).",
|
|
||||||
"name": "manila-lxd-ubuntu-trusty-i686",
|
|
||||||
"os": "ubuntu",
|
|
||||||
"release": "trusty",
|
|
||||||
"variant": "default"
|
|
||||||
},
|
|
||||||
"templates": {
|
|
||||||
"/etc/hostname": {
|
|
||||||
"template": "hostname.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/etc/hosts": {
|
|
||||||
"template": "hosts.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/etc/init/console.override": {
|
|
||||||
"template": "upstart-override.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/etc/init/tty1.override": {
|
|
||||||
"template": "upstart-override.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/etc/init/tty2.override": {
|
|
||||||
"template": "upstart-override.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/etc/init/tty3.override": {
|
|
||||||
"template": "upstart-override.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/etc/init/tty4.override": {
|
|
||||||
"template": "upstart-override.tpl",
|
|
||||||
"when": [
|
|
||||||
"create"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
{{ container.name }}
|
|
@ -1,10 +0,0 @@
|
|||||||
127.0.0.1 localhost
|
|
||||||
127.0.0.1 localhost.localdomain
|
|
||||||
127.0.1.1 {{ container.name }}
|
|
||||||
|
|
||||||
# The following lines are desirable for IPv6 capable hosts
|
|
||||||
::1 ip6-localhost ip6-loopback
|
|
||||||
fe00::0 ip6-localnet
|
|
||||||
ff00::0 ip6-mcastprefix
|
|
||||||
ff02::1 ip6-allnodes
|
|
||||||
ff02::2 ip6-allrouters
|
|
@ -1 +0,0 @@
|
|||||||
manual
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
echo "" > /etc/network/interfaces
|
|
||||||
echo "auto lo" >> /etc/network/interfaces
|
|
||||||
echo "iface lo inet loopback" >> /etc/network/interfaces
|
|
||||||
|
|
||||||
echo "" >> /etc/network/interfaces
|
|
||||||
echo "auto eth0" >> /etc/network/interfaces
|
|
||||||
echo "iface eth0 inet dhcp" >> /etc/network/interfaces
|
|
@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import tarfile
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main(tar_path, folder_path, target_name):
|
|
||||||
try:
|
|
||||||
tar = tarfile.open(tar_path, mode="a")
|
|
||||||
tar.add(folder_path, arcname=target_name)
|
|
||||||
tar.close()
|
|
||||||
except Exception as e:
|
|
||||||
print("Error: ", e)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if len(sys.argv) != 4:
|
|
||||||
print("Usage: "
|
|
||||||
"add_to_rootfs_tar <path_to_tar> <path_to_folder> <target_name>")
|
|
||||||
|
|
||||||
main(sys.argv[1], sys.argv[2], sys.argv[3])
|
|
@ -4,8 +4,6 @@ IMAGE=$1
|
|||||||
|
|
||||||
if [ "$IMAGE" = "generic" ]; then
|
if [ "$IMAGE" = "generic" ]; then
|
||||||
tox -v -e buildimage
|
tox -v -e buildimage
|
||||||
elif [ "$IMAGE" = "lxd" ]; then
|
|
||||||
tox -v -e buildimage-lxd
|
|
||||||
elif [ "$IMAGE" = "docker" ]; then
|
elif [ "$IMAGE" = "docker" ]; then
|
||||||
tox -v -e buildimage-docker
|
tox -v -e buildimage-docker
|
||||||
fi
|
fi
|
||||||
|
3
tox.ini
3
tox.ini
@ -35,9 +35,6 @@ deps =
|
|||||||
[testenv:buildimage-docker]
|
[testenv:buildimage-docker]
|
||||||
commands = {toxinidir}/tools/docker_builder.sh
|
commands = {toxinidir}/tools/docker_builder.sh
|
||||||
|
|
||||||
[testenv:buildimage-lxd]
|
|
||||||
commands = manila-image-create lxd
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = true
|
show-source = true
|
||||||
builtins = _
|
builtins = _
|
||||||
|
Loading…
Reference in New Issue
Block a user