[libvirt PATCH 7/8] tests: qemuxmlconftests: test virtiofsd command line too

Ján Tomko via Devel posted 8 patches 3 weeks, 4 days ago
[libvirt PATCH 7/8] tests: qemuxmlconftests: test virtiofsd command line too
Posted by Ján Tomko via Devel 3 weeks, 4 days ago
From: Ján Tomko <jtomko@redhat.com>

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 ...t-user-fs-ccw.s390x-latest.virtiofsd0.args |  3 ++
 ...fs-fd-memory.x86_64-latest.virtiofsd0.args |  9 ++++++
 ...fd-openfiles.x86_64-latest.virtiofsd0.args | 10 ++++++
 ...fs-hugepages.x86_64-latest.virtiofsd0.args |  3 ++
 ...fs-hugepages.x86_64-latest.virtiofsd1.args |  3 ++
 ...-fs-readonly.x86_64-latest.virtiofsd0.args |  6 ++++
 tests/qemuxmlconftest.c                       | 32 +++++++++++++++++++
 7 files changed, 66 insertions(+)
 create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
 create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
 create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
 create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
 create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
 create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args

diff --git a/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
new file mode 100644
index 0000000000..25567cc821
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
@@ -0,0 +1,3 @@
+/usr/libexec/virtiofsd \
+--fd=1730 \
+--shared-dir /tmp
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
new file mode 100644
index 0000000000..e16a8aba8f
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
@@ -0,0 +1,9 @@
+/usr/libexec/qemu/vhost-user/test-virtiofsd \
+--fd=1730 \
+--shared-dir /path \
+--cache always \
+--sandbox chroot \
+--xattr \
+--thread-pool-size=16 \
+--uid-map=:0:100000:65535: \
+--gid-map=:0:100000:65535:
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
new file mode 100644
index 0000000000..fce94f454e
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
@@ -0,0 +1,10 @@
+/usr/libexec/qemu/vhost-user/test-virtiofsd \
+--fd=1730 \
+--shared-dir /path \
+--cache always \
+--sandbox chroot \
+--xattr \
+--thread-pool-size=16 \
+--rlimit-nofile=122333 \
+--uid-map=:0:100000:65535: \
+--gid-map=:0:100000:65535:
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
new file mode 100644
index 0000000000..591afe82ec
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
@@ -0,0 +1,3 @@
+/usr/libexec/virtiofsd \
+--fd=1730 \
+--shared-dir /path
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
new file mode 100644
index 0000000000..51cb30bf76
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
@@ -0,0 +1,3 @@
+/usr/libexec/virtiofsd \
+--fd=1731 \
+--shared-dir /path
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args
new file mode 100644
index 0000000000..53809e208e
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args
@@ -0,0 +1,6 @@
+/usr/libexec/virtiofsd \
+--fd=1730 \
+--shared-dir /path \
+--cache always \
+--xattr \
+--readonly
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 7280176de1..aaca9b6c05 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -19,6 +19,8 @@
 # include "qemu/qemu_passt.h"
 # include "qemu/qemu_process.h"
 # include "qemu/qemu_slirp.h"
+# include "qemu/qemu_virtiofs.h"
+# include "qemu/qemu_vhost_user.h"
 # include "datatypes.h"
 # include "conf/storage_conf.h"
 # include "virfilewrapper.h"
@@ -456,6 +458,21 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
         vsockPriv->vhostfd = 6789;
     }
 
+    for (i = 0; i < vm->def->nfss; i++) {
+        unsigned long long ver = 0;
+        virDomainFSDef *fs = vm->def->fss[i];
+
+        virStringParseVersion(&ver, info->args.capsver, false);
+
+        if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs->sock) {
+            /* QEMU 8.0.0 was the first release without virtiofsd included */
+            if (ver != 0 && ver < 8 * 1000 * 1000)
+                continue;
+            virBitmapSetBitExpand(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS);
+        }
+    }
+
+
     for (i = 0; i < vm->def->ntpms; i++) {
         if (vm->def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
             continue;
@@ -846,8 +863,10 @@ static int
 testExtDevicesArgv(testQemuInfo *info,
                    virDomainObj *vm)
 {
+    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(QEMU_DOMAIN_PRIVATE(vm)->driver);
     size_t i = 42;
     int ret = 0;
+    int fd;
 
     for (i = 0; i < vm->def->nnets; i++) {
         virDomainNetDef *net = vm->def->nets[i];
@@ -866,6 +885,19 @@ testExtDevicesArgv(testQemuInfo *info,
         }
     }
 
+    for (i = 0; i < vm->def->nfss; i++) {
+        virDomainFSDef *fs = vm->def->fss[i];
+
+        if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs->sock) {
+            g_autoptr(virCommand) cmd = NULL;
+            fd = 1730 + i;
+
+            cmd = qemuVirtioFSBuildCommandLine(cfg, fs, &fd);
+            if (testExtDeviceArgv(info, cmd, "virtiofsd", i) < 0)
+                ret = -1;
+        }
+    }
+
     return ret;
 }
 
-- 
2.50.1

Re: [libvirt PATCH 7/8] tests: qemuxmlconftests: test virtiofsd command line too
Posted by Laine Stump via Devel 2 weeks, 1 day ago
On 9/9/25 8:05 AM, Ján Tomko via Devel wrote:
> From: Ján Tomko <jtomko@redhat.com>
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>   ...t-user-fs-ccw.s390x-latest.virtiofsd0.args |  3 ++
>   ...fs-fd-memory.x86_64-latest.virtiofsd0.args |  9 ++++++
>   ...fd-openfiles.x86_64-latest.virtiofsd0.args | 10 ++++++
>   ...fs-hugepages.x86_64-latest.virtiofsd0.args |  3 ++
>   ...fs-hugepages.x86_64-latest.virtiofsd1.args |  3 ++
>   ...-fs-readonly.x86_64-latest.virtiofsd0.args |  6 ++++
>   tests/qemuxmlconftest.c                       | 32 +++++++++++++++++++
>   7 files changed, 66 insertions(+)
>   create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
>   create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
>   create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
>   create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
>   create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
>   create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args
> 
> diff --git a/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
> new file mode 100644
> index 0000000000..25567cc821
> --- /dev/null
> +++ b/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
> @@ -0,0 +1,3 @@
> +/usr/libexec/virtiofsd \
> +--fd=1730 \
> +--shared-dir /tmp
> diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
> new file mode 100644
> index 0000000000..e16a8aba8f
> --- /dev/null
> +++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
> @@ -0,0 +1,9 @@
> +/usr/libexec/qemu/vhost-user/test-virtiofsd \
> +--fd=1730 \
> +--shared-dir /path \
> +--cache always \
> +--sandbox chroot \
> +--xattr \
> +--thread-pool-size=16 \
> +--uid-map=:0:100000:65535: \
> +--gid-map=:0:100000:65535:
> diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
> new file mode 100644
> index 0000000000..fce94f454e
> --- /dev/null
> +++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
> @@ -0,0 +1,10 @@
> +/usr/libexec/qemu/vhost-user/test-virtiofsd \
> +--fd=1730 \
> +--shared-dir /path \
> +--cache always \
> +--sandbox chroot \
> +--xattr \
> +--thread-pool-size=16 \
> +--rlimit-nofile=122333 \
> +--uid-map=:0:100000:65535: \
> +--gid-map=:0:100000:65535:
> diff --git a/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
> new file mode 100644
> index 0000000000..591afe82ec
> --- /dev/null
> +++ b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
> @@ -0,0 +1,3 @@
> +/usr/libexec/virtiofsd \
> +--fd=1730 \
> +--shared-dir /path
> diff --git a/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
> new file mode 100644
> index 0000000000..51cb30bf76
> --- /dev/null
> +++ b/tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
> @@ -0,0 +1,3 @@
> +/usr/libexec/virtiofsd \
> +--fd=1731 \
> +--shared-dir /path
> diff --git a/tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args b/tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args
> new file mode 100644
> index 0000000000..53809e208e
> --- /dev/null
> +++ b/tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args
> @@ -0,0 +1,6 @@
> +/usr/libexec/virtiofsd \
> +--fd=1730 \
> +--shared-dir /path \
> +--cache always \
> +--xattr \
> +--readonly
> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
> index 7280176de1..aaca9b6c05 100644
> --- a/tests/qemuxmlconftest.c
> +++ b/tests/qemuxmlconftest.c
> @@ -19,6 +19,8 @@
>   # include "qemu/qemu_passt.h"
>   # include "qemu/qemu_process.h"
>   # include "qemu/qemu_slirp.h"
> +# include "qemu/qemu_virtiofs.h"
> +# include "qemu/qemu_vhost_user.h"
>   # include "datatypes.h"
>   # include "conf/storage_conf.h"
>   # include "virfilewrapper.h"
> @@ -456,6 +458,21 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
>           vsockPriv->vhostfd = 6789;
>       }
>   
> +    for (i = 0; i < vm->def->nfss; i++) {
> +        unsigned long long ver = 0;
> +        virDomainFSDef *fs = vm->def->fss[i];
> +
> +        virStringParseVersion(&ver, info->args.capsver, false);
> +
> +        if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs->sock) {
> +            /* QEMU 8.0.0 was the first release without virtiofsd included */
> +            if (ver != 0 && ver < 8 * 1000 * 1000)
> +                continue;
> +            virBitmapSetBitExpand(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS);
> +        }
> +    }

I also won't pretend that I understand why this is here (and yes, that 
*is* for a lack of trying). :-)

> +
> +
>       for (i = 0; i < vm->def->ntpms; i++) {
>           if (vm->def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
>               continue;
> @@ -846,8 +863,10 @@ static int
>   testExtDevicesArgv(testQemuInfo *info,
>                      virDomainObj *vm)
>   {
> +    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(QEMU_DOMAIN_PRIVATE(vm)->driver);
>       size_t i = 42;
>       int ret = 0;
> +    int fd;
>   
>       for (i = 0; i < vm->def->nnets; i++) {
>           virDomainNetDef *net = vm->def->nets[i];
> @@ -866,6 +885,19 @@ testExtDevicesArgv(testQemuInfo *info,
>           }
>       }
>   
> +    for (i = 0; i < vm->def->nfss; i++) {
> +        virDomainFSDef *fs = vm->def->fss[i];
> +
> +        if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs->sock) {
> +            g_autoptr(virCommand) cmd = NULL;
> +            fd = 1730 + i;
> +
> +            cmd = qemuVirtioFSBuildCommandLine(cfg, fs, &fd);
> +            if (testExtDeviceArgv(info, cmd, "virtiofsd", i) < 0)
> +                ret = -1;
> +        }
> +    }
> +
>       return ret;
>   }
>   

Re: [libvirt PATCH 7/8] tests: qemuxmlconftests: test virtiofsd command line too
Posted by Ján Tomko via Devel 1 week, 5 days ago
On a Friday in 2025, Laine Stump wrote:
>On 9/9/25 8:05 AM, Ján Tomko via Devel wrote:
>>From: Ján Tomko <jtomko@redhat.com>
>>
>>Signed-off-by: Ján Tomko <jtomko@redhat.com>
>>---
>>  ...t-user-fs-ccw.s390x-latest.virtiofsd0.args |  3 ++
>>  ...fs-fd-memory.x86_64-latest.virtiofsd0.args |  9 ++++++
>>  ...fd-openfiles.x86_64-latest.virtiofsd0.args | 10 ++++++
>>  ...fs-hugepages.x86_64-latest.virtiofsd0.args |  3 ++
>>  ...fs-hugepages.x86_64-latest.virtiofsd1.args |  3 ++
>>  ...-fs-readonly.x86_64-latest.virtiofsd0.args |  6 ++++
>>  tests/qemuxmlconftest.c                       | 32 +++++++++++++++++++
>>  7 files changed, 66 insertions(+)
>>  create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.virtiofsd0.args
>>  create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-fd-memory.x86_64-latest.virtiofsd0.args
>>  create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.virtiofsd0.args
>>  create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd0.args
>>  create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-hugepages.x86_64-latest.virtiofsd1.args
>>  create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-readonly.x86_64-latest.virtiofsd0.args
>>
>>diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
>>index 7280176de1..aaca9b6c05 100644
>>--- a/tests/qemuxmlconftest.c
>>+++ b/tests/qemuxmlconftest.c
>>@@ -19,6 +19,8 @@
>>  # include "qemu/qemu_passt.h"
>>  # include "qemu/qemu_process.h"
>>  # include "qemu/qemu_slirp.h"
>>+# include "qemu/qemu_virtiofs.h"
>>+# include "qemu/qemu_vhost_user.h"
>>  # include "datatypes.h"
>>  # include "conf/storage_conf.h"
>>  # include "virfilewrapper.h"
>>@@ -456,6 +458,21 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
>>          vsockPriv->vhostfd = 6789;
>>      }
>>+    for (i = 0; i < vm->def->nfss; i++) {
>>+        unsigned long long ver = 0;
>>+        virDomainFSDef *fs = vm->def->fss[i];
>>+
>>+        virStringParseVersion(&ver, info->args.capsver, false);
>>+
>>+        if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs->sock) {
>>+            /* QEMU 8.0.0 was the first release without virtiofsd included */
>>+            if (ver != 0 && ver < 8 * 1000 * 1000)
>>+                continue;
>>+            virBitmapSetBitExpand(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS);
>>+        }
>>+    }
>
>I also won't pretend that I understand why this is here (and yes, that 
>*is* for a lack of trying). :-)

I think it's a sign of the comment being too laconic and/or missing
commit message. How about:

/* QEMU 8.0.0 was the first release without virtiofsd included.
    Assume that from that version, the Rust version of virtiofsd
    which supports separate options is used. */

and for the commit message:

Fake the capabilities based on the QEMU version so that we can test
the command line for both the C version of virtiofsd (removed in QEMU
8.0.0) and the Rust version.

Jano

>
>>+
>>+
>>      for (i = 0; i < vm->def->ntpms; i++) {
>>          if (vm->def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
>>              continue;