Bug 874418

Summary: clear the error message when dump a guest with pass-through device
Product: Red Hat Enterprise Linux 7 Reporter: yanbing du <ydu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: cwei, dallan, dyuan, mzhan, pkrempa, rbalakri, shyu, tzheng, vivianzhang, xuzhang, zhwang
Target Milestone: pre-dev-freeze   
Target Release: 7.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.7-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1023852 (view as bug list) Environment:
Last Closed: 2015-03-05 07:19:44 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:
Bug Depends On:    
Bug Blocks: 1023852    

Description yanbing du 2012-11-08 07:17:44 UTC
Description of problem:
Now Bug 826325("virsh dump" support for SR-IOV or path through devices )
already fixed, but without the '--memorey-only' option, when dump a guest which has pass-through device, the error message is:

error: Failed to core dump domain mig to /tmp/guest.core
error: internal error unable to execute QEMU command 'migrate': An undefined error has ocurred

Maybe, it's necessary to fix this.


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

How reproducible:
100% 

Steps to Reproduce:
1. Prepare a guest with a SR-IOV VF passthrough
....
   <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
....

2. Dump the guest directly
# virsh dump mig /tmp/guest.core
error: Failed to core dump domain mig to /tmp/guest.core
error: internal error unable to execute QEMU command 'migrate': An undefined error has ocurred

  
Actual results:
unclear error message 

Expected results:
When dump fail, the error message need more clear 

Additional info:

Comment 2 zhenfeng wang 2012-11-29 05:43:46 UTC
It will report the same error while save a guest with a pci device passthrough

# virsh save guest /tmp/guest.save
error: Failed to save domain guest to /tmp/guest.save
error: internal error unable to execute QEMU command 'migrate': An undefined error has ocurred

Comment 4 Xuesong Zhang 2013-03-26 05:19:40 UTC
While snapshot the guest with pci, the dump error message also need to be improved.
[root@localhost ~]# virsh snapshot-create-as  a a.sp1
error: operation failed: Error -22 while writing VM

Addtional info: this issue is also occurred in rhel7.

Comment 6 Jiri Denemark 2013-09-27 10:47:47 UTC
*** Bug 1012876 has been marked as a duplicate of this bug. ***

Comment 8 tingting zheng 2014-02-28 05:53:49 UTC
I can reproduce this bug with:
libvirt-0.10.2-29.el6_5.4.x86_64

Steps:
1.Prepare a guest with PCI device passthrough:
# virsh dumpxml a
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x0e' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>

2.Do some operations,eg:save,dump,snapshot:
# virsh save a a.save
error: Failed to save domain a to a.save
error: internal error unable to execute QEMU command 'migrate': An undefined error has ocurred

# virsh dump a /tmp/a.core
error: Failed to core dump domain a to /tmp/a.core
error: internal error unable to execute QEMU command 'migrate': An undefined error has ocurred

# virsh snapshot-create-as a a.sp1
error: operation failed: state blocked by non-migratable device '0000:00:06.0/pci-assign'
Error -22 while writing VM

Comment 13 Peter Krempa 2014-07-07 08:49:09 UTC
Fixed upstream:

commit 315fba9c60082589cdf8a2b417c9a576c79d2800
Author: Peter Krempa <pkrempa>
Date:   Mon Jul 7 10:00:46 2014 +0200

    qemu: dump: Report better error when dumping VM with passthrough devices
    
    For the regular dump operation we migrate the VM to a file. This won't
    work when the VM has passthrough devices assigned. Rather than reporting
    a cryptic error from qemu run our check whether it can be migrated.
    
    This does not influence the memory-only dump that is allowed with
    passthrough devices.

Comment 15 zhengqin 2014-08-29 06:58:15 UTC
Test with build libvirt-1.2.7-2.el7:

1. Prepare a guest with PCI device passthrough

2. Do some operations,eg:save,dump,snapshot:

# virsh save rhel7_B savefile 
error: Failed to save domain rhel7_B to savefile
error: Requested operation is not valid: domain has assigned non-USB host devices

# virsh dump rhel7_B dumpfile
error: Failed to core dump domain rhel7_B to dumpfile
error: An error occurred, but the cause is unknown


# virsh snapshot-create-as rhel7_B a.sp1
error: An error occurred, but the cause is unknown



The error msg for dump and snapshot-create-as got "the cause is unknown".

Could you help to confirm whether all above error msg are acceptable ?

Comment 16 Peter Krempa 2014-09-08 12:27:03 UTC
The message "An error occurred, but the cause is unknown" isn't satisfactory. Libvirt should report the actual error. I'll move this back to assigned to fix those.

Comment 17 Peter Krempa 2014-09-09 14:48:16 UTC
I tried the steps and also traced the code and wasn't able to get the "cause unknown" messages. Could you please re-try it with the new package? If you manage to reproduce it please provide:

1) a bit more detailed steps
2) the full domain XML
3) logs from the libvirt daemon

Thanks.

Comment 18 zhengqin 2014-09-23 03:06:38 UTC
Hi, 

Sorry, I retry this issue with a clean environment with build libvirt-1.2.8-3.el7, could not get the "the cause is unknown" messages.  

So, this should be test environment issue.

Comment 19 vivian zhang 2014-12-03 08:17:56 UTC
hi, Peter
I retest this on build
libvirt-1.2.8-10.el7.x86_64
qemu-kvm-rhev-2.1.2-14.el7.x86_64
3.10.0-205.el7.x86_64

1. prepare a SRIOV env,and passthrough a PCI device to guest

#virsh dumpxml yy
...
<hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </hostdev>
...

2. do dump, save and snapshot-create-as, get below error report

# virsh dump yy yy.core
error: Failed to core dump domain yy to yy.core
error: Requested operation is not valid: domain has assigned non-USB host devices

# virsh save yy yy.save
error: Failed to save domain yy to yy.save
error: Requested operation is not valid: domain has assigned non-USB host devices

# virsh snapshot-create-as yy yy.sp
error: operation failed: Error -22 while writing VM

Could you please help confirm whether these error reported are acceptable?
It seems that snapshot create operation occurs a qemu failed error, maybe it need to do further update for that "Error -22 while writing VM".

Comment 20 Peter Krempa 2014-12-05 10:15:51 UTC
(In reply to vivian zhang from comment #19)

...

> 2. do dump, save and snapshot-create-as, get below error report
> 
> # virsh dump yy yy.core
> error: Failed to core dump domain yy to yy.core
> error: Requested operation is not valid: domain has assigned non-USB host
> devices
> 
> # virsh save yy yy.save
> error: Failed to save domain yy to yy.save
> error: Requested operation is not valid: domain has assigned non-USB host
> devices

The two above are what I'm expecting

> 
> # virsh snapshot-create-as yy yy.sp
> error: operation failed: Error -22 while writing VM

Whereas the internal snapshot case could be improved.

> 
> Could you please help confirm whether these error reported are acceptable?
> It seems that snapshot create operation occurs a qemu failed error, maybe it
> need to do further update for that "Error -22 while writing VM".

In fact, the internal snapshot case is now fixed upstream:

commit d1e460136a8ad1ce7717d2d75cd878812f63f1bb
Author: Shanzhi Yu <shyu>
Date:   Wed Dec 3 19:12:35 2014 +0800

    qemu: snapshot: Forbid internal snapshot with passthrough devices
    
    When attempting to create internal system checkpoint with a passthrough
    device qemu will report the following error:
    
    error: operation failed: Error -22 while writing VM
    
    This patch calls the function to check if migration is possible with
    given VM and thus improves the error to:
    
    error: Requested operation is not valid: domain has assigned non-USB host devices
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=874418#c19
    Signed-off-by: Peter Krempa <pkrempa>

Comment 23 vivian zhang 2014-12-09 02:18:57 UTC
we can move this bug to verified in RHEL7.1 since the left issue was tracked in bug 1171533 which is flagged to 7.2.0.

Comment 25 errata-xmlrpc 2015-03-05 07:19:44 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-2015-0323.html