linux-system-roles / snapshot

Ansible role to manage storage snapshots
MIT License
2 stars 5 forks source link

revert (merge) LVM snapshot requires neither the source or snapshot be open for immediate merge #14

Open trgill opened 9 months ago

trgill commented 9 months ago

If either are open, the merge is deferred until the next time the server reboots and the source logical volume is activated.

should the role return a warning if either are open?

trgill commented 9 months ago

Need to add tests that have either the source or snapshot open/mounted/busy etc.

Also need to add tests that write to the snapshot before the merge.

Should we have a feature to pre-check the snapshot for the amount of data on the snapshot that will need to be copied back to the source?

Is it useful to a user of the role to get the status of the LV? A user could detect if a snapshot if open by checking the "# open" field returned by lvdisplay.

An example snapshot with a mounted filesystem shows non-zero # open:

  --- Logical volume ---
  LV Path                /dev/vg1/lv1_vg1_snapset1
  LV Name                lv1_vg1_snapset1
  VG Name                vg1
  LV UUID                Gp3YQ0-0BRp-oo2u-5r28-yOYN-UaXv-UFka8p
  LV Write Access        read/write
  LV Creation host, time fedora, 2024-01-25 17:12:30 -0500
  LV snapshot status     active destination for lv1_vg1
  LV Status              available
  # open                 1
  LV Size                1.00 GiB
  Current LE             256
  COW-table size         208.00 MiB
  COW-table LE           52
  Allocated to snapshot  31.05%
  Snapshot chunk size    4.00 KiB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:10