Cette section s'intéresse à la création de l'environnement pour le LAB CEPH.
Ce lab est créé sur un hôte Ubuntu 24.04-3 avec KVM.
Le projet, scripts et machines virtuelles seront stockés à l'emplacement suivant :
/home/guillaume/LabCEPH
├── scripts
└── VM
L'arborescence est créée via la commande suivante :
guillaume@rocket:~$ mkdir -p LabCEPH/{scripts,VM}
Il est nécessaire maintenant de donner l'accès au répertoire VM à KVM, en modifiant les ACL :
guillaume@rocket:~/LabCEPH$ sudo setfacl -m u:libvirt-qemu:rwx ~/LabCEPH/VM
guillaume@rocket:~/LabCEPH$ sudo setfacl -d -m u:libvirt-qemu:rwx ~/LabCEPH/VM
guillaume@rocket:~/LabCEPH$ sudo virsh pool-define-as \
--name labceph-vm \
--type dir \
--target /home/guillaume/LabCEPH/VM
Pool labceph-vm defined
guillaume@rocket:~/LabCEPH$ sudo virsh pool-start labceph-vm
Pool labceph-vm started
guillaume@rocket:~/LabCEPH$ sudo virsh pool-autostart labceph-vm
Pool labceph-vm marked as autostarted
guillaume@rocket:~/LabCEPH$ virsh pool-list --all
Name State Autostart
----------------------------------
default active yes
images active yes
ISO active yes
labceph-vm active yes
guillaume@rocket:~/LabCEPH$ virsh pool-dumpxml labceph-vm
<pool type='dir'>
<name>labceph-vm</name>
<uuid>9b4de161-7439-4390-abbb-73a48055b018</uuid>
<capacity unit='bytes'>501809635328</capacity>
<allocation unit='bytes'>85664542720</allocation>
<available unit='bytes'>416145092608</available>
<source>
</source>
<target>
<path>/home/guillaume/LabCEPH/VM</path>
<permissions>
<mode>0775</mode>
<owner>1000</owner>
<group>1000</group>
</permissions>
</target>
</pool>
Sur mon hôte, le réseau LAN INTERNE INFRA existe déjà, il reste à créer le réseau LAN OP CEPH.
guillaume@rocket:~/LabCEPH$ nano ~/LabCEPH/scripts/lan_op_ceph.xml
<network>
<name>lan_op_ceph</name>
<forward mode="nat"/>
<bridge name="virbr50" stp="on" delay="0"/>
<ip address="192.168.120.254" netmask="255.255.255.0"/>
</network>
guillaume@rocket:~/LabCEPH$ sudo virsh net-define ~/LabCEPH/scripts/lan_op_ceph.xml
Network lan_op_ceph defined from /home/guillaume/LabCEPH/scripts/lan_op_ceph.xml
guillaume@rocket:~/LabCEPH$ sudo virsh net-start lan_op_ceph
Network lan_op_ceph started
guillaume@rocket:~/LabCEPH$ sudo virsh net-autostart lan_op_ceph
Network lan_op_ceph marked as autostarted
guillaume@rocket:~/LabCEPH$ sudo virsh net-list --all
Name State Autostart Persistent
------------------------------------------------------
default active yes yes
lan_interne_infra active yes yes
lan_op_ceph active yes yes
guillaume@rocket:~/LabCEPH$ ip a show virbr50
23: virbr50: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:f9:2c:85 brd ff:ff:ff:ff:ff:ff
inet 192.168.120.254/24 brd 192.168.120.255 scope global virbr50
valid_lft forever preferred_lft forever
Avant de pouvoir créer et lancer l'installation des machines virtuelles, il est indispensable de créer les disques qui y seront rattachés. Ces disques seront stockés dans le répertoire “VM”.
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK01-system.qcow2 15G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK01-system.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=16106127360 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK01-osd1.qcow2 10G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK01-osd1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK01-osd2.qcow2 10G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK01-osd2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK02-system.qcow2 15G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK02-system.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=16106127360 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK02-osd1.qcow2 10G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK02-osd1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK02-osd2.qcow2 10G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK02-osd2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK03-system.qcow2 15G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK03-system.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=16106127360 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK03-osd1.qcow2 10G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK03-osd1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/VSTOCK03-osd2.qcow2 10G
Formatting '/home/guillaume/LabCEPH/VM/VSTOCK03-osd2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ qemu-img create -f qcow2 ~/LabCEPH/VM/SRVCLI01-system.qcow2 15G
Formatting '/home/guillaume/LabCEPH/VM/SRVCLI01-system.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=16106127360 lazy_refcounts=off refcount_bits=16
guillaume@rocket:~/LabCEPH$ ls -l VM/
total 1960
-rw-r--r--+ 1 guillaume guillaume 196848 déc. 26 12:53 SRVCLI01-system.qcow2
-rw-r--r--+ 1 guillaume guillaume 196768 déc. 26 12:49 VSTOCK01-osd1.qcow2
-rw-r--r--+ 1 guillaume guillaume 196768 déc. 26 12:49 VSTOCK01-osd2.qcow2
-rw-r--r--+ 1 guillaume guillaume 196848 déc. 26 12:49 VSTOCK01-system.qcow2
-rw-r--r--+ 1 guillaume guillaume 196768 déc. 26 12:50 VSTOCK02-osd1.qcow2
-rw-r--r--+ 1 guillaume guillaume 196768 déc. 26 12:50 VSTOCK02-osd2.qcow2
-rw-r--r--+ 1 guillaume guillaume 196848 déc. 26 12:50 VSTOCK02-system.qcow2
-rw-r--r--+ 1 guillaume guillaume 196768 déc. 26 12:51 VSTOCK03-osd1.qcow2
-rw-r--r--+ 1 guillaume guillaume 196768 déc. 26 12:51 VSTOCK03-osd2.qcow2
-rw-r--r--+ 1 guillaume guillaume 196848 déc. 26 12:51 VSTOCK03-system.qcow2