È importante comprendere le catene di volumi per la risoluzione dei problemi di creazione/eliminazione di snapshot. Questo post spiegherà la correlazione delle catene di volumi.
Le catene di volumi sia nel database del motore che nell'host devono essere controllate poiché è necessario verificare se lo stato REALE dei dischi è lo stesso di quello che vedi nel database. La procedura qui illustrata è per l'archiviazione a blocchi basata su LVM (iSCSI e FiberChannel). Per NFS è molto più semplice, basta cercare i file con l'ID immagine come nome. Quando creiamo uno snapshot, RHV "congela" il disco di base e crea una copia sul livello di scrittura (COW) in alto per memorizzare le modifiche. Il livello COW è implementato come uno snapshot qcow, che memorizza un riferimento all'immagine di base che contiene il disco originale (o il livello precedente).
1. Verifica dal database del motore:
– Il "primo" snapshot per le VM è "Active VM" in RHV. "Active VM" non è un'istantanea reale, ma mostra solo lo "stato corrente" come un'istantanea. È il disco principale (parente zero). Ad esempio:
vm_name | snapshot_name | snapshot_status | image_guid | image_group_id | parentid | imagestatus ------------+----------------------+-----------------+--------------------------------------+--------------------------------------+--------------------------------------+------------- TestVM | Active VM | OK | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 00000000-0000-0000-0000-000000000000 | 1 (1 row)
– Se crei un'istantanea, verrà creata la prima istantanea reale. Questo primo snapshot è uno snapshot COW che utilizza il disco precedente come immagine di base. Il genitore è zero. Dopo che è stata scattata la prima istantanea, il genitore "Active VM" diventa l'image_guid della prima istantanea.
Esempio :il nome del primo snapshot è volumechain1. Dall'output DB sottostante, puoi vedere la relazione image_guid e parent:
vm_name | snapshot_name | snapshot_status | image_guid | image_group_id | parentid | imagestatus ------------+---------------+-----------------+--------------------------------------+--------------------------------------+--------------------------------------+------------- TestVM | Active VM | OK | 3fdf455e-52e6-48da-81f5-475cad796d21 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 1 TestVM | volumechain1 | OK | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 00000000-0000-0000-0000-000000000000 | 1 (2 rows)
Esempio per le istantanee second(volumechain2)/third(volumechain3). Puoi vedere che il genitore della seconda istantanea è il volumeid della prima istantanea e il parente della terza istantanea è la seconda istantanea volume_id.
vm_name | snapshot_name | snapshot_status | image_guid | image_group_id | parentid | imagestatus ------------+---------------+-----------------+--------------------------------------+--------------------------------------+--------------------------------------+------------- TestVM | Active VM | OK | 043dfd54-30d2-4437-9cba-2eded92136b6 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 3fdf455e-52e6-48da-81f5-475cad796d21 | 1 TestVM | volumechain1 | OK | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 00000000-0000-0000-0000-000000000000 | 1 TestVM | volumechain2 | OK | 3fdf455e-52e6-48da-81f5-475cad796d21 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 1 (3 rows)
vm_name | snapshot_name | snapshot_status | image_guid | image_group_id | parentid | imagestatus ------------+---------------+-----------------+--------------------------------------+--------------------------------------+--------------------------------------+------------- TestVM | Active VM | OK | c9a717e4-bc90-4ef5-900d-777bf01b43bf | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 043dfd54-30d2-4437-9cba-2eded92136b6 | 1 TestVM | volumechain1 | OK | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 00000000-0000-0000-0000-000000000000 | 1 TestVM | volumechain2 | OK | 3fdf455e-52e6-48da-81f5-475cad796d21 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 | 1 TestVM | volumenchain3 | OK | 043dfd54-30d2-4437-9cba-2eded92136b6 | 9f13d2e3-eed5-4af2-936c-358bc4948608 | 3fdf455e-52e6-48da-81f5-475cad796d21 | 1 (4 rows)
2. Verifica dall'host:
– Controlla le informazioni domblk:
# virsh -r domblklist TestVM Target Source --------------------------------------------------------------------------------------------------------------------------------------------------------------- hdc - sda /rhev/data-center/mnt/blockSD/c95e9f3e-79cb-47ab-9825-8093ee12e42b/images/9f13d2e3-eed5-4af2-936c-358bc4948608/c9a717e4-bc90-4ef5-900d-777bf01b43bf
– Verifica tag LV:il back-end LVM memorizza i dati in volumi logici (LV). RHV contrassegna tutti i LV con l'id del disco che utilizza quel LV. Dai seguenti comandi LV tags, puoi vedere le catene di volumi.
# lvs -o +tags|grep 9f13d2e3-eed5-4af2-936c-358bc4948608 043dfd54-30d2-4437-9cba-2eded92136b6 c95e9f3e-79cb-47ab-9825-8093ee12e42b -wi-ao---- 1.00g IU_9f13d2e3-eed5-4af2-936c-358bc4948608,MD_8,PU_3fdf455e-52e6-48da-81f5-475cad796d21 >>>> third snapshot 3fdf455e-52e6-48da-81f5-475cad796d21 c95e9f3e-79cb-47ab-9825-8093ee12e42b -wi-ao---- 1.00g IU_9f13d2e3-eed5-4af2-936c-358bc4948608,MD_6,PU_4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 >>>>> second snapshot 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 c95e9f3e-79cb-47ab-9825-8093ee12e42b -wi-ao---- 48.00g IU_9f13d2e3-eed5-4af2-936c-358bc4948608,MD_3,PU_00000000-0000-0000-0000-000000000000 >>>>> first snapshot c9a717e4-bc90-4ef5-900d-777bf01b43bf c95e9f3e-79cb-47ab-9825-8093ee12e42b -wi-ao---- 1.00g IU_9f13d2e3-eed5-4af2-936c-358bc4948608,MD_11,PU_043dfd54-30d2-4437-9cba-2eded92136b6 >>>>> Active VM
– Controlla le immagini di qemu. Ad esempio:
# qemu-img info /dev/c95e9f3e-79cb-47ab-9825-8093ee12e42b/4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 image: /dev/c95e9f3e-79cb-47ab-9825-8093ee12e42b/4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 file format: raw virtual size: 48G (51539607552 bytes) >>>>>>>>>>> disk size: 0
Catene di volume di scarico. Ad esempio:
# vdsm-tool dump-volume-chains c95e9f3e-79cb-47ab-9825-8093ee12e42b |grep -A14 9f13d2e3-eed5-4af2-936c-358bc4948608 image: 9f13d2e3-eed5-4af2-936c-358bc4948608 - 4ccf601e-ec11-4c10-be8c-3b1a6e53aa51 >>>>this is the first snapshot volume_id status: OK, voltype: INTERNAL, format: RAW, legality: LEGAL, type: PREALLOCATED, capacity: 51539607552, truesize: 51539607552 - 3fdf455e-52e6-48da-81f5-475cad796d21 >>>>this is the second snapshot volume_id status: OK, voltype: INTERNAL, format: COW, legality: LEGAL, type: SPARSE, capacity: 51539607552, truesize: 1073741824 - 043dfd54-30d2-4437-9cba-2eded92136b6 >>>>this is the third snapshot volume_id status: OK, voltype: INTERNAL, format: COW, legality: LEGAL, type: SPARSE, capacity: 51539607552, truesize: 1073741824 - c9a717e4-bc90-4ef5-900d-777bf01b43bf >>>>this is Active VM Leaf volume_id status: OK, voltype: LEAF, format: COW, legality: LEGAL, type: SPARSE, capacity: 51539607552, truesize: 1073741824