Projet

Général

Profil

Cluster with libvirt » Historique » Version 6

Version 5 (Mehdi Abaakouk, 05/06/2020 11:13) → Version 6/22 (Mehdi Abaakouk, 05/06/2020 14:57)

{{>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

* convert-openstack-vm-to-libvirt 3fdad88a-dc5e-45a5-9e13-751178e15690 91.224.148.201 virsh dumpxml $id > myvm.xml

* delete VM in openstack
on openstack.t server:

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

* 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):

<pre>
<ttnn:config xmlns:ttnn="http://tetaneutral.net/">
<ttnn:tap name="tapb0b4a106-d0">89.234.156.248</ttnn:tap>
</ttnn:config>
</pre>

(IP can be found on djadhere or g1:/root/sileht/debug/nova_list)
* 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>