Re: [PATCH] qemu: forbid a few unsupported things for vhost-user/passt interfaces

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

 



On 2/21/25 1:08 PM, Laine Stump wrote:
On 2/21/25 7:10 AM, Peter Krempa wrote:
On Fri, Feb 21, 2025 at 02:06:42 -0500, Laine Stump wrote:
passt in vhost-user mode doesn't support using multiple queues.

The path of the socket is auto-generated by libvirt for
vhost-user/passt; it can't be set by the user

The passt end of a vhost-user socket is always the server, and the
qemu end is always a client.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
  src/qemu/qemu_validate.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 3e3e368da3..53affcdcff 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1824,6 +1824,22 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
          net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
          if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "interface type=\"vhostuser\" backend type=\"passt\"") < 0)
              return -1;
+
+        if (net->driver.virtio.queues > 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("interface type=\"vhostuser\" backend type=\"passt\" does not support multiple queues"));

In our XML formatter we use single quotes for XML attribute value, in
order to not have to escape stuff.

Yeah, I'm trying to remember why it was that I decided to use double quotes in the error messages. I do recall thinking about it and making a conscious decision, but don't remember the reason. I'll think about it for awhile again and hopefully I'll remember; it *might* have been that there was existing precedent for using double quotes. If I can't recall the reason then I'll change them all to single quotes before I push.

Ah, now I remember - The problem came up in a patch last week where I added validation that shared memory was enabled for vhostuser+passt - there is an existing function qemuValidateDomainDefVhostUserRequireSharedMemory() that takes a string as argument, then constructs the error message by inserting that string into another string *enclosing it in single quotes*; so if I were to use single quotes in my string, the result would end up with single quotes inside single quotes.

The other uses of that function work okay with the single quotes because they send just one word as the arg, so it might say, e.g.

    'virtiofs' requires shared memory

but for this new usage I needed more than a single word to properly qualify what needs shared memory - it is specifically an interface that has both vhost-user and backend passt.

Of course in reality *any* interface with type='vhostuser' will require shared memory, so I *could* make that check more general and then send "vhostuser" to the function and it will just output:

   'vhostuser' requires shared memory

The only reason I didn't generalize the check to be for any vhostuser is because for 11 years we haven't been doing that validation, so Andrea and I (it was him who demanded the validation be added for type='vhostuser' backend type='passt' :-)) were both concerned about adding new validation for something that has been allowed for so long. On the other hand, any existing config that had type='vhostuser' without shared memory would have never worked anyway. So he suggested, and I agreed, that I should add the shared memory check only for vhostuser+passt for now, and generalize it to all vhostuser later.

In the meantime, when I added the new validations in this patch, I once again escaped double quotes just for consistency with the previously added string.

So how about this:

1) I will consider "later" to be "now", generalize the shared memory check to be for any vhostuser, and simplify the name string sent to qemuVDDVURSM() (not typing that again!) to be simply "vhostuser".

2) On top of that post I will redo this patch to use single quotes in the error messages (and won't feel bad about it, since the error checking for shared memory will no longer have double quotes.)

Hopefully that makes sense. I'll send a V2 shortly that will likely make it all clear.




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux