RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2039131 - The metadata of snapshot isn't discarded when creating with --no-metadata option
Summary: The metadata of snapshot isn't discarded when creating with --no-metadata option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: liang cong
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-11 03:09 UTC by Meina Li
Modified: 2022-05-17 13:06 UTC (History)
7 users (show)

Fixed In Version: libvirt-8.0.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 12:46:17 UTC
Type: Bug
Target Upstream Version: 8.0.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-107352 0 None None None 2022-01-11 03:14:58 UTC
Red Hat Product Errata RHBA-2022:2390 0 None None None 2022-05-17 12:46:49 UTC

Description Meina Li 2022-01-11 03:09:48 UTC
Description of problem:
The metadata of snapshot isn't discarded when creating with --no-metadata option

Version-Release number of selected component (if applicable):
libvirt-8.0.0-0rc1.1.el9.x86_64
qemu-kvm-6.2.0-3.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running guest.
# virsh domstate lmn
running

2. Create a snapshot with --no-metadata.
# virsh snapshot-create-as lmn s1 --disk-only --no-metadata --diskspec vda,snapshot=external,file=/var/lib/libvirt/images/test.s1
Domain snapshot s1 created

3. Check the snapshot list.
# virsh snapshot-list lmn
 Name   Creation Time               State
---------------------------------------------------
 s1     2022-01-10 21:10:41 -0500   disk-snapshot

Actual results:
In step 3, the metadata of the snapshot isn't discarded.

Expected results:
There's no snapshot in snapshot list

Additional info:
Cannot reproduce in libvirt-7.10.0-1.el9.x86_64

Comment 1 Peter Krempa 2022-01-12 15:05:47 UTC
Fixed upstream:

commit 164aba8c4aef8094e151f593baf95421feb6dc5f
Author: Peter Krempa <pkrempa>
Date:   Tue Jan 11 10:28:45 2022 +0100

    qemuSnapshotCreate: Don't insert snapshot into list with VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA
    
    Our approach to snapshots without metadata was to insert them to the
    snapshot list and then later remove them from the list when the flag is
    present.
    
    This quirky logic was broken in a recent refactor of the snapshot code
    causing that the snapshot stayed inserted in the snapshot list.
    
    Recent refactor of the snapshot code didn't faithfully relocate this
    logic to the new function.
    
    Rather than attempting to restore the quirky logic of adding and then
    removing the object, don't add the snapshot into the list at all when
    the user doesn't want metadata.
    
    We achieve this by creating a temporary 'virDomainMomentObj' wrapper
    which is not inserted into the list and using that instead of calling
    virDomainSnapshotAssignDef.
    
    Fixes: 9bad0fb809b
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2039131
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Michal Privoznik <mprivozn>

v8.0.0-rc2-3-g164aba8c4a

Comment 2 liang cong 2022-01-13 06:04:47 UTC
Preverify on:
libvirt: v8.0.0-rc2-3-g164aba8c4a
qemu-6.2.0-2.fc36.x86_64
qemu-kvm-6.2.0-2.fc36.x86_64

steps:
1. Prepare a running guest.
# virsh domstate vm2
running


2. Create a snapshot with --no-metadata.
# virsh snapshot-create-as vm2 s1 --disk-only --no-metadata --diskspec vda,snapshot=external,file=/var/lib/libvirt/images/test.s1
Domain snapshot s1 created

3. Check the snapshot list, found there's no snapshot in snapshot list
# virsh snapshot-list vm2
 Name   Creation Time   State
-------------------------------

4. Create another snapshot with --no-metadata.
# virsh snapshot-create-as vm2 s2 --no-metadata
Domain snapshot s2 created

5. Check the snapshot list, found there's no snapshot in snapshot list
# virsh snapshot-list vm2
 Name   Creation Time   State
-------------------------------

Comment 5 liang cong 2022-01-25 07:35:40 UTC
Verified on libvirt-8.0.0-1.el9.x86_64

# rpm -q libvirt qemu-kvm
libvirt-8.0.0-1.el9.x86_64
qemu-kvm-6.2.0-4.el9.x86_64

# virsh snapshot-create-as vm1 s1 --no-metadata
Domain snapshot s1 created

# virsh snapshot-list vm1
 Name   Creation Time   State
-------------------------------


# qemu-img info /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.qcow2  -U
image: /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 1.5 GiB
cluster_size: 65536
Snapshot list:
ID        TAG               VM SIZE                DATE     VM CLOCK     ICOUNT
1         s1                452 MiB 2022-01-18 02:07:03 00:08:45.311           
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false



# virsh snapshot-create-as vm1 s1 --no-metadata --disk-only
Domain snapshot s1 created

# virsh snapshot-list vm1
 Name   Creation Time   State
-------------------------------

# qemu-img info /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.s1  -U --backing-chain
image: /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.s1
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 1.51 MiB
cluster_size: 65536
backing file: /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.qcow2
backing file format: qcow2
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

image: /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 1.04 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false


# virsh snapshot-create-as vm1 s1 --disk-only --no-metadata --diskspec vda,snapshot=external,file=/tmp/test.s1
Domain snapshot s1 created

# virsh snapshot-list vm1
 Name   Creation Time   State
-------------------------------

# qemu-img info /tmp/test.s1 
image: /tmp/test.s1
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 196 KiB
cluster_size: 65536
backing file: /var/lib/libvirt/images/RHEL-8.6-x86_64-latest.raw
backing file format: raw
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

Comment 7 errata-xmlrpc 2022-05-17 12:46:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: libvirt), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2390


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