From 94c845d5b752d5f9e95d16f7b8c7f9a00f0f7cca Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Wed, 2 Nov 2016 12:13:48 +0000 Subject: [PATCH] nodepool: Create Ubuntu Xenial images --- nodepool/nodepool.yaml | 8 +- .../prepare_node_devstack_xen_xenial.sh | 91 +++++++++++++++++++ 2 files changed, 95 insertions(+), 4 deletions(-) create mode 100755 nodepool/scripts/prepare_node_devstack_xen_xenial.sh diff --git a/nodepool/nodepool.yaml b/nodepool/nodepool.yaml index 4166041..20a69ff 100644 --- a/nodepool/nodepool.yaml +++ b/nodepool/nodepool.yaml @@ -49,11 +49,11 @@ providers: images: - name: ds-xen # This is the image name to use found in this provider's `glance image-list` - base-image: 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' + base-image: 'Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)' min-ram: 8192 name-filter: 'Performance' # This is the script that will be used to prepare the image - setup: prepare_node_devstack_xen.sh + setup: prepare_node_devstack_xen_xenial.sh #Set the public key part only of the jenkin's key (no whitespace) to the NODEPOOL_SSH_KEY environment variable in order to #inject it into the image's jenkins user .ssh/authorized_keys #This key will be used to log in and setup jenkins on the target VM @@ -63,11 +63,11 @@ providers: xenapi_use_agent: 'false' - name: ts-xen # This is the image name to use found in this provider's `glance image-list` - base-image: 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' + base-image: 'Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)' min-ram: 8192 name-filter: 'Performance' # This is the script that will be used to prepare the image - setup: prepare_node_devstack_xen.sh + setup: prepare_node_devstack_xen_xenial.sh #Set the public key part only of the jenkin's key (no whitespace) to the NODEPOOL_SSH_KEY environment variable in order to #inject it into the image's jenkins user .ssh/authorized_keys #This key will be used to log in and setup jenkins on the target VM diff --git a/nodepool/scripts/prepare_node_devstack_xen_xenial.sh b/nodepool/scripts/prepare_node_devstack_xen_xenial.sh new file mode 100755 index 0000000..2d23365 --- /dev/null +++ b/nodepool/scripts/prepare_node_devstack_xen_xenial.sh @@ -0,0 +1,91 @@ +#!/bin/bash +set -xe + +# remove unused files +rm -v read-vendor-json.py +rm -v static-network-config +# None of the .deb are for xenial +rm -v *.deb + +./prepare_node_devstack.sh + +# Install Xen and update the kernel +sudo apt-get -y install htop vim git pwgen xen-hypervisor linux-image-extra-virtual + +# Override any overriden value +sudo tee /etc/default/grub.d/99_balloons.cfg << EOC +GRUB_DEFAULT=0 +GRUB_TIMEOUT=30 +GRUB_CMDLINE_LINUX_DEFAULT="debug loglevel=7" +GRUB_CMDLINE_LINUX="" +GRUB_TERMINAL=console +GRUB_DISABLE_LINUX_UUID=false +GRUB_HIDDEN_TIMEOUT=0 +GRUB_HIDDEN_TIMEOUT_QUIET=false +EOC + +sudo mv /etc/default/grub.d/xen.cfg{,.bak} +sudo tee /etc/default/grub.d/xen.cfg << EOC +echo "Including Xen overrides from /etc/default/grub.d/xen.cfg" +GRUB_CMDLINE_XEN="dom0_mem=7552M,max:7552M dom0_max_vcpus=4 max-console=vga" +GRUB_DEFAULT="Ubuntu GNU/Linux, with Xen hypervisor" +EOC + +sudo update-grub + +# Workaround https://bugs.launchpad.net/nova/+bug/1461642 +sed -r -i 's/^( *)(handle_iptable)/\1: #\2/' /etc/xen/scripts/vif-bridge + +# Let cloud-init do it's job: +# This is necessary because interfaces is replaced by static ips which does not +# correspond to the guest, but interfaced.d have the right information +# also interface names are not eth0, and is called ens4 instead +mv /etc/network/interfaces{,.bak.nodepool~} +cat > /etc/network/interfaces < "/etc/init/${i}.conf.override" <<<"manual" +done +systemctl mask xe-daemon nova-agent rax-cloud + +# Create a swap file +sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288 +sudo chown root:root /swapfile +sudo chmod 0600 /swapfile +sudo mkswap /swapfile +echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab + +# Install osci-upload +install_osci_upload(){ + apt-get install -y libmysqlclient-dev libffi-dev libssl-dev + mkdir /home/jenkins/prepared-osci + ( + cd /home/jenkins/prepared-osci + virtualenv osci-env + . osci-env/bin/activate + git clone https://github.com/citrix-openstack/openstack-citrix-ci openstack-citrix-ci + pip install -r openstack-citrix-ci/requirements.txt + pip install -e openstack-citrix-ci + mkdir -p /etc/osci/ + cp /opt/nodepool-scripts/osci.config /etc/osci/osci.config + osci-upload --help + ) +} + +install_osci_upload + +# Have libvirt/libxl more verbose +mkdir -p /etc/systemd/system/libvirt-bin.service.d +cat > /etc/systemd/system/libvirt-bin.service.d/libxl-debug.conf <