Cluster with libvirt » Historique » Version 11
Laurent GUERBY, 07/06/2020 06:45
1 | 1 | Mehdi Abaakouk | {{>toc}} |
---|---|---|---|
2 | 1 | Mehdi Abaakouk | |
3 | 1 | Mehdi Abaakouk | h1. Cluster with libvirt |
4 | 1 | Mehdi Abaakouk | |
5 | 9 | Mehdi Abaakouk | |
6 | 9 | Mehdi Abaakouk | |
7 | 9 | Mehdi Abaakouk | |
8 | 9 | Mehdi Abaakouk | h2. Tooling |
9 | 9 | Mehdi Abaakouk | |
10 | 9 | Mehdi Abaakouk | <pre> |
11 | 9 | Mehdi Abaakouk | |
12 | 9 | Mehdi Abaakouk | # cd /root/tools/libvirt/ |
13 | 9 | Mehdi Abaakouk | |
14 | 9 | Mehdi Abaakouk | # ./autovirsh domuuid gizmo.sileht.net |
15 | 9 | Mehdi Abaakouk | Domain gizmo.sileht.net is on g3 |
16 | 9 | Mehdi Abaakouk | 4baace2f-6d7c-4575-8982-bedb6065ab6b |
17 | 9 | Mehdi Abaakouk | |
18 | 9 | Mehdi Abaakouk | # ./where www.tetaneutral.net |
19 | 9 | Mehdi Abaakouk | Domain www.tetaneutral.net is on g1 |
20 | 9 | Mehdi Abaakouk | |
21 | 9 | Mehdi Abaakouk | # ./create-vm --help |
22 | 9 | Mehdi Abaakouk | usage: create-vm --ip IP NAME |
23 | 9 | Mehdi Abaakouk | --image debian-buster-scsi |
24 | 9 | Mehdi Abaakouk | --ram 1 # SIZE in GiB |
25 | 9 | Mehdi Abaakouk | --vcpu 1 |
26 | 9 | Mehdi Abaakouk | --ip <IPV4> |
27 | 9 | Mehdi Abaakouk | --disk 20 # SIZE in GiB |
28 | 9 | Mehdi Abaakouk | --on g1 # short name of the host |
29 | 9 | Mehdi Abaakouk | |
30 | 9 | Mehdi Abaakouk | # ./migrate --help |
31 | 9 | Mehdi Abaakouk | usage: migrate NAME DEST |
32 | 9 | Mehdi Abaakouk | |
33 | 9 | Mehdi Abaakouk | |
34 | 10 | Mehdi Abaakouk | # ./info gizmo.sileht.net |
35 | 10 | Mehdi Abaakouk | Domain gizmo.sileht.net is on g3 |
36 | 10 | Mehdi Abaakouk | Interface Type Source Model MAC |
37 | 10 | Mehdi Abaakouk | ------------------------------------------------------- |
38 | 10 | Mehdi Abaakouk | tap249cbb03-b8 ethernet - virtio fa:16:3e:88:4d:0b |
39 | 10 | Mehdi Abaakouk | |
40 | 10 | Mehdi Abaakouk | Target Source |
41 | 10 | Mehdi Abaakouk | ------------------------------------------------ |
42 | 10 | Mehdi Abaakouk | hda ssds/97c925e4-9f3e-4b92-96b9-6190e0fc4b88_disk.config |
43 | 10 | Mehdi Abaakouk | sda ssds/volume-0973c10d-79c8-4906-9f9c-9ba33118203d |
44 | 10 | Mehdi Abaakouk | sdb disks/volume-3657e47a-07d8-4052-8dcf-cb7a0fb19b20 |
45 | 10 | Mehdi Abaakouk | |
46 | 10 | Mehdi Abaakouk | <config> |
47 | 10 | Mehdi Abaakouk | <tap name="tap249cbb03-b8">91.224.149.214</tap> |
48 | 10 | Mehdi Abaakouk | </config> |
49 | 10 | Mehdi Abaakouk | |
50 | 10 | Mehdi Abaakouk | |
51 | 10 | Mehdi Abaakouk | |
52 | 9 | Mehdi Abaakouk | </pre> |
53 | 9 | Mehdi Abaakouk | |
54 | 1 | Mehdi Abaakouk | h2. Fontionnement |
55 | 1 | Mehdi Abaakouk | |
56 | 1 | Mehdi Abaakouk | Les VM utilisent le mode ethernet de libvirt. En gros libvirt s'attends à trouver un tap tout près pour y accrocher la VM |
57 | 1 | Mehdi Abaakouk | |
58 | 1 | Mehdi Abaakouk | Just avant le boot de la VM libvirt lance: |
59 | 1 | Mehdi Abaakouk | |
60 | 1 | Mehdi Abaakouk | <pre> /etc/libvirt/hooks/qemu <VM_NAME> prepare begin</pre> |
61 | 1 | Mehdi Abaakouk | |
62 | 1 | Mehdi Abaakouk | Et juste après l'arret de la VM libvirt lance: |
63 | 1 | Mehdi Abaakouk | |
64 | 1 | Mehdi Abaakouk | <pre> /etc/libvirt/hooks/qemu <VM_NAME> release end</pre> |
65 | 1 | Mehdi Abaakouk | |
66 | 1 | Mehdi Abaakouk | |
67 | 1 | Mehdi Abaakouk | 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 |
68 | 2 | Mehdi Abaakouk | |
69 | 2 | Mehdi Abaakouk | |
70 | 2 | Mehdi Abaakouk | Ce script va lire les metadatas TTNN de <VM_NAME> (e.g: virsh metadata <VM_NAME> http://tetaneutral.net/) |
71 | 2 | Mehdi Abaakouk | |
72 | 2 | Mehdi Abaakouk | <pre> |
73 | 2 | Mehdi Abaakouk | $ virsh metadata ns2.tetaneutral.net http://tetaneutral.net/ |
74 | 2 | Mehdi Abaakouk | <config> |
75 | 7 | Mehdi Abaakouk | <network mode="routed"> |
76 | 7 | Mehdi Abaakouk | <tap name="tapb0b4a106-d0">89.234.156.248</tap> |
77 | 7 | Mehdi Abaakouk | <tap name="tapabababab-aa">89.234.156.45</tap> |
78 | 7 | Mehdi Abaakouk | </network> |
79 | 2 | Mehdi Abaakouk | </config> |
80 | 2 | Mehdi Abaakouk | </pre> |
81 | 2 | Mehdi Abaakouk | |
82 | 2 | Mehdi Abaakouk | Ensuite il va créé le tap et configurer les routes dessus avec les infos des metadata. |
83 | 1 | Mehdi Abaakouk | |
84 | 3 | Mehdi Abaakouk | h2. Migration from Openstack |
85 | 1 | Mehdi Abaakouk | |
86 | 6 | Mehdi Abaakouk | * convert-openstack-vm-to-libvirt 3fdad88a-dc5e-45a5-9e13-751178e15690 91.224.148.201 |
87 | 8 | Mehdi Abaakouk | |
88 | 8 | Mehdi Abaakouk | h2. Live migration |
89 | 8 | Mehdi Abaakouk | |
90 | 8 | Mehdi Abaakouk | |
91 | 8 | Mehdi Abaakouk | <pre |
92 | 8 | Mehdi Abaakouk | virsh migrate --persistent --undefinesource --live --p2p <VM_NAME> qemu+ssh://XX.tetaneutral.net:2222/system |
93 | 8 | Mehdi Abaakouk | </pre> |
94 | 8 | Mehdi Abaakouk | |
95 | 8 | Mehdi Abaakouk | Dans le cas d'une VM migré d'openstack, faire d'abord sur la machine destination: |
96 | 8 | Mehdi Abaakouk | |
97 | 8 | Mehdi Abaakouk | <pre>mkdir -p /var/lib/nova/instances/<uuid_name></pre> |
98 | 8 | Mehdi Abaakouk | |
99 | 8 | Mehdi Abaakouk | TODO(sileht): faire le MKDIR avec le hook qemu ou tous les préparer à l'avance |
100 | 11 | Laurent GUERBY | |
101 | 11 | Laurent GUERBY | h2. git |
102 | 11 | Laurent GUERBY | |
103 | 11 | Laurent GUERBY | https://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/openstack-tools |
104 | 11 | Laurent GUERBY | |
105 | 11 | Laurent GUERBY | libvirt |