6. Extension d'OpenStack
Ajout d'un noeud de calcul
- 1. Préalable : script de nettoyage
- 2. Arrêt de la topologie
- 3. Clonage de compute1 en compute2
- 4. Configuration du second noeud de calcul
- 5. Configuration de controller et compute1
- 6. Modification du démon Nova sur compute2
1. Préalable : script de nettoyage
Avant tout chose, il faut remettre le lab en l'état avec le script de nettoyage
2. Arrêt de la topologie
Arrêt des noeuds VirtualBox
vboxmanage controlvm 'controller' poweroff
vboxmanage controlvm 'compute1' poweroff
Vérification
vboxmanage list runningvms
Arrêt des noeuds KVM
virsh shutdown compute1
virsh shutdown controller
Il est même préférable de les arrêter proprement.
Vérification
virsh list --all
Id Name State
----------------------------------------------------
- compute1 shut off
- compute2 shut off
3. Clonage de compute1 en compute2
Clonage avec Virtualbox
vboxmanage clonevm "compute1" --name "compute2" --register
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Machine has been successfully cloned as "compute2"
Vérification
vboxmanage list vms
"controller" {23767382-d461-4814-9df3-7bdfe1736d5d}
"compute1" {438befcf-0ff7-45f1-92f6-dc41571035a9}
"compute2" {22165656-5b6a-4040-9072-6a29e20b002d}
Modification du port d'accès
vboxmanage modifyvm "compute2" --natpf1 delete ssh
vboxmanage modifyvm "compute2" --natpf1 ssh,tcp,127.0.0.1,2233,,22
Clonage avec KVM
virt-clone --original 'compute1' --name 'compute2' --auto-clone
Allocating 'compute1-sda-clone' | 9.8 GB 00:00:18
Allocating 'compute1-sdb-clone' | 125 GB 00:00:00
Clone 'compute2' created successfully.
Vérification
virsh list --all
Id Name State
----------------------------------------------------
- compute1 shut off
- compute2 shut off
- controller shut off
4. Configuration du second noeud de calcul
Démarrage de compute2 avec Virtualbox
vboxmanage startvm "compute2" --type headless
Connexion à compute2
ssh osbash@localhost -p 2233
Démarrage de compute2 avec KVM
virsh start compute2
Vérification
virsh list --all
Id Name State
----------------------------------------------------
9 compute2 running
- compute1 shut off
- controller shut off
Après quelques instants, on obtient l'adresse IPv4 du noeud :
virsh net-dhcp-leases default
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID
-------------------------------------------------------------------------------------------------------------------
2019-03-10 11:40:43 52:54:00:f3:f7:0f ipv4 192.168.122.221/24 compute1 -
Connexion à compute2
ssh osbash@192.168.122.221
Fichiers à modifier
/etc/hosts
/etc/hostname
/etc/network/interfaces
sudo su
sed -i 's/compute1-lo/compute2-lo/g' /etc/hosts
echo -e "\n# compute2\n10.0.0.32 compute2" >> /etc/hosts
echo "compute2" > /etc/hostname
sed -i 's/31/32/g' /etc/network/interfaces
Redémarrage du noeud compute2
sudo shutdown -r now
Vérification
stack@stacktrain1:~$ ssh osbash@localhost -p2233
osbash@localhost s password:
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-142-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Mon Mar 4 06:51:23 2019 from 10.0.2.2
osbash@compute2:~$
5. Configuration de controller et compute1
Démarrage de controller et compute1 avec virtualbox
vboxmanage startvm "controller" --type headless
Waiting for VM "controller" to power on...
VM "controller" has been successfully started.
vboxmanage startvm "compute1" --type headless
Waiting for VM "compute1" to power on...
VM "compute1" has been successfully started.
vboxmanage list runningvms
"controller" {23767382-d461-4814-9df3-7bdfe1736d5d}
"compute1" {438befcf-0ff7-45f1-92f6-dc41571035a9}
"compute2" {22165656-5b6a-4040-9072-6a29e20b002d}
Démarrage de controller et compute1 avec KVM
virsh start compute1
virsh start controller
Vérification
virsh list --all
Id Name State
----------------------------------------------------
9 compute2 running
10 compute1 running
11 controller running
virsh net-dhcp-leases default
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID
-------------------------------------------------------------------------------------------------------------------
2019-03-10 11:45:53 52:54:00:45:dc:eb ipv4 192.168.122.230/24 controller -
2019-03-10 11:45:46 52:54:00:a3:06:5b ipv4 192.168.122.222/24 compute1 -
2019-03-10 11:44:35 52:54:00:f3:f7:0f ipv4 192.168.122.221/24 compute2 -
Configuration de controller et compute1
Ajouter une entrée pour "compute2" dans le fichier /etc/hosts
de "controller" et dans celui de "compute1"
sudo su
echo -e "\n# compute2\n10.0.0.32 compute2" >> /etc/hosts
6. Modification du démon Nova sur compute2
stack@stacktrain1:~$ ssh osbash@localhost -p2233
osbash@localhost s password:
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-142-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Mon Mar 4 07:06:27 2019 from 10.0.2.2
sudo sed -i.bak 's/10.0.0.31/10.0.0.32/' /etc/nova/nova.conf
sudo diff /etc/nova/nova.conf.bak /etc/nova/nova.conf
4c4
< my_ip = 10.0.0.31
---
> my_ip = 10.0.0.32
sudo systemctl restart nova-compute
sudo systemctl status nova-compute | head -3
* nova-compute.service - OpenStack Compute
Loaded: loaded (/lib/systemd/system/nova-compute.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-03-04 07:13:31 UTC; 5s ago
Vérification à partir de "controller"
osbash@controller:~$ . admin-openrc.sh
osbash@controller:~$ openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-scheduler | controller | internal | enabled | up | 2019-03-10T10:51:18.000000 |
| 2 | nova-consoleauth | controller | internal | enabled | up | 2019-03-10T10:51:23.000000 |
| 7 | nova-conductor | controller | internal | enabled | up | 2019-03-10T10:51:26.000000 |
| 8 | nova-compute | compute1 | nova | enabled | up | 2019-03-10T10:51:25.000000 |
| 9 | nova-compute | compute2 | nova | enabled | up | 2019-03-10T10:51:18.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
osbash@controller:~$