Projet

Général

Profil

Cluster with libvirt » Historique » Version 4

« Précédent - Version 4/22 (diff) - Suivant » - Version actuelle
Mehdi Abaakouk, 05/06/2020 11:12


Cluster with libvirt

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:

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

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

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

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/)

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

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

Migration from Openstack

  • virsh dumpxml $id > myvm.xml
  • delete VM in openstack
    on openstack.t server:
      $ mysql nova -e "update instances set deleted=1 where display_name = 'ns2.tetaneutral.net';" 
      
  • 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>