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 1106419 - No snapshot should be created when create external disk snapshot without specify disk while guest is shut off
Summary: No snapshot should be created when create external disk snapshot without spec...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-09 09:52 UTC by Shanzhi Yu
Modified: 2017-08-02 01:25 UTC (History)
8 users (show)

Fixed In Version: libvirt-2.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:06:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1430642 0 unspecified CLOSED [RFE] virt-install: add snapshot attribute for disk 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Internal Links: 1430642

Description Shanzhi Yu 2014-06-09 09:52:58 UTC
Description of problem:

No snapshot should be created when create external disk snapshot without specify disk while guest is shut off 

Version-Release number of selected component (if applicable):

libvirt-1.1.1-29.el7.x86_64

How reproducible:

100%

Steps to Reproduce:

1.Define an guest with snapshot='no' in xml 

#virsh dumpxml rhel6|grep disk -A 3
    <disk type='file' device='disk' snapshot='no'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/kvm-rhel6.5-x86_64-qcow2.img'/>
      <target dev='vda' bus='virtio'/>
..

2.Keep guest shut off status and create external disk snapshot

# virsh snapshot-create-as rhel6 s1 --disk-only 
Domain snapshot s1 created

3.Check snapshot info 

# virsh snapshot-dumpxml rhel6 s1 

<domainsnapshot>
  <name>s1</name>
  <state>shutoff</state>
  <creationTime>1402301633</creationTime>
  <memory snapshot='no'/>
  <disks>
    <disk name='vda' snapshot='no'/>
  </disks>
  <domain type='kvm'>
..

4.Create external disk snapshot with specify snapshot file

# virsh snapshot-create-as rhel6 s2 --disk-only --diskspec vda,file=/tmp/s2.disk 
Domain snapshot s2 created

5. check snapshot info

# virsh snapshot-dumpxml rhel6 s2 
<domainsnapshot>
  <name>s2</name>
  <state>shutoff</state>
  <parent>
    <name>s1</name>
  </parent>
  <creationTime>1402303099</creationTime>
  <memory snapshot='no'/>
  <disks>
    <disk name='vda' snapshot='external' type='file'>
      <driver type='qcow2'/>
      <source file='/tmp/s2.disk'/>
    </disk>
  </disks>
  <domain type='kvm'>
..

# virsh domblklist rhel6 
Target     Source
------------------------------------------------
vda        /tmp/s2.disk


Actual results:


Expected results:

No snapshot should be created in step 2

Additional info:

Comment 3 Eric Blake 2015-07-28 15:41:01 UTC
similar to bug 1106416 (which was about internal snapshots); probably a single code change will fix both, in which case I may mark this as a duplicate bug.

Comment 6 Peter Krempa 2016-10-10 03:23:50 UTC
This was already fixed a while ago:

commit 91b7e06865d8f630f2ac9e07435ba92520248af4
Author: Peter Krempa <pkrempa>
Date:   Tue May 20 14:22:25 2014 +0200

    qemu: snapshot: Forbid empty snapshots
    
    If neither disks nor memory are selected for snapshot we'd record
    metadata in case of external snapshot and do a disk snapshot in case of
    external disk snapshot. Forbid this as it doesn't make much sense.

Comment 8 Han Han 2017-03-09 03:29:13 UTC
Hi Peter.
Verify as failed. It doesn't forbid to create external snapshot when snapshot='no'
Version:
qemu-kvm-rhev-2.8.0-6.el7.x86_64
libvirt-3.1.0-2.el7.x86_64

For disk xml with snapshot='no':
<disk type='file' device='disk' snapshot='no'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/BZ1106416.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>


It doesn't forbid create external snapshot with --disk-only --diskspec:
# virsh domstate BZ1106416                                                                                             
shut off

# virsh snapshot-create-as BZ1106416 s1 --disk-only --diskspec hda,file=/tmp/xxo
Domain snapshot s1 created

# virsh snapshot-dumpxml BZ1106416 s1|awk '/<disk/,/<\/disk/'
  <disks>
    <disk name='hda' snapshot='external' type='file'>
      <driver type='qcow2'/>
      <source file='/tmp/xxo'/>
    </disk>
      <disk type='file' device='disk' snapshot='no'>
        <driver name='qemu' type='qcow2'/>
        <source file='/var/lib/libvirt/images/BZ1106416.qcow2'/>
        <target dev='hda' bus='ide'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>

Comment 9 Peter Krempa 2017-03-09 07:19:20 UTC
That is expected. --diskspec overrides the default set via the 'snapshot' attribute. The attribute applies only if --diskspec does not cover the given drive.

Comment 10 Han Han 2017-04-14 03:09:46 UTC
As comment8 and comment9. Bug verified on libvirt-3.2.0-2.el7.x86_64
1. Prepare a running VM with snapshot='no' in its disk xml:
<disk type='file' device='disk' snapshot='no'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/q35.qcow2'/>
      <backingStore/>
      <target dev='sda' bus='sata'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2. Try creating internal or external snapshot
# virsh snapshot-create-as q35                      
[sudo] password for hansolo: 
error: unsupported configuration: internal snapshots and checkpoints require all disks to be selected for snapshot

# virsh snapshot-create-as q35 --disk-only    
error: unsupported configuration: nothing selected for snapshot

As above. Bug fixed.

Comment 11 Han Han 2017-04-14 03:22:03 UTC
Correct a typo in comment10: 'a running VM' should be 'a shutoff VM'.

Comment 12 errata-xmlrpc 2017-08-01 17:06:41 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, 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/RHEA-2017:1846

Comment 13 errata-xmlrpc 2017-08-01 23:48:45 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, 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/RHEA-2017:1846

Comment 14 errata-xmlrpc 2017-08-02 01:25:04 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, 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/RHEA-2017:1846


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