Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-70121

Revert to the first snapshot failed for 'data-file' qcow2 image

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-9.6, rhel-10.0
    • libvirt
    • No
    • Moderate
    • rhel-virt-core-libvirt-1
    • ssg_virtualization
    • 5
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None

      What were you trying to do that didn't work?

      Revert to the first snapshot failed for 'data-file' qcow2 image

      Please provide the package NVR for which the bug is seen:

      libvirt-10.10.0-1.el10.x86_64
      qemu-kvm-9.1.0-7.el10.x86_64

      How reproducible is this bug?:

      100%

      Steps to reproduce

      1.Prepare a disk image with data file.

      # qemu-img create /var/lib/libvirt/images/datastore 500M
      Formatting '/var/lib/libvirt/images/datastore', fmt=raw size=524288000
      # qemu-img create -f qcow2 -o data_file=/var/lib/libvirt/images/datastore /var/lib/libvirt/images/datastore_file.qcow2 500M
      Formatting '/var/lib/libvirt/images/datastore_file.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=524288000 data_file=/var/lib/libvirt/images/datastore lazy_refcounts=off refcount_bits=16 

      2.Start the guest with datastore_file.qcow2 image.

      # virsh start rhel
      Domain 'rhel' started 
      # virsh dumpxml rhel --xpath //disk 
      ......
      <disk type="file" device="disk">
        <driver name="qemu" type="qcow2"/>
        <source file="/var/lib/libvirt/images/datastore_file.qcow2" index="1">
          <dataStore type="file">
            <format type="raw"/>
            <source file="/var/lib/libvirt/images/datastore" index="3"/>
          </dataStore>
        </source>
        <backingStore/>
        <target dev="vdb" bus="virtio"/>
        <alias name="virtio-disk1"/>
        <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
      </disk>

      3. Create snapshots.
      # for i in {1..3}; do virsh snapshot-create-as rhel s$i --memspec snapshot=external,file=/var/lib/libvirt/images/datastore.s$i --diskspec vda,snapshot=no; done
      Domain snapshot s1 created
      Domain snapshot s2 created
      Domain snapshot s3 created
      4. Revert snapshot to s1.
      # virsh snapshot-revert rhel s1
      error: Failed to revert snapshot s1
      error: Requested operation is not valid: Setting different SELinux label on /var/lib/libvirt/images/datastore which is already in use
      5. Check the guest.
      # virsh list --all
       Id   Name   State
      -----------------------
       -    rhel   shut off
      6. Check the related log.
      # vim /var/log/libvirt/libvirtd.log

      2024-12-05 10:02:49.849+0000: 36924: debug : virCgroupV2MakeGroup:438 : Make controller /sys/fs/cgroup/machine.slice/machine-qemu\x2d9\x2drhel.scope/libvirt/emulator/
      2024-12-05 10:02:49.849+0000: 36924: debug : virCgroupSetValueRaw:522 : Set path '/sys/fs/cgroup/machine.slice/machine-qemu\x2d9\x2drhel.scope/libvirt/emulator/cgroup.procs' to value '37769'
      2024-12-05 10:02:49.850+0000: 36924: debug : qemuProcessLaunch:7963 : Setting up resctrl
      2024-12-05 10:02:49.850+0000: 36924: debug : qemuProcessLaunch:7967 : Setting up managed PR daemon
      2024-12-05 10:02:49.850+0000: 36924: debug : qemuProcessLaunch:7972 : Setting up permissions to allow post-copy migration
      2024-12-05 10:02:49.850+0000: 36924: debug : qemuProcessAllowPostCopyMigration:2931 : Labeling /dev/userfaultfd in mount namespace
      2024-12-05 10:02:49.858+0000: 36924: debug : qemuProcessLaunch:7976 : Setting domain security labels
      2024-12-05 10:02:49.864+0000: 36924: error : virProcessRunInFork:1395 : internal error: child reported (status=125): Requested operation is not valid: Setting different SELinux label on /var/lib/libvirt/images/datastore which is already in use
      2024-12-05 10:02:49.864+0000: 36924: debug : virProcessRunInFork:1399 : Requested operation is not valid: Setting different SELinux label on /var/lib/libvirt/images/datastore which is already in use
      2024-12-05 10:02:49.864+0000: 36924: debug : qemuLogContextFinalize:70 : ctxt=0x7f48ec06d760
      2024-12-05 10:02:49.864+0000: 36924: debug : qemuProcessStop:8718 : Shutting down vm=0x7f48e401be30 name=rhel id=9 pid=37775, reason=failed, asyncJob=snapshot, flags=0x3
      2024-12-05 10:02:49.864+0000: 36924: debug : virDomainObjBeginJobInternal:319 : Starting job: API=remoteDispatchDomainRevertToSnapshot job=async nested agentJob=none asyncJob=none (vm=0x7f48e401be30 name=rhel, current job=none agentJob=none async=snapshot)
      2024-12-05 10:02:49.864+0000: 36924: debug : virDomainObjBeginJobInternal:383 : Started job: async nested (async=snapshot vm=0x7f48e401be30 name=rhel)
      2024-12-05 10:02:49.864+0000: 36924: debug : qemuDomainLogAppendMessage:5661 : Append log message (vm='rhel'
       

      # vim /var/log/libvirt/qemu/rhel.log

      2024-12-05 10:02:49.768+0000: 37775: debug : virLockManagerFree:380 : lock=0x7f48ec0710f0
      2024-12-05 10:02:49.768+0000: 37775: debug : virFileGetMountSubtreeImpl:2175 : prefix=/dev
      2024-12-05 10:02:49.768+0000: 37775: debug : qemuDomainSetupDev:237 : Setting up /dev/ for domain rhel
      2024-12-05 10:02:49.768+0000: 37775: debug : virFileSetupDev:3904 : Mount devfs on /run/libvirt/qemu/9-rhel.dev type=tmpfs flags=0x2, opts=mode=755,size=65536
      2024-12-05 10:02:49.772+0000: 37775: info : virObjectUnref:378 : OBJECT_UNREF: obj=0x7f489c01d100
      2024-12-05 10:02:49.772+0000: 37775: debug : qemuProcessHook:3151 : Hook complete ret=0
      2024-12-05 10:02:49.772+0000: 37775: debug : virExec:883 : Done hook 0
      2024-12-05 10:02:49.772+0000: 37775: debug : virExec:890 : Setting child security label to system_u:system_r:svirt_t:s0:c236,c642
      2024-12-05 10:02:49.772+0000: 37775: debug : virExecCommon:456 : Setting child uid:gid to 107:107 with caps 0
      2024-12-05 10:02:49.772+0000: 37775: debug : virCommandHandshakeChild:402 : Notifying parent for handshake start on 29
      2024-12-05 10:02:49.772+0000: 37775: debug : virCommandHandshakeChild:410 : Waiting on parent for handshake complete on 30
      2024-12-05 10:02:49.865+0000: 37775: error : virCommandHandshakeChild:418 : libvirtd quit during handshake: Input/output error
      libvirt:  error : libvirtd quit during handshake: Input/output error
      2024-12-05 10:02:49.864+0000: shutting down, reason=failed
      

      Expected results

      Revert snapshot successfully and the guest is still running

      Actual results

      Revert failed and guest shut off.

      Additional info

      This is hit by test case tp-libvirt snapshot_revert.disk_external_snap.disk_and_memory.with_datastore.

              phrdina@redhat.com Pavel Hrdina
              rhn-support-meili Meina Li
              virt-maint virt-maint
              Meina Li Meina Li
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated: