Bug 1873382 - [RFE] Provide a way to identify volume chains that have snapshots in preview
Summary: [RFE] Provide a way to identify volume chains that have snapshots in preview
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: vdsm
Version: 4.4.1
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
: ---
Assignee: Arik
QA Contact: Avihai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-28 05:31 UTC by Germano Veit Michel
Modified: 2022-04-20 15:25 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-04-20 11:43:38 UTC
oVirt Team: Storage
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Germano Veit Michel 2020-08-28 05:31:48 UTC
Description of problem:

Currently, vdsm-tool dump-volume-chains will throw an error related to duplicate parent in the chain in case there is a snapshot in preview.

See this image below. The chain is:

00000000 <- e6c7bec0 <- e0475853 <- deceff83 [previously active]
                     <- 5eb2b29d [preview]


   image:    dff0a0c0-b731-4e5b-9f32-d97310ca40de

             Error: more than one volume pointing to the same parent volume e.g: (_BLANK_UUID<-a), (a<-b), (a<-c)

             Unordered volumes and children:

             - e6c7bec0-53c6-4729-a4a0-a9b3ef2b8c38 <- 5eb2b29d-82d6-4337-8511-3c86705d566e
               status: OK, voltype: LEAF, format: COW, legality: LEGAL, type: SPARSE, capacity: 1073741824, truesize: 1073741824

             - e0475853-4514-4464-99e7-b185cce9b67d <- deceff83-9d88-4f87-8304-d5bf74d119b1
               status: OK, voltype: LEAF, format: COW, legality: LEGAL, type: SPARSE, capacity: 1073741824, truesize: 1073741824

             - e6c7bec0-53c6-4729-a4a0-a9b3ef2b8c38 <- e0475853-4514-4464-99e7-b185cce9b67d
               status: OK, voltype: INTERNAL, format: COW, legality: LEGAL, type: SPARSE, capacity: 1073741824, truesize: 1073741824

             - 00000000-0000-0000-0000-000000000000 <- e6c7bec0-53c6-4729-a4a0-a9b3ef2b8c38
               status: OK, voltype: INTERNAL, format: RAW, legality: LEGAL, type: PREALLOCATED, capacity: 1073741824, truesize: 1073741824

Version-Release number of selected component (if applicable):
vdsm-4.40.24-1.gitd177ff577.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Preview snapshot
2. Run dump-volume-chains
3.

Actual results:
dump-volume-chains gives incorrect error

Expected results:
dump-volume-chains able to reliably detect snapshot previews

Additional info:
* there is nothing in the Storage Domain metadata that explicitly tell a snapshot is in preview

Comment 1 Germano Veit Michel 2020-08-28 05:33:47 UTC
I came up with this, but its overly complicated as the only way is to try to guess if the problematic chain is in preview or not.

def _is_chain_in_preview(volumes_children, volumes_type):
    # a duplicate parent in chain could mean a snapshot in preview
    # a snapshot in preview has the following properties:
    # - chain contains 2 leaves in total
    # - exactly 2 volumes pointing to the same unique parent
    # - at least 1 volume pointing to the duplicate parent is leaf
    voltype_count = Counter(volumes_type.values())
    if voltype_count['LEAF'] != 2:
        return False
    parent_count = Counter(map(itemgetter(0), volumes_children))
    parent_count = dict(filter(lambda count: count[1] > 1,
                        parent_count.items()))
    if sum(count for count in parent_count.values()) > 2:
        return False
    parent = next(iter(parent_count))
    children = [child for volume, child in volumes_children
                if volume == parent]
    if all(volumes_type[volume] != 'LEAF' for volume in children):
        return False
    return True

Comment 2 Germano Veit Michel 2020-08-31 23:31:52 UTC
After discussions on ovirt devel list we found there is no reliable way to determine if the chain has a snapshot in preview based only on storage metadata.
All the changes required to make this happen are not worth it and maybe even risky.

I'll suggest a patch to change the text of DuplicateParentError to warn the user it could be a preview.

Comment 3 Germano Veit Michel 2020-09-02 04:40:00 UTC
Re-opening after more discussions :)

On ovirt-devel list: [storage] how to find if a snapshot is in preview based on storage domain metadata only?

Comment 7 Sandro Bonazzola 2022-03-29 16:16:40 UTC
We are past 4.5.0 feature freeze, please re-target.


Note You need to log in before you can comment on or make changes to this bug.