[libvirt] How to use a Virtio-serial port

Michal Privoznik mprivozn at redhat.com
Fri May 18 12:18:13 UTC 2012


On 18.05.2012 12:56, Pankaj Rawat wrote:
> Hi,
> 
> Can Anyone please tell me if there is any option in virt-install by which we can specify this vitio-serial port
> 
> I mean I don't want to edit xml file and then define it as it is a post installation process.
> I want to enable the virtio-serial port when I install the guest using virt-install

see man virt-install. It has --channel and --console. To get the channel
I've used in example below:
virt-install --channel
pty,target_type=virtio,name=arbitrary.virtio.serial.port.name

Michal
> 
> Regards
> Pankaj Rawat
> 
> -----Original Message-----
> From: Michal Privoznik [mailto:mprivozn at redhat.com]
> Sent: Tuesday, May 15, 2012 2:14 PM
> To: Pankaj Rawat
> Cc: libvir-list at redhat.com
> Subject: 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 at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list
> 
> 
> 
> 
> 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. .
> 
> -----------------------------------------------------------------------------------------------------------------------




More information about the libvir-list mailing list