[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] How to use a Virtio-serial port



On 15.05.2012 09:06, Pankaj Rawat wrote:
> Hi all,
> 
>  
> 
> I want to use virtio-serial
> 
> For this I changes my  guest xml
> 
> <channel type='pty'>
> 
>       <target type='virtio' name='arbitrary.virtio.serial.port.name'/>
> 
>  </channel>
> 
>  
> 
> This create a virtio port in guest as follow
> 
>  
> 
> # ls -l /dev/virtio-ports/
> 
> lrwxrwxrwx. 1 root root 11 May 15 02:59
> arbitrary.virtio.serial.port.name -> ../vport0p1
> 
>  
> 
> Now I want to use this port
> 
> What type of application use this port for communication and how can I
> use it ?
> 

When you start your domain and then dump its XML it will look like this:

    <channel type='pty'>
      <source path='/dev/pts/12'/>
      <target type='virtio' name='arbitrary.virtio.serial.port.name'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

So one end of the channel is inside the domain under
/dev/virtio-ports/arbitrary.virtio.serial.port.name and the other one is
under /dev/pts/12 in the host. Therefore running:

(guest) cat /dev/virtio-ports/arbitrary.virtio.serial.port.name
(host) echo "Hello world" > /dev/pts/12

will do all the magic. You can use any tool that is able to work with
unix domain sockets. I personally use socat [1].

1: http://www.dest-unreach.org/socat/
>  
> 
> Regards
> 
> Pankaj Rawat
> 
>  
> 
> 
> DISCLAIMER:
> 
> -----------------------------------------------------------------------------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and
> intended
> 
> for the named recipient(s) only. 
> 
> It shall not attach any liability on the originator or NECHCL or its
> 
> affiliates. Any views or opinions presented in 
> 
> this email are solely those of the author and may not necessarily reflect the
> 
> opinions of NECHCL or its affiliates. 
> 
> Any form of reproduction, dissemination, copying, disclosure, modification,
> 
> distribution and / or publication of 
> 
> this message without the prior written consent of the author of this e-mail is
> 
> strictly prohibited. If you have 
> 
> received this email in error please delete it and notify the sender
> 
> immediately. .
> 
> -----------------------------------------------------------------------------------------------------------------------
> 
> 
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]