Bug 1151885 - libvirtd loses track of a running restored guest with host-passthrough cpu
Summary: libvirtd loses track of a running restored guest with host-passthrough cpu
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-13 01:26 UTC by Luyao Huang
Modified: 2015-03-05 07:46 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.2.8-11.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:46:20 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Internal Links: 1030793

Description Luyao Huang 2014-10-13 01:26:08 UTC
description of problem:
guest with passthough  model cpu will disappear after restore and restart libvirtd

Version-Release number of selected component (if applicable):
libvirt-1.2.8-5.el7.x86_64


How reproducible:
100%

Steps to Reproduce:

1.# rpm -q libvirt
libvirt-1.2.8-5.el7.x86_64

2.# virsh dumpxml test3 |grep pass
  <cpu mode='host-passthrough'>

3.# virsh managedsave test3

Domain test3 state saved by libvirt

4.# virsh start test3
Domain test3 started

5.# virsh list --all
 Id    Name                           State
----------------------------------------------------
 4     test3                          running

6.# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

7.# virsh list --all
 Id    Name                           State
----------------------------------------------------

8.# ps aux|grep test3
qemu     25559 14.2  4.1 1738704 295480 ?      Sl   20:57   0:24 /usr/libexec/qemu-kvm -name test3 -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -cpu host -m 1024 -realtime mlock=off -smp 2,maxcpus=4,sockets=4,cores=1,threads=1 -uuid 7347d748-f7ce-448f-8d49-3d29c9bcac30 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/test3.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device

Actual results:
guest disappear after managedsave -> restore ->restart libvirtd 

Expected results:

guest still exist after libvirtd restart


Some log from libvirtd.log:


2014-10-10 12:45:15.219+0000: 24943: info : libvirt version: 1.2.8, package: 5.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2014-10-09-08:52:56, x86-030.build.eng.bos.redhat.com)
2014-10-10 12:45:15.219+0000: 24943: error : virCPUDefParseXML:371 : XML error: Non-empty feature list specified without CPU model
2014-10-10 12:45:27.641+0000: 24934: warning : qemuDomainObjTaint:1899 : Domain id=2 name='test3' uuid=7347d748-f7ce-448f-8d49-3d29c9bcac30 is tainted: host-cpu
2014-10-10 12:46:15.777+0000: 25127: info : libvirt version: 1.2.8, package: 5.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2014-10-09-08:52:56, x86-030.build.eng.bos.redhat.com)
2014-10-10 12:46:15.777+0000: 25127: error : virCPUDefParseXML:371 : XML error: Non-empty feature list specified without CPU model
Additional info:

Comment 1 Ján Tomko 2014-10-31 15:31:11 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2014-October/msg01120.html

Comment 4 Ján Tomko 2014-12-11 11:15:50 UTC
Fixed upstream by:
commit 15abebdecb35308ddd4d2967efa6dffa4842fac9
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2014-12-11 12:03:36 +0100

    Ignore CPU features without a model for host-passthrough
    
    This fixes reverting to snapshots created by older libvirt
    and allows libvirt not to lose track of a domain that
    has this in its live status XML (such as a domain
    restored from managedsave)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1030793
    https://bugzilla.redhat.com/show_bug.cgi?id=1151885

commit dd324bb2703b9cf619c521b2a04f186cd9734f0a
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2014-12-11 12:03:36 +0100

    Do not format CPU features without a model
    
    For host-passthrough CPU we don't honor the CPU
    features specified in the XML, but we allow
    outputting them via the UPDATE_CPU flag for dumpxml,
    this gives user a rough idea of what features the CPU
    might have.
    
    After restoring a managedsave'd domain, the features
    might end up in the live status XML (in /var/run) without
    the model. This XML cannot be parsed by the daemon after
    restart and the domain might disappear.
    
    This fix skips formatting the features for HOST_PASSTHROUGH
    when UPDATE_CPU is not specified, so the newly restored domains
    and newly created snapshots won't be affected.
    
    Note: this doesn't fix existing snapshots or already restored
    running domains.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1030793
    https://bugzilla.redhat.com/show_bug.cgi?id=1151885

git describe: v1.2.11-rc2-5-g15abebd

Comment 7 zhenfeng wang 2014-12-26 08:07:23 UTC
Reproduce this bug with libvirt-1.2.8-5.el7.x86_64
1.Prepare a guest with host-passthrough cpu, but without cpu-model
#virsh dumpxml rhel7.0
--
  <cpu mode='host-passthrough'>
  </cpu>

2.Start the guest, then do live snapshot with the guest
#virsh start rhel7.0
Domain rhel7.0 started

#virsh snapshot-create-as rhel7.0 sp1
Domain snapshot sp1 created

# virsh snapshot-list rhel7.0
 Name                 Creation Time             State
------------------------------------------------------------
 sp1                  2014-12-26 13:08:00 +0800 running


3.Rever the snapshot with sp1, will fail to revert it
# virsh snapshot-revert rhel7.0 sp1
error: XML error: Non-empty feature list specified without CPU model

4.Managedsave the guest, then re-start it
# virsh managedsave rhel7.0
Domain rhel7.0 state saved by libvirt

# virsh start rhel7.0
Domain rhel7.0 started

5.Restart the libvirtd service, found the guest will be shutoff
#service libvirtd restart
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel7.0                        shut off

could get the following error from the qemu's log
--
Domain id=3 is tainted: host-cpu

Got following error info from libvirt
2014-12-26 06:33:04.288+0000: 25776: info : libvirt version: 1.2.8, package: 5.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2014-10-09-08:52:56, x86-030.build.eng.bos.redhat.com)
2014-12-26 06:33:04.288+0000: 25776: error : virCPUDefParseXML:371 : XML error: Non-empty feature list specified without CPU model
2014-12-26 06:33:14.975+0000: 25768: warning : qemuDomainObjTaint:1899 : Domain id=2 name='rhel7.0' uuid=3725ae82-5bba-4e7a-afc4-0423ad8d0e65 is tainted: host-cpu
2014-12-26 06:34:39.536+0000: 25769: warning : virFileWrapperFdClose:326 : iohelper reports:
2014-12-26 06:34:44.714+0000: 25770: warning : qemuDomainObjTaint:1899 : Domain id=3 name='rhel7.0' uuid=3725ae82-5bba-4e7a-afc4-0423ad8d0e65 is tainted: host-cpu
2014-12-26 06:35:10.437+0000: 26194: info : libvirt version: 1.2.8, package: 5.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2014-10-09-08:52:56, x86-030.build.eng.bos.redhat.com)
2014-12-26 06:35:10.437+0000: 26194: error : virCPUDefParseXML:371 : XML error: Non-empty feature list specified without CPU model


Verify this bug with libvirt-1.2.8-11.el7

Excute the steps in reproduce steps, the guest could do snapshot-revert successfully and also the guest keep in running status after restart the libvirtd service, so mark this bug verifed

Comment 9 errata-xmlrpc 2015-03-05 07:46:20 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


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