[pve-devel] [PATCH 06/20] lvm : add volume_protect && volume_unprotect

Alexandre DERUMIER aderumier at odiso.com
Tue Dec 4 11:57:29 CET 2012


Hi Dietmar,
I have done some tests, with use lvm snapshots as clone image

parentvm : /dev/volume1/vm-122-disk-1
clone1: /dev/volume1/vm-888-disk-1   (#lvcreate -L 32G -s -n vm-888-disk-1 /dev/volume1/vm-122-disk-1)
clone2: /dev/volume1/vm-999-disk-1   (#lvcreate -L 32G -s -n vm-999-disk-1 /dev/volume1/vm-122-disk-1)


set parent to readonly:
#lvchange -pr /dev/volume1/vm-122-disk-1

activate vm-888-disk1  on node1

node1 #lvchange -aly /dev/volume1/vm-888-disk-1
Change of snapshot vm-888-disk-1 will also change its origin vm-122-disk-1 and 1 other snapshot(s). Proceed? [y/n]:

this  activate all snapshots (vm-888-disk1 &&  vm-999-disk-1) on node1

node1#lvdisplay

 --- Logical volume ---
  LV Path                /dev/volume1/vm-122-disk-1
  LV Name                vm-122-disk-1
  VG Name                volume1
  LV UUID                O5sfvK-JFYY-ouSw-Crj5-P3Zf-rRFP-aukTBD
  LV Write Access        read only
  LV Creation host, time kvmtest1, 2012-12-04 10:42:45 +0100
  LV snapshot status     source of
                         vm-888-disk-1 [active]
                         vm-999-disk-1 [active]
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:57
   
  --- Logical volume ---
  LV Path                /dev/volume1/vm-888-disk-1
  LV Name                vm-888-disk-1
  VG Name                volume1
  LV UUID                w42rX3-4D2G-Dy8c-l6Iz-xTVm-3TwY-J0GoPf
  LV Write Access        read/write
  LV Creation host, time kvmtest2, 2012-12-04 11:16:03 +0100
  LV snapshot status     active destination for vm-122-disk-1
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  COW-table size         32.00 GiB
  COW-table LE           8192
  Allocated to snapshot  0.00%
  Snapshot chunk size    4.00 KiB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:59

  --- Logical volume ---
  LV Path                /dev/volume1/vm-122-disk-1
  LV Name                vm-122-disk-1
  VG Name                volume1
  LV UUID                O5sfvK-JFYY-ouSw-Crj5-P3Zf-rRFP-aukTBD
  LV Write Access        read only
  LV Creation host, time kvmtest1, 2012-12-04 10:42:45 +0100
  LV snapshot status     source of
                         vm-888-disk-1 [active]
                         vm-999-disk-1 [active]
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:57
   
  --- Logical volume ---
  LV Path                /dev/volume1/vm-888-disk-1
  LV Name                vm-888-disk-1
  VG Name                volume1
  LV UUID                w42rX3-4D2G-Dy8c-l6Iz-xTVm-3TwY-J0GoPf
  LV Write Access        read/write
  LV Creation host, time kvmtest2, 2012-12-04 11:16:03 +0100
  LV snapshot status     active destination for vm-122-disk-1
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  COW-table size         32.00 GiB
  COW-table LE           8192
  Allocated to snapshot  0.00%
  Snapshot chunk size    4.00 KiB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:59



activate vm-999-disk1  on node2

node2 #lvchange -aly /dev/volume1/vm-999-disk-1
Change of snapshot vm-888-disk-1 will also change its origin vm-122-disk-1 and 1 other snapshot(s). Proceed? [y/n]:

this  activate all snapshots (vm-888-disk1 &&  vm-999-disk-1) on node2

node2#lvdisplay

 --- Logical volume ---
  LV Path                /dev/volume1/vm-122-disk-1
  LV Name                vm-122-disk-1
  VG Name                volume1
  LV UUID                O5sfvK-JFYY-ouSw-Crj5-P3Zf-rRFP-aukTBD
  LV Write Access        read only
  LV Creation host, time kvmtest1, 2012-12-04 10:42:45 +0100
  LV snapshot status     source of
                         vm-888-disk-1 [active]
                         vm-999-disk-1 [active]
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:57
   
  --- Logical volume ---
  LV Path                /dev/volume1/vm-888-disk-1
  LV Name                vm-888-disk-1
  VG Name                volume1
  LV UUID                w42rX3-4D2G-Dy8c-l6Iz-xTVm-3TwY-J0GoPf
  LV Write Access        read/write
  LV Creation host, time kvmtest2, 2012-12-04 11:16:03 +0100
  LV snapshot status     active destination for vm-122-disk-1
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  COW-table size         32.00 GiB
  COW-table LE           8192
  Allocated to snapshot  0.00%
  Snapshot chunk size    4.00 KiB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:59

  --- Logical volume ---
  LV Path                /dev/volume1/vm-122-disk-1
  LV Name                vm-122-disk-1
  VG Name                volume1
  LV UUID                O5sfvK-JFYY-ouSw-Crj5-P3Zf-rRFP-aukTBD
  LV Write Access        read only
  LV Creation host, time kvmtest1, 2012-12-04 10:42:45 +0100
  LV snapshot status     source of
                         vm-888-disk-1 [active]
                         vm-999-disk-1 [active]
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:57
   
  --- Logical volume ---
  LV Path                /dev/volume1/vm-888-disk-1
  LV Name                vm-888-disk-1
  VG Name                volume1
  LV UUID                w42rX3-4D2G-Dy8c-l6Iz-xTVm-3TwY-J0GoPf
  LV Write Access        read/write
  LV Creation host, time kvmtest2, 2012-12-04 11:16:03 +0100
  LV snapshot status     active destination for vm-122-disk-1
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8192
  COW-table size         32.00 GiB
  COW-table LE           8192
  Allocated to snapshot  0.00%
  Snapshot chunk size    4.00 KiB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:59



Then I start vm 888 on node1 && vm 999 on node2.

Both booting fine, I can read/write inside them.


What is exactly the problem with snapshots in cluster if snapshots volume are active on each node ?



----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre DERUMIER" <aderumier at odiso.com> 
Cc: pve-devel at pve.proxmox.com 
Envoyé: Mardi 4 Décembre 2012 06:04:31 
Objet: RE: [pve-devel] [PATCH 06/20] lvm : add volume_protect && volume_unprotect 

> I check on citrix xenserver, it seem to be possible to do linked clone from a 
> lvm template. 
> 
> I don't know how it's works. maybe the clone is simply a snapshot ? does it 
> work across cluster? (If the parent lvm volume is readonly and activate on 
> each host ?) 

No, lvm snapshot have problems on clusters. 

I guess they simply use something like qcow2 with base image. 

The base image of the qcow2 file points to the lvm device. 



More information about the pve-devel mailing list