]> xenbits.xensource.com Git - libvirt.git/commitdiff
virtiofs: rename member to 'openfiles' for clarity
authorAdam Julis <ajulis@redhat.com>
Tue, 23 Jul 2024 12:47:58 +0000 (14:47 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 24 Jul 2024 10:48:16 +0000 (12:48 +0200)
New element 'openfiles' had confusing name. Since the patch with
this new element wasn't propagate yet, old name ('rlimit_nofile')
was changed.

...
<binary>
  <openfiles max='122333'/>
</binary>
...

Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
12 files changed:
docs/formatdomain.rst
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/schemas/domaincommon.rng
src/qemu/qemu_virtiofs.c
tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.args [new file with mode: 0644]
tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.xml [new symlink]
tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.xml [new file with mode: 0644]
tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.args [deleted file]
tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.xml [deleted symlink]
tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.xml [deleted file]
tests/qemuxmlconftest.c

index 10584dfe831b80c920263c74d3c201eb927ed5eb..c2a6d0b910bba043070e74e7fcba48cebd4eeba5 100644 (file)
@@ -3734,10 +3734,10 @@ A directory on the host that can be accessed directly from the guest.
    The thread pool helps increase the number of requests in flight when used with
    storage that has a higher latency.  However, it has an overhead, and so for
    fast, low latency filesystems, it may be best to turn it off. ( :since:`Since 8.5.0` )
-   Element ``rlimit_profile`` accepts one attribute ``size`` which defines the
+   Element ``openfiles`` accepts one attribute ``max`` which defines the
    maximum number of file descriptors. Non-positive values are forbidden.
-   Although numbers greater than 1M are allowed, the virtiofsd documentation
-   states that in this case its set by virtiofsd to the 1M. ( :since:`Since 10.6.0` )
+   The upper bound on the number of open files is implementation defined.
+   ( :since:`Since 10.6.0` )
 ``source``
    The resource on the host that is being accessed in the guest. The ``name``
    attribute must be used with ``type='template'``, and the ``dir`` attribute
index 6733857a3acbec1198a2c4245808e51bc3e6c469..d1c59f7a9160912961f4a68df2e82c2b149961b3 100644 (file)
@@ -8868,7 +8868,7 @@ virDomainFSDefParseXML(virDomainXMLOption *xmlopt,
         g_autofree char *queue_size = virXPathString("string(./driver/@queue)", ctxt);
         g_autofree char *binary = virXPathString("string(./binary/@path)", ctxt);
         g_autofree char *thread_pool_size = virXPathString("string(./binary/thread_pool/@size)", ctxt);
-        g_autofree char *rlimit_nofile = virXPathString("string(./binary/rlimit_nofile/@size)", ctxt);
+        g_autofree char *openfiles = virXPathString("string(./binary/openfiles/@max)", ctxt);
         xmlNodePtr binary_node = virXPathNode("./binary", ctxt);
         xmlNodePtr binary_lock_node = virXPathNode("./binary/lock", ctxt);
         xmlNodePtr binary_cache_node = virXPathNode("./binary/cache", ctxt);
@@ -8892,11 +8892,11 @@ virDomainFSDefParseXML(virDomainXMLOption *xmlopt,
             goto error;
         }
 
-        if (rlimit_nofile &&
-            virStrToLong_ull(rlimit_nofile, NULL, 10, &def->rlimit_nofile) < 0) {
+        if (openfiles &&
+            virStrToLong_ull(openfiles, NULL, 10, &def->openfiles) < 0) {
             virReportError(VIR_ERR_XML_ERROR,
-                           _("cannot parse rlimit_nofile '%1$s' for virtiofs"),
-                           rlimit_nofile);
+                           _("cannot parse openfiles '%1$s' for virtiofs"),
+                           openfiles);
             goto error;
         }
 
@@ -23424,8 +23424,8 @@ virDomainFSDefFormat(virBuffer *buf,
         if (def->thread_pool_size >= 0)
             virBufferAsprintf(&binaryBuf, "<thread_pool size='%d'/>\n", def->thread_pool_size);
 
-        if (def->rlimit_nofile > 0)
-            virBufferAsprintf(&binaryBuf, "<rlimit_nofile size='%lld'/>\n", def->rlimit_nofile);
+        if (def->openfiles > 0)
+            virBufferAsprintf(&binaryBuf, "<openfiles max='%lld'/>\n", def->openfiles);
 
     }
 
index 8283493dfcd7871787a12cd21f28dabb1d252880..6972f6ae9b5a2860c7cb4353d4b2c708e2bad12f 100644 (file)
@@ -890,7 +890,7 @@ struct _virDomainFSDef {
     bool symlinksResolved;
     char *binary;
     unsigned long long queue_size;
-    unsigned long long rlimit_nofile;
+    unsigned long long openfiles;
     virTristateSwitch xattr;
     virDomainFSCacheMode cache;
     virTristateSwitch posix_lock;
index ab5374d5f024ce87b746128268c10cd095d3bec8..8dae6416e9ae6b25771701eccc9c988e80484c47 100644 (file)
           </element>
         </optional>
         <optional>
-          <element name="rlimit_nofile">
+          <element name="openfiles">
             <optional>
-              <attribute name="size">
+              <attribute name="max">
                 <data type="positiveInteger"/>
               </attribute>
             </optional>
index 703f1226a292835312fe8344aa1a1fb4c592a9ad..a8f2416273d9ce1e458ef799caa9db50f4ec73f8 100644 (file)
@@ -194,8 +194,8 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
     if (fs->thread_pool_size >= 0)
         virCommandAddArgFormat(cmd, "--thread-pool-size=%i", fs->thread_pool_size);
 
-    if (fs->rlimit_nofile > 0)
-        virCommandAddArgFormat(cmd, "--rlimit-nofile=%llu", fs->rlimit_nofile);
+    if (fs->openfiles > 0)
+        virCommandAddArgFormat(cmd, "--rlimit-nofile=%llu", fs->openfiles);
 
     if (cfg->virtiofsdDebug) {
         if (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS))
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.args
new file mode 100644 (file)
index 0000000..b4c2e3f
--- /dev/null
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,acpi=off \
+-accel kvm \
+-cpu qemu64 \
+-m size=14680064k \
+-overcommit mem-lock=off \
+-smp 2,sockets=2,cores=1,threads=1 \
+-object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/var/lib/libvirt/qemu/ram/-1-guest/ram-node0","share":true,"size":15032385536}' \
+-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
+-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-chardev socket,id=chr-vu-fs0,path=/var/lib/libvirt/qemu/domain--1-guest/fs0-fs.sock \
+-device '{"driver":"vhost-user-fs-pci","id":"fs0","chardev":"chr-vu-fs0","queue-size":1027,"tag":"mount_tag","bus":"pci.0","addr":"0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.xml b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.xml
new file mode 120000 (symlink)
index 0000000..74761b0
--- /dev/null
@@ -0,0 +1 @@
+vhost-user-fs-fd-openfiles.xml
\ No newline at end of file
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.xml b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.xml
new file mode 100644 (file)
index 0000000..3e925a8
--- /dev/null
@@ -0,0 +1,50 @@
+<domain type='kvm'>
+  <name>guest</name>
+  <uuid>126f2720-6f8e-45ab-a886-ec9277079a67</uuid>
+  <memory unit='KiB'>14680064</memory>
+  <currentMemory unit='KiB'>14680064</currentMemory>
+  <memoryBacking>
+    <source type='file'/>
+    <access mode='shared'/>
+  </memoryBacking>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+    <numa>
+      <cell id='0' cpus='0-1' memory='14680064' unit='KiB' memAccess='shared'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <filesystem type='mount' accessmode='passthrough'>
+      <driver type='virtiofs' queue='1027'/>
+      <binary xattr='on'>
+        <cache mode='always'/>
+        <sandbox mode='chroot'/>
+        <thread_pool size='16'/>
+        <openfiles max='122333'/>
+      </binary>
+      <idmap>
+        <uid start='0' target='100000' count='65535'/>
+        <gid start='0' target='100000' count='65535'/>
+      </idmap>
+      <source dir='/path'/>
+      <target dir='mount_tag'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </filesystem>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.args
deleted file mode 100644 (file)
index b4c2e3f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-guest \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=guest,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
--machine pc,usb=off,dump-guest-core=off,acpi=off \
--accel kvm \
--cpu qemu64 \
--m size=14680064k \
--overcommit mem-lock=off \
--smp 2,sockets=2,cores=1,threads=1 \
--object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/var/lib/libvirt/qemu/ram/-1-guest/ram-node0","share":true,"size":15032385536}' \
--numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
--uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--chardev socket,id=chr-vu-fs0,path=/var/lib/libvirt/qemu/domain--1-guest/fs0-fs.sock \
--device '{"driver":"vhost-user-fs-pci","id":"fs0","chardev":"chr-vu-fs0","queue-size":1027,"tag":"mount_tag","bus":"pci.0","addr":"0x2"}' \
--audiodev '{"id":"audio1","driver":"none"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.xml b/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.xml
deleted file mode 120000 (symlink)
index 68c4e8a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-vhost-user-fs-fd-rlimit.xml
\ No newline at end of file
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.xml b/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.xml
deleted file mode 100644 (file)
index 2983d3f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<domain type='kvm'>
-  <name>guest</name>
-  <uuid>126f2720-6f8e-45ab-a886-ec9277079a67</uuid>
-  <memory unit='KiB'>14680064</memory>
-  <currentMemory unit='KiB'>14680064</currentMemory>
-  <memoryBacking>
-    <source type='file'/>
-    <access mode='shared'/>
-  </memoryBacking>
-  <vcpu placement='static'>2</vcpu>
-  <os>
-    <type arch='x86_64' machine='pc'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <cpu mode='custom' match='exact' check='none'>
-    <model fallback='forbid'>qemu64</model>
-    <numa>
-      <cell id='0' cpus='0-1' memory='14680064' unit='KiB' memAccess='shared'/>
-    </numa>
-  </cpu>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
-    <controller type='usb' index='0' model='none'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <filesystem type='mount' accessmode='passthrough'>
-      <driver type='virtiofs' queue='1027'/>
-      <binary xattr='on'>
-        <cache mode='always'/>
-        <sandbox mode='chroot'/>
-        <thread_pool size='16'/>
-        <rlimit_nofile size='122333'/>
-      </binary>
-      <idmap>
-        <uid start='0' target='100000' count='65535'/>
-        <gid start='0' target='100000' count='65535'/>
-      </idmap>
-      <source dir='/path'/>
-      <target dir='mount_tag'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
-    </filesystem>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <audio id='1' type='none'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
index cc984440ea7e5dfc329ad1f760b3a86609d2e202..bf88bd2f8d689ea765ac7b0113377cee6810d41c 100644 (file)
@@ -2816,7 +2816,7 @@ mymain(void)
     DO_TEST_CAPS_ARCH_LATEST("launch-security-s390-pv", "s390x");
 
     DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory");
-    DO_TEST_CAPS_LATEST("vhost-user-fs-fd-rlimit");
+    DO_TEST_CAPS_LATEST("vhost-user-fs-fd-openfiles");
     DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages");
     DO_TEST_CAPS_LATEST_PARSE_ERROR("vhost-user-fs-readonly");