From 288f6c2f97b8e7ebb12a4e2a1be18f4ae4cd5ff2 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Fri, 2 Dec 2016 12:06:57 -0300 Subject: [PATCH] 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 --- bin/manila-image-create | 67 +------------------ data/lxd/meta/metadata.yaml | 56 ---------------- data/lxd/meta/templates/hostname.tpl | 1 - data/lxd/meta/templates/hosts.tpl | 10 --- data/lxd/meta/templates/upstart-override.tpl | 1 - .../post-install.d/99-configure-network | 15 ----- tools/add_to_rootfs_tar | 21 ------ tools/gate/build-images | 2 - tox.ini | 3 - 9 files changed, 3 insertions(+), 173 deletions(-) delete mode 100644 data/lxd/meta/metadata.yaml delete mode 100644 data/lxd/meta/templates/hostname.tpl delete mode 100644 data/lxd/meta/templates/hosts.tpl delete mode 100644 data/lxd/meta/templates/upstart-override.tpl delete mode 100755 elements/manila-container/post-install.d/99-configure-network delete mode 100755 tools/add_to_rootfs_tar diff --git a/bin/manila-image-create b/bin/manila-image-create index 8215658..282e900 100644 --- a/bin/manila-image-create +++ b/bin/manila-image-create @@ -13,20 +13,6 @@ else fi 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 # -------------------- # 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_VER=${MANILA_IMG_OS_VER:-"trusty"} 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_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"} @@ -56,15 +41,8 @@ MANILA_ENABLE_ZFS_SUPPORT=${MANILA_ENABLE_ZFS_SUPPORT:-"no"} # Verify configuration # -------------------- -if [ "$MANILA_IMAGE_TYPE" = "lxd" ]; then - REQUIRED_ELEMENTS="manila-container $MANILA_IMG_OS" - 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 +REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces" +IMAGE_FORMAT="qcow2" OPTIONAL_ELEMENTS= OPTIONAL_DIB_ARGS= @@ -73,11 +51,7 @@ if [ "$MANILA_ENABLE_CIFS_SUPPORT" != "yes" ] && [ "$MANILA_ENABLE_NFS_SUPPORT" fi if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then - if [ "$MANILA_IMAGE_TYPE" = "lxd" ]; then - OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-ganesha-nfs manila-unfs3" - else - OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs" - fi + OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs" fi if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then @@ -212,38 +186,3 @@ disk-image-create \ $OPTIONAL_DIB_ARGS \ -o $MANILA_IMG_NAME \ $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 diff --git a/data/lxd/meta/metadata.yaml b/data/lxd/meta/metadata.yaml deleted file mode 100644 index 81bf45a..0000000 --- a/data/lxd/meta/metadata.yaml +++ /dev/null @@ -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" - ] - } - } -} diff --git a/data/lxd/meta/templates/hostname.tpl b/data/lxd/meta/templates/hostname.tpl deleted file mode 100644 index 69a84f1..0000000 --- a/data/lxd/meta/templates/hostname.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ container.name }} diff --git a/data/lxd/meta/templates/hosts.tpl b/data/lxd/meta/templates/hosts.tpl deleted file mode 100644 index 6e6651f..0000000 --- a/data/lxd/meta/templates/hosts.tpl +++ /dev/null @@ -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 diff --git a/data/lxd/meta/templates/upstart-override.tpl b/data/lxd/meta/templates/upstart-override.tpl deleted file mode 100644 index aabfa58..0000000 --- a/data/lxd/meta/templates/upstart-override.tpl +++ /dev/null @@ -1 +0,0 @@ -manual \ No newline at end of file diff --git a/elements/manila-container/post-install.d/99-configure-network b/elements/manila-container/post-install.d/99-configure-network deleted file mode 100755 index 0bd14bc..0000000 --- a/elements/manila-container/post-install.d/99-configure-network +++ /dev/null @@ -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 diff --git a/tools/add_to_rootfs_tar b/tools/add_to_rootfs_tar deleted file mode 100755 index e5c822d..0000000 --- a/tools/add_to_rootfs_tar +++ /dev/null @@ -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 ") - - main(sys.argv[1], sys.argv[2], sys.argv[3]) \ No newline at end of file diff --git a/tools/gate/build-images b/tools/gate/build-images index 4efe43f..fb65dfa 100755 --- a/tools/gate/build-images +++ b/tools/gate/build-images @@ -4,8 +4,6 @@ IMAGE=$1 if [ "$IMAGE" = "generic" ]; then tox -v -e buildimage -elif [ "$IMAGE" = "lxd" ]; then - tox -v -e buildimage-lxd elif [ "$IMAGE" = "docker" ]; then tox -v -e buildimage-docker fi diff --git a/tox.ini b/tox.ini index 5959de8..9797982 100644 --- a/tox.ini +++ b/tox.ini @@ -35,9 +35,6 @@ deps = [testenv:buildimage-docker] commands = {toxinidir}/tools/docker_builder.sh -[testenv:buildimage-lxd] -commands = manila-image-create lxd - [flake8] show-source = true builtins = _