1

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.

0

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>
  • 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? – mat 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. – mat Jul 17 '13 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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