Thanks! 

On Thu, Jun 3, 2021, 2:46 PM Nir Soffer <nsoffer@redhat.com> wrote:
On Thu, Jun 3, 2021 at 8:47 PM Strahil Nikolov <hunter86_bg@yahoo.com> wrote:
>
> Hey Nir,
>
> you said that the data in the snapshot changed ?
> I always thought that snapshots are read-only.

Indeed snapshot is ready only - until you start to delete it. This is
why we mark the
snapshot as illegal once delete snapshot was started.

It works like this:

1. Before snapshot

Snapshots: (none)
Volumes: A (active)

A is read-write volume, changing while the vm is running.

2. After snapshot

Snapshot: snap1 (disk snapshot A)
Volumes: A <- B (active)

A is now read only image, will never change
B is read-write, modified by the vm
B backing file is A

2. Start delete snapshot 1

Snapshot: snap1 (disk snapshot A, illegal)
Volumes: A <- B (active)

On the host running the vm, we perform block commit job,
copying data from B into A.

When the job completes, A contains all data in B, and any new
data written to the B is mirrored to A.

3. Pivoting to volume A

When the block commit has completed, we switch to vm to use volume A
instead of volume B.

At this point the VM is writing again to volume A, and volume B is unused.

Snapshot: snap1 (disk snapshot A, illegal)
Volumes: A (active) <- B

4. Cleanup

On engine side, snapshot 1 is deleted
On the host, volume B is deactivated
On the SPM host, volume B is deleted

Snapshot: (none)
Volumes: A (active)

I hope this is more clear now.

Nir