Projet

Général

Profil

Cluster with libvirt » Historique » Version 4

Version 3 (Mehdi Abaakouk, 05/06/2020 11:10) → Version 4/22 (Mehdi Abaakouk, 05/06/2020 11:12)

{{>toc}}

h1. Cluster with libvirt

h2. Fontionnement

Les VM utilisent le mode ethernet de libvirt. En gros libvirt s'attends à trouver un tap tout près pour y accrocher la VM

Just avant le boot de la VM libvirt lance:

<pre> /etc/libvirt/hooks/qemu <VM_NAME> prepare begin</pre>

Et juste après l'arret de la VM libvirt lance:

<pre> /etc/libvirt/hooks/qemu <VM_NAME> release end</pre>

Le script /etc/libvirt/hooks/qemu de ttnn se trouve ici: https://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppetmaster/revisions/master/entry/environments/production/manifests/files/openstack/libvirt-hooks-qemu

Ce script va lire les metadatas TTNN de <VM_NAME> (e.g: virsh metadata <VM_NAME> http://tetaneutral.net/)

<pre>
$ virsh metadata ns2.tetaneutral.net http://tetaneutral.net/
<config>
<tap name="tapb0b4a106-d0">89.234.156.248</tap>
<tap name="tapabababab-aa">89.234.156.45</tap>
</config>
</pre>

Ensuite il va créé le tap et configurer les routes dessus avec les infos des metadata.

h2. Migration from Openstack

* virsh dumpxml $id > myvm.xml


* delete openstack VM (or just mark it as deleted in openstack
on openstack.t server:

<pre>
$ mysql
nova -e "update instances set deleted=1 where display_name = 'ns2.tetaneutral.net';"
</pre>

DB)
* edit myvm.xml
* change name to <my_new_name>
* remove uuid on top and uuid in sysinfo/system/entry[name=uuid]
* change domain/devices/interface/@type == ethernet (instead of bridge)
* remove <bridge ***> in domain/devices/interface
* On top in metadata add (tap names is located in domain/devices/interface/@type):
<ttnn:config xmlns:ttnn="http://tetaneutral.net/">
<ttnn:tap name="tapb0b4a106-d0">89.234.156.248</ttnn:tap>
</ttnn:config>
* On top in metadata remove <nova:instance ...></nova:instance> section

* virsh destroy $id
* virsh undefine $id
* virsh define myvm.xml
* virsh start <my_new_name>