[libvirt] attach-device error: XML error: unknown device type

Chris Evich cevich at redhat.com
Wed Jul 3 18:34:48 UTC 2013


On 07/03/2013 09:46 AM, Daniel P. Berrange wrote:
> On Wed, Jul 03, 2013 at 09:44:46AM -0400, Chris Evich wrote:
>> Hi,
>>
>> On Fedora 18 (libvirt 0.10.2.6-1) I'm trying to add a new serial device
>> to a KVM VM with:
>>
>> virsh attach-device foobar /tmp/serial.xml
>>
>> and I keep getting:
>>
>> error: Failed to attach device from /tmp/serial.xml
>> error: XML error: unknown device type
>>
>> with serial.xml:
>>
>> <serial type='file'>
>>   <source path='/tmp/serialfile'/>
>>   <target port='1'/>
>> </serial>
>>
>> Though I tried it w/o the <target> tag, with and without the --config
>> flag, and with and without the guest running.  Assuming it's similar, I
>> tried and was successful in adding this device via virt-manager, though
>> it complains if the VM is running (which is fine).
>>
>> What am I doing wrong with the virsh attach-device command or XML?
> 
> There is no support for hotplug of any character device (that
> covers serial, parallel, console, channnel elements in the XML)
> 
> 
> Daniel
> 

Oops, sorry, should have been more clear than "and with and without the
guest running".

* I see the 'unknown device type' error when guest is running and I run
  "virsh attach-device foobar /tmp/serial.xml --config".

* I also get 'unknown device type' error when guest is NOT running, and
  I run "virsh attach...." both with or without '--config' flag.

* I see the 'unknown device type' error inside the "details" window
  when the guest is running and I use virt-manager.

* I do NOT get any error, and the device is attached, when I use
  virt-manager, and the guest is NOT running (or by clicking yes
  after getting error in above bullet).

The main difference in using virt-manager, is that I'm selecting the
file type and entering in the values manually instead of in an XML file.

A loosely-related problem is with serial-hot plug (which is expected to
not work).  The error message reported under details is the same/similar
'device type error'.  Whereas I was expecting something more specific
like a "Can't hotplug this" error (see screenshot).

Either way, the main thing I'm concerned about is the "cold-plug" +
device-type error.  Here's what I'm doing:

[root at cevich ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 6     foobar                         running

[root at cevich ~]# virsh attach-device foobar /tmp/serial.xml
error: Failed to attach device from /tmp/serial.xml
error: XML error: unknown device type

[root at cevich ~]# virsh shutdown foobar
Domain foobar is being shutdown

[root at cevich ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     foobar                         shut off

[root at cevich ~]# virsh attach-device foobar /tmp/serial.xml --config
error: Failed to attach device from /tmp/serial.xml
error: XML error: unknown device type

[root at cevich ~]# virsh start foobar

<see screenshot>

Then...

[root at cevich ~]# virsh shutdown foobar
Domain foobar is being shutdown

[root at cevich ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     foobar                         shut off

[root at cevich ~]# virsh dumpxml foobar | grep -A2 "serial type='file'"
    <serial type='file'>
      <source path='/tmp/serialfile'/>
      <target port='1'/>


-- 
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2013-07-03 14:20:38.png
Type: image/png
Size: 138287 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130703/072eebe5/attachment-0001.png>


More information about the libvir-list mailing list