Projet

Général

Profil

Cluster with libvirt » Historique » Version 14

Version 13 (Mehdi Abaakouk, 08/06/2020 15:05) → Version 14/22 (Laurent GUERBY, 28/06/2020 15:23)

{{>toc}}

h1. Cluster with libvirt

h2. Tooling

<pre>

# cd /root/tools/libvirt/

# ./autovirsh domuuid gizmo.sileht.net
Domain gizmo.sileht.net is on g3
4baace2f-6d7c-4575-8982-bedb6065ab6b

# ./where www.tetaneutral.net
Domain www.tetaneutral.net is on g1

# ./create-vm --help
usage: create-vm --ip IP NAME
--image debian-buster-scsi
--ram 1 # SIZE in GiB
--vcpu 1
--ip <IPV4>
--disk 20 # SIZE in GiB
--on g1 # short name of the host

# ./migrate --help
usage: migrate NAME DEST

# ./info gizmo.sileht.net
Domain gizmo.sileht.net is on g3
Interface Type Source Model MAC
-------------------------------------------------------
tap249cbb03-b8 ethernet - virtio fa:16:3e:88:4d:0b

Target Source
------------------------------------------------
hda ssds/97c925e4-9f3e-4b92-96b9-6190e0fc4b88_disk.config
sda ssds/volume-0973c10d-79c8-4906-9f9c-9ba33118203d
sdb disks/volume-3657e47a-07d8-4052-8dcf-cb7a0fb19b20

<config>
<tap name="tap249cbb03-b8">91.224.149.214</tap>
</config>

</pre>

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>
<network mode="routed">
<tap name="tapb0b4a106-d0">89.234.156.248</tap>
<tap name="tapabababab-aa">89.234.156.45</tap>
</network>
</config>
</pre>

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



h2. git

https://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/openstack-tools

libvirt

h2. Misc

h3. Editer le disque d'une VM

<pre>
VM=xxx
virsh shutdown $VM
virsh destroy $VM # si shutdown marche pas
guestfish --ro -i -d $VM
</pre>