Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to add a serial device (console) to a guest via the virsh attach-device command. I have a console.xml file containing:

<serial type="pty">
  <target port="0"/>
</serial>

And I run the following command:

sudo virsh attach-device VMNAME console.xml

But get the following error:

error: Failed to attach device from console.xml
error: XML error: unknown device type

Here's my version information:

Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: QEMU 0.9.8
Running hypervisor: QEMU 1.0.0

What am I doing wrong? How can I add this from a script? Any help would be appreciated!!

Thanks in advance.

share|improve this question

1 Answer 1

According to the libvirt documentation, you also need a source element. Something like this:

<serial type='pty'>
  <source path='/dev/pts/3'/>
  <target port='0'/>
</serial>
share|improve this answer
    
Thanks I'll give this a try when I have a minute and let you kno how it went –  D.Mill Jun 13 '13 at 15:44
    
Very late but this gives me the same error: –  D.Mill Jul 11 '13 at 13:45
    
Did you use the correct pts number? –  user1039462 Jul 16 '13 at 10:15
    
Yes, the thing is. this snipet works if it is inserted manually via virsh edit but it fails via virsh attach-device. I don't have the link but I read somewhere that only a limited number of devices (ie: disks and I forget which others) were supported through attach-device. So I've put this on hold for the time being. –  D.Mill Jul 16 '13 at 11:12
    
Is you VM running? 'attach-device' only works on active domains. –  user1039462 Jul 17 '13 at 8:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.