Bug 1313627

Summary: Fail to restore vm with usb keyboard config on ppc64le
Product: Red Hat Enterprise Linux 7 Reporter: Wayne Sun <gsun>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: abologna, dgibson, dyuan, dzheng, mzhan, rbalakri, thuth
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.3.5-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:38:48 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
The guest xml
none
The qemu log on source host
none
The qemu log on target host none

Description Wayne Sun 2016-03-02 05:56:38 UTC
Created attachment 1132146 [details]
The guest xml

Description of problem:
restore vm fail

Version-Release number of selected component (if applicable):
libvirt-1.3.2-1.el7.ppc64le
qemu-kvm-rhev-2.3.0-31.el7_2.7.ppc64le
kernel-3.10.0-327.8.1.el7.ppc64le


How reproducible:
always

Steps to Reproduce:
1. save vm and restore
# virsh list
 Id    Name                           State
----------------------------------------------------
 1     gsun-test1                     running
# virsh save gsun-test1 /tmp/savetest

Domain gsun-test1 saved to /tmp/savetest

# virsh list
 Id    Name                           State
----------------------------------------------------

# virsh restore /tmp/savetest 
error: Failed to restore domain from /tmp/savetest
error: operation failed: job: unexpectedly failed

2. check vm log
# vim /var/log/libvirt/qemu/gsun-test1.log
2016-03-02 05:23:34.641+0000: starting up libvirt version: 1.3.2, package: 1.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2016-03-01-07:09:05, ppc-029.build.eng.bos.redhat.com), qemu version: 2.3.0 (qemu-kvm-rhev-2.3.0-31.el7_2.7), hostname: ibm-p8-kvm-02-qe.rhts.eng.bos.redhat.com
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name gsun-test1 -S -machine pseries-rhel7.2.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid f3e87001-f6d8-479a-8aad-62e3fbe2f19c -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-gsun-test1/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device pci-ohci,id=usb,bus=pci.0,addr=0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -drive file=/var/lib/libvirt/images/jeos-19-64-ppc64le-virtio.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=27 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:35:b8:aa,bus=pci.0,addr=0x1 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-gsun-test1/org.qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -device usb-mouse,id=input0 -device usb-kbd,id=input1 -vnc 127.0.0.1:2 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x6 -incoming defer -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on
char device redirected to /dev/pts/13 (label charserial0)
2016-03-02T05:23:35.698213Z qemu-kvm: Unknown savevm section or instance 'pci@800000020000000:02.0/1/usb-kbd' 0
2016-03-02T05:23:35.698539Z qemu-kvm: load of migration failed: Invalid argument
3.

Actual results:
failed to restore vm

Expected results:
succeed

Additional info:
It works fine on libvirt 1.3.1-1

Comment 2 Dan Zheng 2016-03-22 01:48:01 UTC
Packages:
libvirt	1.3.2-1.el7
kernel	3.10.0-327.el7
qemu-kvm-rhev	2.5.0-2.el7

When do migration, the same error happens. See below.

2016-03-16 23:34:31,422 migrate_vm L1551 DEBUG| Start migrating: virsh migrate avocado-vt-vm1 --live --verbose --unsafe --compressed qemu+ssh://10.19.112.9:22/system
error: internal error: early end of file from monitor, possible problem: 2016-03-17T03:34:54.842878Z qemu-kvm: Unknown savevm section or instance 'pci@800000020000000:02.0/1/usb-kbd' 0
2016-03-17T03:34:54.843263Z qemu-kvm: load of migration failed: Invalid argument
] 

After removing <input type='keyboard' bus='usb'/> in the guest XML, the error is removed.

Comment 3 David Gibson 2016-04-11 05:58:11 UTC
Looks like the first thing to do here is to check the qemu command lines that libvirt generates on source and destination and see if they match.

Comment 4 Dan Zheng 2016-05-16 09:45:31 UTC
Created attachment 1157825 [details]
The qemu log on source host

Comment 5 Dan Zheng 2016-05-16 09:46:06 UTC
Created attachment 1157826 [details]
The qemu log on target host

Comment 6 Dan Zheng 2016-05-16 09:48:59 UTC
Compared on both source and target host and they are not exactly matched on the qemu command line.

Source:
-device usb-kbd,id=input0 -device usb-mouse,id=input1 
Target:
-device usb-mouse,id=input0 -device usb-kbd,id=input1 

See more in above attachments.

Comment 7 David Gibson 2016-05-23 05:52:41 UTC
Dan, I'd expect that command line change to alter where the two devices appear on the USB bus.  That would probably be enough to cause the qemu error you saw, so it does look like a libvirt bug not correctly generating command lines.

Comment 8 Dan Zheng 2016-06-13 07:08:31 UTC
As to the problem stated in comment 2, it seems fixed already in libvirt-1.3.5-1.el7. Migration can succeed.

Comment 9 Andrea Bolognani 2016-06-14 16:40:31 UTC
(In reply to Dan Zheng from comment #8)
> As to the problem stated in comment 2, it seems fixed already in
> libvirt-1.3.5-1.el7. Migration can succeed.

Looks like the 'virsh save' / 'virsh restore' issue is gone
as well. I'm using the same libvirt version as you are with
qemu-kvm-rhev-2.6.0-5.el7.ppc64, and I'm unable to
reproduce it.

Can you please try again?

Comment 10 Dan Zheng 2016-06-22 02:35:03 UTC
Hi Andrea, 

Tried with 
qemu-kvm-rhev-2.6.0-8.el7.ppc64le
libvirt-1.3.5-1.el7.ppc64le

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     avocado-vt-vm1                 running
# virsh save avocado-vt-vm1 /tmp/s.1

Domain avocado-vt-vm1 saved to /tmp/s.1

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

# virsh restore /tmp/s.1
Domain restored from /tmp/s.1

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     avocado-vt-vm1                 running


The problem can not be reproduced any more. So save/restore works on ppc now.

Comment 11 Andrea Bolognani 2016-06-24 14:26:44 UTC
Great, thanks for testing this! :)

Comment 13 Dan Zheng 2016-07-04 03:39:56 UTC
Test packages:
libvirt-2.0.0-1.el7.ppc64le
qemu-kvm-rhev-2.6.0-11.el7.ppc64le
kernel-3.10.0-327.el7.ppc64le

Case1: Basic save + restore without options

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     avocado-vt-vm1                 running
# virsh save 3 /tmp/save.2

Domain 3 saved to /tmp/save.2

# ll /tmp/save.2
-rw-------. 1 root root 338268836 Jul  3 23:13 /tmp/save.2

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

# virsh restore /tmp/save.2
Domain restored from /tmp/save.2

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 4     avocado-vt-vm1                 running


Case2: save with options + restore 
# virsh save bd18531c-d5ed-4680-b8c6-9cb6074feb82 /tmp/save.2 --bypass-cache --verbose --paused 
Save: [100 %]
Domain bd18531c-d5ed-4680-b8c6-9cb6074feb82 saved to /tmp/save.2

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

# virsh restore /tmp/save.2
Domain restored from /tmp/save.2

[root@ibm-p8-kvm-01-qe rpm]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 6     avocado-vt-vm1                 paused

Case3: save with options + restore with options
dump.xml has one line difference with dumpxml avocado-vt-vm1.
  <on_crash>destroy</on_crash>

# virsh save bd18531c-d5ed-4680-b8c6-9cb6074feb82 /tmp/save.2 --bypass-cache --verbose --paused --xml dump.xml 
Save: [100 %]
Domain bd18531c-d5ed-4680-b8c6-9cb6074feb82 saved to /tmp/save.2

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

# virsh restore /tmp/save.2 --running  --bypass-cache
Domain restored from /tmp/save.2

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 8     avocado-vt-vm1                 running

# virsh dumpxml 8 |grep on_crash

  <on_crash>destroy</on_crash>

Case4:

# virsh save avocado-vt-vm1 /tmp/save.2 --bypass-cache --verbose --running --xml dump.xml 
Save: [100 %]
Domain avocado-vt-vm1 saved to /tmp/save.2

# vim dump2.xml 
One line is different from dump.xml.
   <on_reboot>destroy</on_reboot>


# virsh restore /tmp/save.2 --paused --bypass-cache --xml dump2.xml 
Domain restored from /tmp/save.2

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 9     avocado-vt-vm1                 paused

# virsh dumpxml 9 |grep on_reboot
  <on_reboot>destroy</on_reboot>


After the guest is restored and running , user can log on the guest and do operation normally.

So all tests are passed.

Comment 15 errata-xmlrpc 2016-11-03 18:38:48 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://rhn.redhat.com/errata/RHSA-2016-2577.html