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 2173142 - [snapshot] cannot delete snapshot when one of the disk's snapshot mode is 'manual'
Summary: [snapshot] cannot delete snapshot when one of the disk's snapshot mode is 'ma...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks: 1519002
TreeView+ depends on / blocked
 
Reported: 2023-02-24 07:59 UTC by yisun
Modified: 2023-11-07 09:37 UTC (History)
6 users (show)

Fixed In Version: libvirt-9.2.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:30:47 UTC
Type: Bug
Target Upstream Version: 9.2.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-149865 0 None None None 2023-02-24 08:02:10 UTC
Red Hat Product Errata RHSA-2023:6409 0 None None None 2023-11-07 08:31:33 UTC

Description yisun 2023-02-24 07:59:41 UTC
Description of problem:
cannot delete snapshot when one of the disk's snapshot mode is 'manual'

Version-Release number of selected component (if applicable):
libvirt-9.0.0-7.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1.have a running vm with two disks
[root@dell-per740-41 ~]# virsh domstate vm1
running

[root@dell-per740-41 ~]# virsh domblklist vm1
 Target   Source
---------------------------------------------
 vda      /var/lib/libvirt/images/vm1.qcow2
 vdb      /var/lib/libvirt/images/vdb.qcow2

2. prepare a snapshot xml, in which the vda's snapshot mode is 'manual'
[root@dell-per740-41 ~]# cat snap.xml 
<domainsnapshot>
	<description>Snapshot test</description>
	<name>snap1</name>
	<memory snapshot='external' file='/tmp/mem.dump'/>
	<disks>
		<disk name='vda' snapshot='manual'/>
		<disk name='vdb' snapshot='external'/>
	</disks>
</domainsnapshot>


3. do the snapshot
[root@dell-per740-41 ~]# virsh snapshot-create vm1 snap.xml 
Domain snapshot snap1 created from 'snap.xml'

now the vm is moved to PAUSED state, vda's path not chaged, and vdb has a new image layer 'vdb.snap1'

[root@dell-per740-41 ~]# virsh domstate vm1
paused

[root@dell-per740-41 ~]# virsh domblklist vm1
 Target   Source
---------------------------------------------
 vda      /var/lib/libvirt/images/vm1.qcow2
 vdb      /var/lib/libvirt/images/vdb.snap1

4. delete the snapshot
[root@dell-per740-41 ~]# virsh snapshot-delete vm1 snap1
error: Failed to delete snapshot snap1
error: invalid argument: could not find base disk source in disk source chain

[root@dell-per740-41 ~]# virsh resume vm1
Domain 'vm1' resumed

[root@dell-per740-41 ~]# virsh snapshot-delete vm1 snap1
error: Failed to delete snapshot snap1
error: invalid argument: could not find base disk source in disk source chain


Actual results:
snapshot cannot be removed if one of the disk has 'manual' mode for snapshot

Expected results:
libvirt should remove the snapshot data which is maintained by libvirt, such as the memory dump, vdb's new layer and snapshot's metadata

Additional info:
if vda's snapshot mode is 'no' then it works.

Comment 1 Pavel Hrdina 2023-03-20 09:58:45 UTC
Upstream commit:

commit 22a07239f5ea3d3ccd8a057cf83dcc09d6b7b0f0
Author: Pavel Hrdina <phrdina>
Date:   Wed Mar 1 12:51:21 2023 +0100

    qemu_snapshot: properly ignore disks with manual snapshot

Comment 2 yisun 2023-04-11 10:11:31 UTC
Preverified with:libvirt-9.2.0-1.el9.x86_64

[root@lenovo-sr630-14 ~]# virsh start vm1
Domain 'vm1' started

[root@lenovo-sr630-14 ~]# virsh domblklist vm1
 Target   Source
--------------------------------------------------------
 vda      /var/lib/libvirt/images/jeos-27-x86_64.qcow2
 vdb      /var/lib/libvirt/images/vdb.qcow2

[root@lenovo-sr630-14 ~]# vim snap.xml
<domainsnapshot>
	<description>Snapshot test</description>
	<name>snap1</name>
	<memory snapshot='external' file='/tmp/mem.dump'/>
	<disks>
		<disk name='vda' snapshot='manual'/>
		<disk name='vdb' snapshot='external'/>
	</disks>
</domainsnapshot>

[root@lenovo-sr630-14 ~]# virsh snapshot-create vm1 snap.xml
Domain snapshot snap1 created from 'snap.xml'

[root@lenovo-sr630-14 ~]#  virsh domstate vm1
paused

[root@lenovo-sr630-14 ~]# virsh domblklist vm1
 Target   Source
--------------------------------------------------------
 vda      /var/lib/libvirt/images/jeos-27-x86_64.qcow2
 vdb      /var/lib/libvirt/images/vdb.snap1

[root@lenovo-sr630-14 ~]# virsh dumpxml vm1 --xpath //disk
<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/var/lib/libvirt/images/jeos-27-x86_64.qcow2" index="2"/>
  <backingStore/>
  <target dev="vda" bus="virtio"/>
  <alias name="virtio-disk0"/>
  <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>
<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/var/lib/libvirt/images/vdb.snap1" index="3"/>
  <backingStore type="file" index="1">
    <format type="qcow2"/>
    <source file="/var/lib/libvirt/images/vdb.qcow2"/>
    <backingStore/>
  </backingStore>
  <target dev="vdb" bus="virtio"/>
  <alias name="virtio-disk1"/>
  <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</disk>

[root@lenovo-sr630-14 ~]# virsh snapshot-delete vm1 snap1
error: Failed to delete snapshot snap1
error: internal error: unable to execute QEMU command 'block-commit': Block node is read-only

[root@lenovo-sr630-14 ~]# virsh resume vm1
Domain 'vm1' resumed

[root@lenovo-sr630-14 ~]# virsh snapshot-delete vm1 snap1
Domain snapshot snap1 deleted

[root@lenovo-sr630-14 ~]# virsh domblklist vm1
 Target   Source
--------------------------------------------------------
 vda      /var/lib/libvirt/images/jeos-27-x86_64.qcow2
 vdb      /var/lib/libvirt/images/vdb.qcow2

[root@lenovo-sr630-14 ~]# virsh dumpxml vm1 --xpath //disk
<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/var/lib/libvirt/images/jeos-27-x86_64.qcow2" index="2"/>
  <backingStore/>
  <target dev="vda" bus="virtio"/>
  <alias name="virtio-disk0"/>
  <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>
<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/var/lib/libvirt/images/vdb.qcow2" index="1"/>
  <backingStore/>
  <target dev="vdb" bus="virtio"/>
  <alias name="virtio-disk1"/>
  <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</disk>

Comment 5 yisun 2023-05-19 08:43:42 UTC
test with libvirt-9.3.0-2.el9.x86_64 and result is PASS

Comment 8 errata-xmlrpc 2023-11-07 08:30:47 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 (Moderate: libvirt security, bug fix, and enhancement update), 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/RHSA-2023:6409


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