r2r
r2r

Reputation: 21

how to configure/start vm with just libvirt and vhost-user

I am trying to start my VM with 2 Virtio interfaces as a vhost-user interface

Following is the relevant section of my domain xml

<interface type='vhostuser'>
  <mac address='52:54:00:c7:ac:38'/>
  <source type='unix' path='/tmp/vhost1.sock' mode='server'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</interface>
<interface type='vhostuser'>
  <mac address='52:54:00:9d:ea:73'/>
  <source type='unix' path='/tmp/vhost2.sock' mode='server'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</interface>"`

When I execute virsh start domain_name command

it starts then becomes paused. The log shows it's stuck at

n-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on
QEMU waiting for connection on: disconnected:unix:/tmp/vhost1.sock,server

Is there anything I am missing?

some info

Compiled against library: libvirt 1.2.18

Using library: libvirt 1.2.18

Using API: QEMU 1.2.18

Running hypervisor: QEMU 2.4.1

hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime 0 0

HugePages_Total:      10
HugePages_Free:       10
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:    1048576 kB


# ls -lar /tmp/*
srwxrwxrwx. 1 qemu qemu 0 Apr 28 14:02 /tmp/vhost1.sock

Upvotes: 2

Views: 2023

Answers (1)

DanielB
DanielB

Reputation: 2816

This is normal behaviour for the configuration in question. When requesting mode='server' QEMU will start a UNIX socket server and wait for a connection to be made to this before it allows the guest to start executing. So for this to be practically used you need to have the external process watch for creation of UNIX sockets (eg using inotify) and connect promptly.

The alternative is to switch to mode=client where QEMU connects to the external network service avoiding any delay.

Upvotes: 1

Related Questions