From 3ff5b9114e07349bb4a4b5578394bd799950dcf6 Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Sat, 7 Nov 2015 00:38:58 -0600 Subject: added ubuntu charm for local deployment charm to configure the network according to the labs. Change-Id: I103b6dc243f025a4916d1057c247d01ee8f175ee --- ci/trusty/ubuntu-nodes-compute/README | 3 + ci/trusty/ubuntu-nodes-compute/copyright | 17 ++ ci/trusty/ubuntu-nodes-compute/hooks/install | 30 +++ ci/trusty/ubuntu-nodes-compute/icon.svg | 279 +++++++++++++++++++++ .../ubuntu-nodes-compute/lxc/add-more-interface | 52 ++++ .../ubuntu-nodes-compute/lxc/add-more-interfaces | 52 ++++ .../lxc/ubuntu-cloud.trusty.conf | 2 + ci/trusty/ubuntu-nodes-compute/metadata.yaml | 7 + .../ubuntu-nodes-compute/network/interfaces.host | 36 +++ ci/trusty/ubuntu-nodes-compute/revision | 1 + ci/trusty/ubuntu-nodes-controller/README | 3 + ci/trusty/ubuntu-nodes-controller/copyright | 17 ++ ci/trusty/ubuntu-nodes-controller/hooks/install | 30 +++ ci/trusty/ubuntu-nodes-controller/icon.svg | 279 +++++++++++++++++++++ .../ubuntu-nodes-controller/lxc/add-more-interface | 52 ++++ .../lxc/add-more-interfaces | 52 ++++ .../lxc/ubuntu-cloud.trusty.conf | 2 + ci/trusty/ubuntu-nodes-controller/metadata.yaml | 7 + .../network/interfaces.host | 36 +++ ci/trusty/ubuntu-nodes-controller/revision | 1 + 20 files changed, 958 insertions(+) create mode 100644 ci/trusty/ubuntu-nodes-compute/README create mode 100644 ci/trusty/ubuntu-nodes-compute/copyright create mode 100755 ci/trusty/ubuntu-nodes-compute/hooks/install create mode 100644 ci/trusty/ubuntu-nodes-compute/icon.svg create mode 100755 ci/trusty/ubuntu-nodes-compute/lxc/add-more-interface create mode 100755 ci/trusty/ubuntu-nodes-compute/lxc/add-more-interfaces create mode 100644 ci/trusty/ubuntu-nodes-compute/lxc/ubuntu-cloud.trusty.conf create mode 100644 ci/trusty/ubuntu-nodes-compute/metadata.yaml create mode 100644 ci/trusty/ubuntu-nodes-compute/network/interfaces.host create mode 100644 ci/trusty/ubuntu-nodes-compute/revision create mode 100644 ci/trusty/ubuntu-nodes-controller/README create mode 100644 ci/trusty/ubuntu-nodes-controller/copyright create mode 100755 ci/trusty/ubuntu-nodes-controller/hooks/install create mode 100644 ci/trusty/ubuntu-nodes-controller/icon.svg create mode 100755 ci/trusty/ubuntu-nodes-controller/lxc/add-more-interface create mode 100755 ci/trusty/ubuntu-nodes-controller/lxc/add-more-interfaces create mode 100644 ci/trusty/ubuntu-nodes-controller/lxc/ubuntu-cloud.trusty.conf create mode 100644 ci/trusty/ubuntu-nodes-controller/metadata.yaml create mode 100644 ci/trusty/ubuntu-nodes-controller/network/interfaces.host create mode 100644 ci/trusty/ubuntu-nodes-controller/revision (limited to 'ci/trusty') diff --git a/ci/trusty/ubuntu-nodes-compute/README b/ci/trusty/ubuntu-nodes-compute/README new file mode 100644 index 00000000..1a73633f --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/README @@ -0,0 +1,3 @@ +You need to edit: + * network/interfaces.host + * lxc/add-more-interfaces diff --git a/ci/trusty/ubuntu-nodes-compute/copyright b/ci/trusty/ubuntu-nodes-compute/copyright new file mode 100644 index 00000000..43e04d48 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/copyright @@ -0,0 +1,17 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: * +Copyright: Copyright 2012, Canonical Ltd., All Rights Reserved. +License: GPL-3 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . diff --git a/ci/trusty/ubuntu-nodes-compute/hooks/install b/ci/trusty/ubuntu-nodes-compute/hooks/install new file mode 100755 index 00000000..17265f56 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/hooks/install @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e +set -u + +## install lxc pre-configuration to setup multiple interfaces +status-set maintenance "setting up lxc clone hook" || true +mkdir -p /usr/local/share/lxc/hooks/ +install -m 755 lxc/add-more-interfaces /usr/local/share/lxc/hooks/ + +dpkg-divert --local \ + --divert /usr/share/lxc/config/ubuntu-cloud.trusty.conf.ubuntu.orig \ + --add /usr/share/lxc/config/ubuntu-cloud.trusty.conf +mkdir -p /usr/share/lxc/config/ +install -m 644 lxc/ubuntu-cloud.trusty.conf /usr/share/lxc/config/ + +## network interfaces +status-set maintenance "setting up network interfaces" || true +apt-get update || true +apt-get install -y ifenslave ethtool bridge-utils vlan + +if ! grep -q 8021q /etc/modules; then + echo 8021q >> /etc/modules +fi + +## write /etc/network/interfaces for the host +install -m 644 network/interfaces.host /etc/network/interfaces +ifup -a + +status-set active || true diff --git a/ci/trusty/ubuntu-nodes-compute/icon.svg b/ci/trusty/ubuntu-nodes-compute/icon.svg new file mode 100644 index 00000000..a5576ed2 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/icon.svg @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/ci/trusty/ubuntu-nodes-compute/lxc/add-more-interface b/ci/trusty/ubuntu-nodes-compute/lxc/add-more-interface new file mode 100755 index 00000000..c9bca9fd --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/lxc/add-more-interface @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e +set -u + +cat <> "$LXC_CONFIG_FILE" + +## added by juju charm +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brData +lxc.network.name = eth1 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') + +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brPublic +lxc.network.name = eth2 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') +EOF + +USERDATA="$LXC_ROOTFS_PATH/var/lib/cloud/seed/nocloud-net/user-data" + +additional_interfaces=" +- | + cat <> /etc/network/interfaces.d/additional-interfaces + ## added by juju charm + ## those interfaces will be brought up by the upstart job as /etc/init/additional-interfaces.conf + ## LP: #1483932 + auto eth1 + iface eth1 inet dhcp + + auto eth2 + iface eth2 inet dhcp + EOF +- machine_agent=\$(hostname | sed -e 's/^juju-/jujud-/') +- | + cat < /etc/init/additional-interfaces.conf + ## added by juju charm + ## LP: #1483932 + start on started \${machine_agent} + + script + sleep 10 + ifup -a -i /etc/network/interfaces.d/additional-interfaces + end script + EOF +" +additional_interfaces=$(echo "$additional_interfaces" | sed -e 's/$/\\n/' | tr -d '\n') + +sed -i.orig -e "s@^runcmd:@\0$additional_interfaces@" \ + "$USERDATA" diff --git a/ci/trusty/ubuntu-nodes-compute/lxc/add-more-interfaces b/ci/trusty/ubuntu-nodes-compute/lxc/add-more-interfaces new file mode 100755 index 00000000..c9bca9fd --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/lxc/add-more-interfaces @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e +set -u + +cat <> "$LXC_CONFIG_FILE" + +## added by juju charm +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brData +lxc.network.name = eth1 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') + +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brPublic +lxc.network.name = eth2 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') +EOF + +USERDATA="$LXC_ROOTFS_PATH/var/lib/cloud/seed/nocloud-net/user-data" + +additional_interfaces=" +- | + cat <> /etc/network/interfaces.d/additional-interfaces + ## added by juju charm + ## those interfaces will be brought up by the upstart job as /etc/init/additional-interfaces.conf + ## LP: #1483932 + auto eth1 + iface eth1 inet dhcp + + auto eth2 + iface eth2 inet dhcp + EOF +- machine_agent=\$(hostname | sed -e 's/^juju-/jujud-/') +- | + cat < /etc/init/additional-interfaces.conf + ## added by juju charm + ## LP: #1483932 + start on started \${machine_agent} + + script + sleep 10 + ifup -a -i /etc/network/interfaces.d/additional-interfaces + end script + EOF +" +additional_interfaces=$(echo "$additional_interfaces" | sed -e 's/$/\\n/' | tr -d '\n') + +sed -i.orig -e "s@^runcmd:@\0$additional_interfaces@" \ + "$USERDATA" diff --git a/ci/trusty/ubuntu-nodes-compute/lxc/ubuntu-cloud.trusty.conf b/ci/trusty/ubuntu-nodes-compute/lxc/ubuntu-cloud.trusty.conf new file mode 100644 index 00000000..b7636b58 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/lxc/ubuntu-cloud.trusty.conf @@ -0,0 +1,2 @@ +## added by juju charm +lxc.hook.clone = /usr/local/share/lxc/hooks/add-more-interfaces diff --git a/ci/trusty/ubuntu-nodes-compute/metadata.yaml b/ci/trusty/ubuntu-nodes-compute/metadata.yaml new file mode 100644 index 00000000..8a57c088 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/metadata.yaml @@ -0,0 +1,7 @@ +name: ubuntu-nodes-controller +summary: A pristine Ubuntu Server +maintainer: Charmers +description: | + This simply deploys Ubuntu Server. +tags: + - misc diff --git a/ci/trusty/ubuntu-nodes-compute/network/interfaces.host b/ci/trusty/ubuntu-nodes-compute/network/interfaces.host new file mode 100644 index 00000000..9377814c --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/network/interfaces.host @@ -0,0 +1,36 @@ +#### original juju generated part #### +auto lo + +# Primary interface (defining the default route) +iface eth0 inet manual + +# Bridge to use for LXC/KVM containers +auto juju-br0 +iface juju-br0 inet dhcp + bridge_ports eth0 +###################################### + +auto eth2 +iface eth2 inet manual + +auto eth2.721 +iface eth2.721 inet manual + +auto brData +iface brData inet dhcp + bridge_ports eth2.721 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 + +# The public network interface +auto eth2.724 +iface eth2.724 inet manual + +auto brPublic +iface brPublic inet dhcp + bridge_ports eth2.724 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 + diff --git a/ci/trusty/ubuntu-nodes-compute/revision b/ci/trusty/ubuntu-nodes-compute/revision new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/ci/trusty/ubuntu-nodes-compute/revision @@ -0,0 +1 @@ +1 diff --git a/ci/trusty/ubuntu-nodes-controller/README b/ci/trusty/ubuntu-nodes-controller/README new file mode 100644 index 00000000..1a73633f --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/README @@ -0,0 +1,3 @@ +You need to edit: + * network/interfaces.host + * lxc/add-more-interfaces diff --git a/ci/trusty/ubuntu-nodes-controller/copyright b/ci/trusty/ubuntu-nodes-controller/copyright new file mode 100644 index 00000000..43e04d48 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/copyright @@ -0,0 +1,17 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: * +Copyright: Copyright 2012, Canonical Ltd., All Rights Reserved. +License: GPL-3 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . diff --git a/ci/trusty/ubuntu-nodes-controller/hooks/install b/ci/trusty/ubuntu-nodes-controller/hooks/install new file mode 100755 index 00000000..17265f56 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/hooks/install @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e +set -u + +## install lxc pre-configuration to setup multiple interfaces +status-set maintenance "setting up lxc clone hook" || true +mkdir -p /usr/local/share/lxc/hooks/ +install -m 755 lxc/add-more-interfaces /usr/local/share/lxc/hooks/ + +dpkg-divert --local \ + --divert /usr/share/lxc/config/ubuntu-cloud.trusty.conf.ubuntu.orig \ + --add /usr/share/lxc/config/ubuntu-cloud.trusty.conf +mkdir -p /usr/share/lxc/config/ +install -m 644 lxc/ubuntu-cloud.trusty.conf /usr/share/lxc/config/ + +## network interfaces +status-set maintenance "setting up network interfaces" || true +apt-get update || true +apt-get install -y ifenslave ethtool bridge-utils vlan + +if ! grep -q 8021q /etc/modules; then + echo 8021q >> /etc/modules +fi + +## write /etc/network/interfaces for the host +install -m 644 network/interfaces.host /etc/network/interfaces +ifup -a + +status-set active || true diff --git a/ci/trusty/ubuntu-nodes-controller/icon.svg b/ci/trusty/ubuntu-nodes-controller/icon.svg new file mode 100644 index 00000000..a5576ed2 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/icon.svg @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/ci/trusty/ubuntu-nodes-controller/lxc/add-more-interface b/ci/trusty/ubuntu-nodes-controller/lxc/add-more-interface new file mode 100755 index 00000000..c9bca9fd --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/lxc/add-more-interface @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e +set -u + +cat <> "$LXC_CONFIG_FILE" + +## added by juju charm +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brData +lxc.network.name = eth1 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') + +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brPublic +lxc.network.name = eth2 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') +EOF + +USERDATA="$LXC_ROOTFS_PATH/var/lib/cloud/seed/nocloud-net/user-data" + +additional_interfaces=" +- | + cat <> /etc/network/interfaces.d/additional-interfaces + ## added by juju charm + ## those interfaces will be brought up by the upstart job as /etc/init/additional-interfaces.conf + ## LP: #1483932 + auto eth1 + iface eth1 inet dhcp + + auto eth2 + iface eth2 inet dhcp + EOF +- machine_agent=\$(hostname | sed -e 's/^juju-/jujud-/') +- | + cat < /etc/init/additional-interfaces.conf + ## added by juju charm + ## LP: #1483932 + start on started \${machine_agent} + + script + sleep 10 + ifup -a -i /etc/network/interfaces.d/additional-interfaces + end script + EOF +" +additional_interfaces=$(echo "$additional_interfaces" | sed -e 's/$/\\n/' | tr -d '\n') + +sed -i.orig -e "s@^runcmd:@\0$additional_interfaces@" \ + "$USERDATA" diff --git a/ci/trusty/ubuntu-nodes-controller/lxc/add-more-interfaces b/ci/trusty/ubuntu-nodes-controller/lxc/add-more-interfaces new file mode 100755 index 00000000..c9bca9fd --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/lxc/add-more-interfaces @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e +set -u + +cat <> "$LXC_CONFIG_FILE" + +## added by juju charm +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brData +lxc.network.name = eth1 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') + +lxc.network.type = veth +lxc.network.flags = up +lxc.network.link = brPublic +lxc.network.name = eth2 +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') +EOF + +USERDATA="$LXC_ROOTFS_PATH/var/lib/cloud/seed/nocloud-net/user-data" + +additional_interfaces=" +- | + cat <> /etc/network/interfaces.d/additional-interfaces + ## added by juju charm + ## those interfaces will be brought up by the upstart job as /etc/init/additional-interfaces.conf + ## LP: #1483932 + auto eth1 + iface eth1 inet dhcp + + auto eth2 + iface eth2 inet dhcp + EOF +- machine_agent=\$(hostname | sed -e 's/^juju-/jujud-/') +- | + cat < /etc/init/additional-interfaces.conf + ## added by juju charm + ## LP: #1483932 + start on started \${machine_agent} + + script + sleep 10 + ifup -a -i /etc/network/interfaces.d/additional-interfaces + end script + EOF +" +additional_interfaces=$(echo "$additional_interfaces" | sed -e 's/$/\\n/' | tr -d '\n') + +sed -i.orig -e "s@^runcmd:@\0$additional_interfaces@" \ + "$USERDATA" diff --git a/ci/trusty/ubuntu-nodes-controller/lxc/ubuntu-cloud.trusty.conf b/ci/trusty/ubuntu-nodes-controller/lxc/ubuntu-cloud.trusty.conf new file mode 100644 index 00000000..b7636b58 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/lxc/ubuntu-cloud.trusty.conf @@ -0,0 +1,2 @@ +## added by juju charm +lxc.hook.clone = /usr/local/share/lxc/hooks/add-more-interfaces diff --git a/ci/trusty/ubuntu-nodes-controller/metadata.yaml b/ci/trusty/ubuntu-nodes-controller/metadata.yaml new file mode 100644 index 00000000..8a57c088 --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/metadata.yaml @@ -0,0 +1,7 @@ +name: ubuntu-nodes-controller +summary: A pristine Ubuntu Server +maintainer: Charmers +description: | + This simply deploys Ubuntu Server. +tags: + - misc diff --git a/ci/trusty/ubuntu-nodes-controller/network/interfaces.host b/ci/trusty/ubuntu-nodes-controller/network/interfaces.host new file mode 100644 index 00000000..9377814c --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/network/interfaces.host @@ -0,0 +1,36 @@ +#### original juju generated part #### +auto lo + +# Primary interface (defining the default route) +iface eth0 inet manual + +# Bridge to use for LXC/KVM containers +auto juju-br0 +iface juju-br0 inet dhcp + bridge_ports eth0 +###################################### + +auto eth2 +iface eth2 inet manual + +auto eth2.721 +iface eth2.721 inet manual + +auto brData +iface brData inet dhcp + bridge_ports eth2.721 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 + +# The public network interface +auto eth2.724 +iface eth2.724 inet manual + +auto brPublic +iface brPublic inet dhcp + bridge_ports eth2.724 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 + diff --git a/ci/trusty/ubuntu-nodes-controller/revision b/ci/trusty/ubuntu-nodes-controller/revision new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/ci/trusty/ubuntu-nodes-controller/revision @@ -0,0 +1 @@ +1 -- cgit 1.2.3-korg