Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1473121

Summary: virsh hang after several snapshot operations
Product: Red Hat Enterprise Linux 7 Reporter: Haijiao Zhao <haizhao>
Component: qemu-kvmAssignee: David Gibson <dgibson>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.4-AltCC: dzheng, gsun, haizhao, jen, juzhang, lvivier, michen, qzhang, rbalakri, virt-maint
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-04 09:06:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
libvirtd log
none
qemu log
none
log of libvirtd and qemu none

Description Haijiao Zhao 2017-07-20 05:03:48 UTC
Created attachment 1301494 [details]
libvirtd log

Description of problem:
virsh hang after several snapshot operations

Version-Release number of selected component (if applicable):
kernel-4.11.0-10.el7a.ppc64le
libvirt-3.2.0-15.el7a.ppc64le
qemu-kvm-2.9.0-18.el7a.ppc64le

How reproducible:
100%


Steps to Reproduce:
1. Start virsh

(.libvirt-ci-venv-avocado-remote-dGYwpa) [root@c155f1-u31 ~]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # start avocado-vt-vm1
Domain avocado-vt-vm1 started

virsh # snapshot-create-as avocado-vt-vm1 snap-temp --disk-only
Domain snapshot snap-temp created
virsh # 
virsh # snapshot-create-as avocado-vt-vm1 snap1 --disk-only
Domain snapshot snap1 created
virsh # 
virsh # snapshot-create-as avocado-vt-vm1 snap2 --live --memspec /tmp/tmp.file
Domain snapshot snap2 created
virsh # 
virsh # snapshot-create-as avocado-vt-vm1 snap3

^C


Actual results:
Hanging

Expected results:
Command succeed

Additional info:
See the attachment

Comment 2 Haijiao Zhao 2017-07-20 05:05:46 UTC
Created attachment 1301496 [details]
qemu log

Comment 3 Haijiao Zhao 2017-07-20 07:10:33 UTC
According to 
  https://bugzilla.redhat.com/show_bug.cgi?id=1418532
live snapshot is disabled.
If anybody want to close it, be my guest.

Comment 4 Haijiao Zhao 2017-08-01 09:38:24 UTC
Another similar scenario(*** PASS on x86_64 qemu-kvm ***):

Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
 Id    Name                           State
----------------------------------------------------
 -     avocado-vt-vm1                 shut off
 -     vm1                            shut off

virsh # start avocado-vt-vm1
Domain avocado-vt-vm1 started

virsh # list --all
 Id    Name                           State
----------------------------------------------------
 1     avocado-vt-vm1                 running
 -     vm1                            shut off

virsh # console 1
Connected to domain avocado-vt-vm1
Escape character is ^]

Red Hat Enterprise Linux Server 7.4 Beta (Pegas)
Kernel 4.11.0-13.el7a.ppc64le on an ppc64le

localhost login: 
virsh # 
virsh # snapshot-create-as avocado-vt-vm1 --disk-only
Domain snapshot 1501570554 created
virsh # 
virsh # 
virsh # snapshot-create-as avocado-vt-vm1  snap_test description
^C


**************************
While virsh is hanging, the size of image of the latest create snapshot "1501570554" is increasing, which will lead to 'no space left' for host.
Since the same test passes on x86_64 with qemu-kvm package, this looks like a problem for ppc.

Comment 5 Peter Krempa 2017-08-01 09:45:22 UTC
Please attach the libvirtd debug log.

Comment 6 Haijiao Zhao 2017-08-02 05:46:59 UTC
Created attachment 1307916 [details]
log of libvirtd and qemu

Comment 7 Peter Krempa 2017-08-03 13:15:08 UTC
I've extracted the QMP interaction between qemu and libvirt from the logs.

It looks like qemu never responds to the "savevm" command and thus libvirt never finishes the API.

This is the interaction (I'll also attach timestamps to establish the timeframe below):

[I've truncated the setup of the VM, which would not be relevant]
  WRITE: mon=0x3fff7c00a6c0 buf={"execute":"cont","id":"libvirt-11"}
PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570487, "microseconds": 159205}, "event": "RESUME"}
PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570514, "microseconds": 795543}, "event": "VSERPORT_CHANGE", "data": {"open": true, "id": "channel0"}}
PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570515, "microseconds": 505272}, "event": "NIC_RX_FILTER_CHANGED", "data": {"name": "net0", "path": "/machine/peripheral/net0/virtio-backend"}}
  WRITE: mon=0x3fff7c00a6c0 buf={"execute":"transaction","arguments":{"actions":[{"type":"blockdev-snapshot-sync","data":{"device":"drive-virtio-disk0","snapshot-file":"/var/lib/avocado/data/avocado-vt/images/jeos-25-64.1501570554","format":"qcow2"}}]},"id":"libvirt-12"}
PROCESS: mon=0x3fff7c00a6c0 buf={"return": {}, "id": "libvirt-12"}
  WRITE: mon=0x3fff7c00a6c0 buf={"execute":"stop","id":"libvirt-13"}
PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570567, "microseconds": 873952}, "event": "STOP"}
  WRITE: mon=0x3fff7c00a6c0 buf={"execute":"human-monitor-command","arguments":{"command-line":"savevm \"snap_test\""},"id":"libvirt-14"}
PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570567, "microseconds": 881358}, "event": "MIGRATION", "data": {"status": "setup"}}
PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570567, "microseconds": 888787}, "event": "MIGRATION_PASS", "data": {"pass": 1}}

After the last event we don't get anything else from the monitor.

Timeframe of the 'savevm' command is following:

2017-08-01 06:56:07.878+0000: 4269: info : qemuMonitorIOWrite:536 : QEMU_MONITOR_IO_WRITE: mon=0x3fff7c00a6c0 buf={"execute":"human-monitor-command","arguments":{"command-line":"savevm \"snap_test\""},"id":"libvirt-14"}
 len=107 ret=107 errno=0

2017-08-01 06:56:07.889+0000: 4269: info : qemuMonitorIOProcess:431 : QEMU_MONITOR_IO_PROCESS: mon=0x3fff7c00a6c0 buf={"timestamp": {"seconds": 1501570567, "microseconds": 888787}, "event": "MIGRATION_PASS", "data": {"pass": 1}}
 len=112

The two above happen almost immediately after another.

Then there's no other interaction with the monitor until the log ends.

The last entry in the log file is:
2017-08-01 07:01:52.374+0000: 4269: info : virEventPollRunOnce:640 : EVENT_POLL_RUN: nhandles=11 timeout=-1

The log file covers 5 minutes and 45 seconds. I've seen internal snapshot taking a long time, so it may be possible that this eventually finished after some more time.

I'm moving this to evaluate on the qemu side, since libvirt is not getting a response and thus the API will hang until we do get a response.

Comment 8 Ademar Reis 2017-08-03 19:08:19 UTC
(In reply to Haijiao Zhao from comment #4)
> Another similar scenario(*** PASS on x86_64 qemu-kvm ***):

<...>

> While virsh is hanging, the size of image of the latest create snapshot
> "1501570554" is increasing, which will lead to 'no space left' for host.
> Since the same test passes on x86_64 with qemu-kvm package, this looks like
> a problem for ppc.

Reassign. Please note savevm is considered deprecated, but unfortunately is still the default in libvirt and tools (see Bug 1402581 and Bug 1180955, for example)

Comment 9 Laurent Vivier 2017-08-04 07:42:51 UTC
looks like a problem reported in BZ1470035 comment 3.

Could you try qemu-kvm-2.9.0-19.el7a ?

Comment 10 Haijiao Zhao 2017-08-04 08:59:14 UTC
These 2 problems are all gone on environment:

libvirt-3.2.0-17.el7a.ppc64le
kernel-4.11.0-16.el7a.ppc64le
qemu-kvm-2.9.0-19.el7a.ppc64le

Comment 11 Laurent Vivier 2017-08-04 09:06:45 UTC

*** This bug has been marked as a duplicate of bug 1470035 ***