[libvirt-users] Quick questions on virtio-serial transport

Hari Pyla harip at vt.edu
Wed Jul 31 22:20:39 UTC 2013


Hi,
  I am using the virtio-serial transport for communication between the 
host and the guest.
I've created the channel using virt-install:

virt-install --name=centos --import --disk 
/var/lib/libvirt/images/centos.img,size=15 \
         --ram 2048 \
         --vcpus=2 \
         --arch=x86_64 --os-type linux --network=bridge:br1 --graphics vnc \
         --noautoconsole \
         --channel pty,target_type=virtio,name=guest1

This correctly creates a file "/dev/virtio-ports/guest1" in the guest 
for the guest to communicate with the host. So the guest side of things 
are good.

Now on the host side, I see a two files being created in /dev/pts directory.
$ ls -alt /dev/pts
crw--w----  1 qemu  tty  136, 1 Jul 31 15:49 1
crw--w----  1 qemu  tty  136, 2 Jul 31 15:49 2

So here are my questions:

i) I was wondering if there is anyway of knowing which of these files 
correspond to the other end of the channel without having to manually 
echoing data to each of these files and see which of the data shows up 
on the guest side.

ii) I was also wondering if there is anyway of identifying the host side 
endpoint i.e., /dev/pts/FILE of the channel programatically

iii) Better yet can the /dev/pts/FILE be explicitly passed as an 
argument while creating a channel in the guest so the host knows that it 
is supposed to use the /dev/pts/FILE if it wants to talk to the guest.

I read a prior post on this mailing list: 
https://www.redhat.com/archives/libvir-list/2012-May/msg00964.html
It mentions that from the host side one could dump the xml of the guest 
and identify the "source path" of the channel, something in the lines of

<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>

but I do not find the source path in the XML description of the guest 
I've created. This is what I see in the XML file.

  <channel type='pty'>
       <target type='virtio' name='guest1'/>
       <address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>

I was wondering if I am missing something. Any help is greatly appreciated.

Thanks,
--Hari




More information about the libvirt-users mailing list