Bug 1169183 - improve error messages when use attach-device add tpm or panic device to a guest
Summary: improve error messages when use attach-device add tpm or panic device to a guest
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
low
low
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-01 01:19 UTC by Luyao Huang
Modified: 2015-11-19 05:56 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:56:51 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2014-12-01 01:19:32 UTC
description of problem:
improve error messages when use attach-device add tpm or panic device to a guest

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


How reproducible:
100%

Steps to Reproduce:

1.attach a panic device to offline guest
# cat panic.xml
    <panic>
      <address type='isa' iobase='0x505'/>
    </panic>

# virsh attach-device test3 panic.xml --config
error: Failed to attach device from panic.xml
error: unsupported configuration: unknown device type 'panic'

2.the same with tpm device:

# virsh attach-device test3 tpm.xml --config
error: Failed to attach device from tpm.xml
error: unsupported configuration: unknown device type 'tpm'

# cat tpm.xml
   <tpm model='tpm-tis'>
      <backend type='passthrough'>
        <device path='/dev/tpm0'/>
      </backend>
    </tpm>


Actual results:
libvirt cannot recognize this device, because there is no device type for panic and tpm device in virDomainDeviceType

Expected results:

From the downstream doc, we know they are device.so libvirt should recognize them.

error: Failed to attach device from panic.xml
error: Operation not supported: live attach of device 'panic' is not supported



some informations:
There is no VIR_DOMAIN_DEVICE_PANIC in this func (also need add some code in other func), so seems this is the cause
typedef enum {
    VIR_DOMAIN_DEVICE_NONE = 0,
    VIR_DOMAIN_DEVICE_DISK,
    VIR_DOMAIN_DEVICE_LEASE,
    VIR_DOMAIN_DEVICE_FS,
    VIR_DOMAIN_DEVICE_NET,
    VIR_DOMAIN_DEVICE_INPUT,
    VIR_DOMAIN_DEVICE_SOUND,
    VIR_DOMAIN_DEVICE_VIDEO,
    VIR_DOMAIN_DEVICE_HOSTDEV,
    VIR_DOMAIN_DEVICE_WATCHDOG,
    VIR_DOMAIN_DEVICE_CONTROLLER,
    VIR_DOMAIN_DEVICE_GRAPHICS,
    VIR_DOMAIN_DEVICE_HUB,
    VIR_DOMAIN_DEVICE_REDIRDEV,
    VIR_DOMAIN_DEVICE_SMARTCARD,
    VIR_DOMAIN_DEVICE_CHR,
    VIR_DOMAIN_DEVICE_MEMBALLOON,
    VIR_DOMAIN_DEVICE_NVRAM,
    VIR_DOMAIN_DEVICE_RNG,
    VIR_DOMAIN_DEVICE_SHMEM,

    VIR_DOMAIN_DEVICE_LAST
} virDomainDeviceType;

And thanks Martin's patch:

https://www.redhat.com/archives/libvir-list/2014-November/msg01083.html

Comment 2 Martin Kletzander 2014-12-08 13:04:28 UTC
Fixed upstream by commits v1.2.10-219-gbfeee8d, v1.2.10-220-g03caa54 and v1.2.10-222-g934c388:

commit bfeee8dee4aebdaeeadfc30aede6c81ab54094e6
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Sun Nov 30 20:54:50 2014 +0100

    conf: Add device-related code for TPM devices

commit 03caa543c236d47fe93fd5dba4d1ea1539649719
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Sun Nov 30 20:54:50 2014 +0100

    conf: Add device-related code for panic devices

commit 934c38878964a63e61372dafb07bb67c5031bf10
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Mon Dec 1 13:19:55 2014 +0100

    conf: Don't redefine virDomainTPMDefPtr

Comment 4 vivian zhang 2015-04-28 03:16:34 UTC
I can produce this bug with build libvirt-1.2.8-9.el7.x86_64

and verify it with build libvirt-1.2.14-1.el7.x86_64

1. prepare a healthy guest without tpm and panic device

2. # cat /tmp/panic.xml 
<panic>
      <address type='isa' iobase='0x505'/>
    </panic>

3. try to do hot-plug for panic device

# virsh attach-device rl /tmp/panic.xml 
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: live attach of device 'panic' is not supported

# virsh attach-device rl /tmp/panic.xml --config
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: persistent attach of device 'panic' is not supported

# virsh attach-device rl /tmp/panic.xml --live
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: live attach of device 'panic' is not supported

# virsh attach-device rl /tmp/panic.xml --current
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: live attach of device 'panic' is not supported

# virsh attach-device rl /tmp/panic.xml --persistent
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: persistent attach of device 'panic' is not supported

4. # cat /tmp/tpm.xml 
<tpm model='tpm-tis'>
      <backend type='passthrough'>
        <device path='/dev/tpm0'/>
      </backend>
    </tpm>

5. try to do hot-plug for tpm device

# virsh attach-device rl /tmp/tpm.xml 
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: live attach of device 'tpm' is not supported

# virsh attach-device rl /tmp/tpm.xml --live
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: live attach of device 'tpm' is not supported

# virsh attach-device rl /tmp/tpm.xml --current
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: live attach of device 'tpm' is not supported

# virsh attach-device rl /tmp/tpm.xml --config
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: persistent attach of device 'tpm' is not supported

# virsh attach-device rl /tmp/tpm.xml --persistent
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: persistent attach of device 'tpm' is not supported


6. prepare a guest with  panic device, start it

7. try to do hot-unplug for  panic device

# virsh detach-device rl /tmp/panic.xml 
error: Failed to detach device from /tmp/panic.xml
error: Operation not supported: live detach of device 'panic' is not supported


8. due to qemu not support tpm, so start guest failed with tpm, and can not do detach-device for it

# virsh start rl
error: Failed to start domain rl
error: unsupported configuration: The QEMU executable /usr/libexec/qemu-kvm does not support TPM backend type passthrough

Comment 6 vivian zhang 2015-05-25 04:31:00 UTC
verify this with build libvirt-1.2.15-2.el7.x86_64

Steps:
1. prepare a healthy guest without tpm and panic device

2. # cat /tmp/panic.xml 
<panic>
      <address type='isa' iobase='0x505'/>
    </panic>

# cat /tmp/tpm.xml 
<tpm model='tpm-tis'>
      <backend type='passthrough'>
        <device path='/dev/tpm0'/>
      </backend>
    </tpm>

3. try to do hot-plug for panic device

# virsh attach-device vm2 /tmp/panic.xml 
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: live attach of device 'panic' is not supported

# virsh attach-device vm2 /tmp/panic.xml --config
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: persistent attach of device 'panic' is not supported

# virsh attach-device vm2 /tmp/panic.xml --live
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: live attach of device 'panic' is not supported

# virsh attach-device vm2 /tmp/panic.xml --current
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: live attach of device 'panic' is not supported

# virsh attach-device vm2 /tmp/panic.xml --persistent
error: Failed to attach device from /tmp/panic.xml
error: Operation not supported: persistent attach of device 'panic' is not supported

4. edit XML to add panic, and try to hot-unplug panic device
# virsh detach-device vm2 /tmp/panic.xml 
error: Failed to detach device from /tmp/panic.xml
error: Operation not supported: live detach of device 'panic' is not supported

# virsh detach-device vm2 /tmp/panic.xml --live
error: Failed to detach device from /tmp/panic.xml
error: Operation not supported: live detach of device 'panic' is not supported

# virsh detach-device vm2 /tmp/panic.xml --config
error: Failed to detach device from /tmp/panic.xml
error: Operation not supported: persistent detach of device 'panic' is not supported

# virsh detach-device vm2 /tmp/panic.xml --persistnet
error: command 'detach-device' doesn't support option --persistnet

# virsh detach-device vm2 /tmp/panic.xml --persistent
error: Failed to detach device from /tmp/panic.xml
error: Operation not supported: persistent detach of device 'panic' is not supported

5. try to hot-plug tpm device
# virsh attach-device vm2 /tmp/tpm.xml 
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: live attach of device 'tpm' is not supported

# virsh attach-device vm2 /tmp/tpm.xml --live
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: live attach of device 'tpm' is not supported

# virsh attach-device vm2 /tmp/tpm.xml --current
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: live attach of device 'tpm' is not supported

# virsh attach-device vm2 /tmp/tpm.xml --config
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: persistent attach of device 'tpm' is not supported

# virsh attach-device vm2 /tmp/tpm.xml --persistent
error: Failed to attach device from /tmp/tpm.xml
error: Operation not supported: persistent attach of device 'tpm' is not supported

6. config tpm device to XML, guest start failed, so hot-unplug can not be performed for guest
# virsh start vm2
error: Failed to start domain vm2
error: unsupported configuration: The QEMU executable /usr/libexec/qemu-kvm does not support TPM backend type passthrough

move to verified

Comment 7 vivian zhang 2015-06-04 09:49:08 UTC
reset hot-unplug tpm with --config

# virsh detach-device vm1 /tmp/tpm.xml --config
error: Failed to detach device from /tmp/tpm.xml
error: Operation not supported: persistent detach of device 'tpm' is not supported

verify this bug

Comment 8 Eduardo Alvarez 2015-10-30 17:44:22 UTC
This error still persist in RHEL 7.1 Client and Workstation (and maybe Server):

[root@wxm4800 ~]# rpmquery libvirt
libvirt-1.2.8-16.el7_1.4.x86_64

[root@wxm4800 ~]# virsh attach-device win7 /tmp/tpm.xml
error: Failed to attach device from /tmp/tpm.xml
error: unsupported configuration: unknown device type 'devices'

[root@wxm4800 ~]# virsh attach-device win7 /tmp/tpm.xml --live
error: Failed to attach device from /tmp/tpm.xml
error: unsupported configuration: unknown device type 'devices'

[root@wxm4800 ~]# virsh attach-device win7 /tmp/tpm.xml --current
error: Failed to attach device from /tmp/tpm.xml
error: unsupported configuration: unknown device type 'devices'

[root@wxm4800 ~]# virsh attach-device win7 /tmp/tpm.xml --config
error: Failed to attach device from /tmp/tpm.xml
error: unsupported configuration: unknown device type 'devices'

Details using virt-manager:

Error starting domain: unsupported configuration: The QEMU executable /usr/libexec/qemu-kvm does not support TPM backend type passthrough

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 125, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1393, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 966, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: unsupported configuration: The QEMU executable /usr/libexec/qemu-kvm does not support TPM backend type passthrough

I'm not sure but perhaps this has to be with the kernel in rhel 7.1 doesn't come with the tpm-tis as module in the kernel, it seems the tpm is hardcoded in the kernel:
[root@wxm4800 ~]# uname -a
Linux wxm4800 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Aug 25 11:21:22 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@wxm4800 ~]# ls /lib/modules/3.10.0-229.14.1.el7.x86_64/kernel/drivers/char/tpm/
tpm_atmel.ko  tpm_infineon.ko  tpm_nsc.ko[root@wxm4800 ~]# lsmod | grep tpm
[root@wxm4800 ~]# 
[root@wxm4800 ~]# lsmod | grep tpm
[root@wxm4800 ~]#
[root@wxm4800 ~]# cat /sys/class/misc/tpm0/device/resources 
state = active
mem 0xfed40000-0xfed44fff
[root@wxm4800 ~]#

Needed tpm urgently! Exist a way for me to help to solve this soon?

Is like almost 1 year from the first report!

Comment 9 Martin Kletzander 2015-11-02 15:51:16 UTC
(In reply to Eduardo Alvarez from comment #8)
As you can see, this problem was filed for 7.1 (see "Version") and fixed in libvirt-1.2.13-1.el7 (see "Fixed In Version").

Anyway, what you are describing is not relevant to this bug at all.  This bug is about wording of the message that gets printed out.

What you are experiencing are bunch of different problems:
 1) The XML in /tmp/tpm.xml is wrong, according to the error message, there should be no "devices" device type.
 2) The QEMU you have installed doesn't support TPM device with passthrough backend.  Maybe it doesn't even support TPM.  It's just a different wording of the error message you posted.  Anyway, the problem is that you are using QEMU that is too old.  Please don't add irrelevant information into this bug so it doesn't confuse anyone else.

If you need further help with this issue, please follow up with your support contact.

Comment 11 errata-xmlrpc 2015-11-19 05:56:51 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/RHBA-2015-2202.html


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