◈ Passerelle

Project

The host-side vhost-user front end

Gap 58 of gap-analysis.md, rank 3 of the backlog: <em>drive the real virtiofsd through the real vhost-user protocol</em>. Until this, the virtiofs path was only ever exercised against our own fake (protofuse/tests/fake_virtiofsd.c) and against the Python reference server of tests/fuse_ref/. Both are ours, so a mistake in our reading of the wire could be repeated on both sides and still pass.

host/vhost/ removes that self-reference for the transport layer: the peer is now virtiofsd 1.10.0, an independent implementation, and it answers.

What is implemented

A vhost-user <strong>front end</strong> (the hypervisor/device side of the socket) in Python, standard library only:

Module Role
protocol.py request numbers, header flags, virtio and protocol feature bits, payload codecs
transport.py UNIX socket, 12-byte header framing, SCM_RIGHTS, reply correlation
memory.py os.memfd_create + mmap region, the SET_MEM_TABLE payload
vring.py split virtqueue: desc table, avail ring, used ring, buffers, eventfd kick/call
device.py the handshake and the per-queue setup, in the order the protocol requires
fuse_client.py FUSE requests posted on the queue, replies harvested and decoded
fake_backend.py a vhost-user <strong>backend</strong> in Python, so unit tests need no virtiofsd
driver.py launches virtiofsd, runs the sequence, compares with the truth

The FUSE wire table is not declared a second time: host/pgwutil/fuse_wire.py is now the single Python declaration, used by this front end <em>and</em> by tests/fuse_ref/fuse_ref_wire.py. Its C twin stays protofuse/src/fusep_abi.h, and two tests compare the two tables field by field.

The address convention (the part that is easy to get wrong)

vhost 0.10 maps the memfd wherever it likes and translates through the memory table, so the two kinds of address in play are <strong>not</strong> the same:

With one region based at guest physical address 0, a descriptor address is simply the offset in the shared region. host/vhost/fake_backend.py maps the memfd at an address of its own and translates through the table, exactly like the crate, so the unit tests would catch a front end that confused the two.

Two more details that only show up when running against a real backend:

What this proves

Running python3 -m pytest host/tests/test_vhost_virtiofsd.py -q with virtiofsd installed:

The whole scenario runs in about one second, well inside the 5-minute CI budget, and it is skipped with an explicit reason when virtiofsd is absent.

What this does NOT prove

Stated plainly, because the gap is real:

Reproduce

cd host
python3 -m vhost --share /tmp/pgw-shared          # the report, line by line
python3 -m pytest tests/test_vhost_virtiofsd.py -q # the same, as a test
python3 -m pytest tests/test_vhost_protocol.py \
    tests/test_vhost_vring.py \
    tests/test_vhost_fuse_client.py -q            # no virtiofsd needed