Re: [vhostmd virtio PATCH v3 4/6] Add virtio functions

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

 



On 11/15/18 5:13 AM, Trapp, Michael wrote:


On 15.11.18, 00:35, "Jim Fehlig" <jfehlig@xxxxxxxx> wrote:

     On 11/12/18 8:12 AM, Michael Trapp wrote:
     > At the vhostmd side virtio channels are Unix domain sockets from QEMU
     > which are created during a VM start and removed when the VM is stopped.
     >
     > Basically this implementation
     > - monitors a directory for new virtio channels (channel names contain VM UUID)
     > - for valid UUIDs, also known by libvirtd, it connects to the UDS
     > - buffers VM/HOST metrics and handles request/response on the sockets

[...]
     > +/*
     > + * lookup UDS sockets in the directory
     > + * for valid type/name/mbuffer connect and register channel
     > + */
For a long time libvirt has been able to generate a socket path for unix
     channels. The standard path prefix is /var/lib/libvirt/qemu/channel/target. When
     a domain is started a subdir is created with name 'domain-<domid>-<domname>,
     where each unix socket is created based on name attribute of target element. So
     e.g. a domain with id '5' and name 'foobar' containing the following channel config
<channel type='unix'>
            <source mode='bind'/>
            <target type='virtio' name='org.qemu.guest_agent.0'/>
          </channel>
          <channel type='unix'>
            <source mode='bind'/>
            <target type='virtio' name='org.github.vhostmd.1'/>
          </channel>
will result in /var/lib/libvirt/qemu/channel/target/domain-5-foobar/org.qemu.guest_agent.0
     /var/lib/libvirt/qemu/channel/target/domain-5-foobar/org.github.vhostmd.1
Within the VM you have /dev/virtio-ports/org.qemu.guest_agent.0
     /dev/virtio-ports/org.github.vhostmd.1
For consistency with other channels like the guest agent it would be nice to not
     require specifying the channel path in the source element. I realize the
     importance of uuid throughout this patch, but would it be possible to make this
     work using libvirt's naming scheme? Sorry for not noticing this earlier :-(.
Regards,
     Jim

That's quite interesting and, beside the fact that it integrates in the available name scheme and directory structure
of qemu,  it would reduce administration and potential misconfiguration.
 From my understanding the vu_vm.id of a VM must be unique on the host and based on that I can switch my internal 'index'
from uuid to id and use the config you suggested.

Ah right, the key only needs to be unique per host. 'id' should be fine.

I guess we can rely on the fact that the unix socket of a virtio channel is immediately closed
and removed from the filesystem with the 'virsh destroy' command, right?

Yes. libvirt will close the socket and unlink the path. In fact, the entire /var/lib/libvirt/qemu/channel/target/domain-<id>-<name> directory is removed when the VM is shutdown.

Regards,
Jim

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux