[libvirt-users] serial console

Ekkard Gerlach egerlach at aiai.de
Thu May 10 07:04:55 UTC 2012

* John Wayne schrieb:

> hi,
> when creating a domain using libvirt python api, how would i tell libvirt to use a unique serial port number for domains?
> in the libvirt.virConnect.defineXML(conn,domainxml) call when i create the domainxml object, i need to ensure that the part below has a unique # for target port
> <serial type='pty'>
>   <target port='0'/>
> </serial>
> <console type='pty'>
>   <target type='serial' port='0'/>
> </console>

   <serial type="dev">
      <source path="/dev/ttyS0"/>
      <target port="0"/>

    /dev/ttyS0  of host is connected to port 0 (linux: /dev/ttyS0) of guest.

    <serial type="dev">
      <source path="/dev/ttyUSB0"/> 
      <target port="1"/>
    /dev/ttyUSB0  (usb -> serial adapter) is connected to port 1 (linux: /dev/ttyS1) of guest. 

I works like this on a server of one of my customers.

Don't forget to restart libvirt-bin after changing xml file:
/etc/init.d/libvirt-bin stop   -> start  , then start your guest.


More information about the libvirt-users mailing list