Projet

Général

Profil

Openstack Installation TTNN » Historique » Version 24

Version 23 (Mehdi Abaakouk, 06/08/2014 13:36) → Version 24/252 (Mehdi Abaakouk, 06/08/2014 13:43)

h1. Openstack Installation TTNN

h2. Pending upstream fixes:

* build-debian-openstack-images, changes should be in next package version:
** Fix extlinux installation on jessie: http://anonscm.debian.org/cgit/openstack/openstack-debian-images.git/commit/?id=1a4ddceb99fb66f42f79e87a183d8e96952e5ac3
** Fix cloud-init setup with configdrive: http://anonscm.debian.org/cgit/openstack/openstack-debian-images.git/commit/?id=15cce87e2fa15b8952d69fb58711bfa88b21ef87
** Use Configdrive first for cloud-init: http://anonscm.debian.org/cgit/openstack/openstack-debian-images.git/commit/?id=1b1e1093d5ee525426382ad29b8219ab58f6656d

* nova:
** Fix live-migration avec ceph and configdrive:: https://review.openstack.org/#/c/112014/, si la solution est mergé upstream, j'appliquerai le patch au package debian

h2. Installation

Le setup installé est composé de :

* 3 hyperviseurs (compute node) qui contiendront 1 ceph-mon, N ceph-osd, nova-compute (qui lance les VM), neutron-openvswitch-agent (qui configure le réseau des vms)
* 1 VM (controler node), qui contient tous les services de management d'openstack (nova, cinder, glance, neutron)

Les étapes d'installation sont les suivantes:
* Préparation manuelle de la VM de management sur un des hyperviseurs
* Installation de ceph et openstack sur toutes les machines avec puppet
* Déplacement de la VM de management d'openstack dans openstack.

h3. Preparation de la VM de management, le controlleur

h4. Installation des prérequis

<pre>
$ apt-get install libvirt-bin openstack-debian-images openvswitch-switch openvswitch-datapath-dkms virtinst
#NOTE(sileht): temporairement appliquer les patches de au-dessus à openstack-debian-images
</pre>

h4. Preparation de l'image de la VM

<pre>
$ vim hook.sh
set -xv

echo "openstack" > $BODI_CHROOT_PATH/etc/hostname

cat > $BODI_CHROOT_PATH/etc/resolv.conf <<EOF
domain tetaneutral.net
search tetaneutral.net
nameserver 8.8.8.8
EOF

cat > $BODI_CHROOT_PATH/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
pre-up /sbin/sysctl -w net.ipv6.conf.eth0.accept_ra=0
pre-up /sbin/sysctl -w net.ipv6.conf.eth0.autoconf=0
up ip link set eth0 up
up ip addr add 89.234.156.249/32 dev eth0
up ip route add 91.224.148.0/32 dev eth0
up ip route add default via 91.224.148.0

iface eth0 inet6 static
pre-up /sbin/sysctl -w net.ipv6.conf.eth0.accept_ra=0
pre-up /sbin/sysctl -w net.ipv6.conf.eth0.autoconf=0
address 2a01:6600:8083:f900::1
netmask 56
gateway fe80::31
EOF

mkdir -p $BODI_CHROOT_PATH/root/.ssh
chmod 600 $BODI_CHROOT_PATH/root/.ssh
cat >> $BODI_CHROOT_PATH/root/.ssh/authorized_keys <<EOF
ssh-dss AAAAB3NzaC1kc3MAAACBAJtnGLvuz4uVD6fnERDxDi/C0UyzwCiKmgNtEessopREYasAX4Gu6Fg10jAyIL5Nuc7YDnqj//pOfxNjD7hp99a2ZmkRQgh/ltClxYML9fqhBHgsUCpVse9nOYDHDnDgvXIPRSDUHat2UFpdchHVrFURNLIlZnBztsr+GCDURTV/AAAAFQD9SrBcH49ltaKOm6V5ssCPmgs1SwAAAIAbAvkQ3/tMzzdACO5B9s5Yb3ZuM7XImm0iqufivVf2Xy39g8HOBulUsN7eKEGPhVriqNolgIO7q7tVgYAff4/NE4yDP0Kp0SPg4tjt2yFJuL31Y3wzwHjnKrjgNlDSLl3uZnRXSipwUMwGKbdHB6NZSqlq192VKbHilQ00pbiMlAAAAIB5dfB1lVHkJ0o5CcaVQRPbca9DvbbRwnoTSmKHc5DUcqsPqDhS07CkM9ZcJuY1Nh4wGl4Q9kArj7Tnsvvygf/HReSUcIk4+nbDytJ8/pca/Qx4fzQQyppa94TylN62LSFT6MIJKLoMwYa0dQURT7Mv5+9Qj2vk5pZ38w2iQ9zVCg== root@h1
EOF

sed -i -e 's/^.*Port.*$/Port 2222/' -e 's/^[# ]*PasswordAuthentication.*$/PasswordAuthentication no/' $BODI_CHROOT_PATH/etc/ssh/sshd_config
chroot $BODI_CHROOT_PATH dpkg-reconfigure openssh-server
chroot $BODI_CHROOT_PATH apt-get purge -y cloud-init*
</pre>

<pre>
$ chmod +x hook.sh
$ build-openstack-debian-image --image-size 20 --release jessie -u http://apt.tetaneutral.net/debian/ -s http://apt.tetaneutral.net/debian/ --hook-script $(pwd)/hook.sh
$ mv debian-jessie-7.0.0-3-amd64.raw /openstack.raw
$ rm debian-jessie-7.0.0-3-amd64.qcow2
</pre>

_note: la derniere commande lancée par le script doit être 'qemu-img convert -c -f raw .... , sinon l'image de bootera pas_
_note(jessie): si l'erreur est celle ci-dessous, relancer manuellement 'kpartx -d debian-jessie-7.0.0-3-amd64.raw' jusqu'a ce que l'erreur disparaissent et le .raw est utilisable:_
<pre>
+ 'kpartx -d debian-jessie-7.0.0-3-amd64.raw'
device-mapper: remove ioctl on loop0p1 failed: Device or resource busy
loop deleted : /dev/loop0
</pre>

On garde l'image raw qui sera importable dans ceph plus tard et on la mets à la racine pour qui l'utilisateur libvirt puisse y accéder.

h4. Préparation du réseau

<pre>
$ ovs-vsctl add-br br-net
$ ip link set br-net up
$ ovs-vsctl br-set-external-id br-net bridge-id br-net
$ ip route add 89.234.156.249/32 dev br-net proto 42
$ ip -6 route add 2a01:6600:8083:f900::/56 dev br-net proto42
</pre>

h4. Installation de la VM

<pre>
$ virt-install --name openstack --ram 2048 --network bridge=br-net --nographics --serial pty --wait -1 --noreboot --autostart --disk /openstack.raw,bus=virtio,cache=none,io=native --import
$ EDITOR="sed -i -e \"s,<source bridge='br-net'/>,<source bridge='br-net'/><virtualport type='openvswitch' />,g\"" virsh edit openstack # Openvswitch is not yet supported by virt-install
$ virsh start openstack
$ ssh root@openstack.tetaneutral.net -p 2222
</pre>

Une fois connecté à la VM:

<pre>
$ apt-get install puppet
$ puppet agent --enable
$ puppet agent -vt --server puppet.tetaneutral.net openstack.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for openstack.tetaneutral.net
Info: Certificate Request fingerprint (SHA256): AE:72:47:40:A0:E2:F4:59:BA:39:FA:3D:C2:A7:C9:1B:9F:87:A5:B7:65:3A:F9:D4:DE:AF:E2:A3:02:41:0F:2E
Info: Caching certificate for ca
Exiting; no failed to retrieve certificate found and waitforcert is disabled
</pre>

Sur le puppetmaster:

<pre>
$ puppet ca sign openstack.tetaneutral.net
</pre>
_Note: si un vieux cert existe: puppet node clean openstack.tetaneutral.net _

De nouveau sur la VM:

<pre>
$ puppet agent -vt --server puppet.tetaneutral.net openstack.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync
</pre>

h2. Management d'openstack

h3. Build and upload debian image:

<pre>
$ apt-get install openstack-debian-images
#NOTE(sileht): temporairement appliquer les patches de au-dessus
$ build-openstack-debian-image -m -r jessie -u http://apt.tetaneutral.net/debian/ -s http://apt.tetaneutral.net/debian/
$ glance image-create --file debian-jessie-7.0.0-3-amd64.raw --is-public True --human-readable --progress --disk-format raw --container-format bare --name debian-jessie-amd64
</pre>