[PATCH] virtiofs: rename member to 'openfiles' for clarity

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

 



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@xxxxxxxxxx>
---
 docs/formatdomain.rst                              |  6 +++---
 src/conf/domain_conf.c                             | 14 +++++++-------
 src/conf/domain_conf.h                             |  2 +-
 src/conf/schemas/domaincommon.rng                  |  4 ++--
 src/qemu/qemu_virtiofs.c                           |  4 ++--
 ... vhost-user-fs-fd-openfiles.x86_64-latest.args} |  0
 .../vhost-user-fs-fd-openfiles.x86_64-latest.xml   |  1 +
 ...d-rlimit.xml => vhost-user-fs-fd-openfiles.xml} |  2 +-
 .../vhost-user-fs-fd-rlimit.x86_64-latest.xml      |  1 -
 tests/qemuxmlconftest.c                            |  2 +-
 10 files changed, 18 insertions(+), 18 deletions(-)
 rename tests/qemuxmlconfdata/{vhost-user-fs-fd-rlimit.x86_64-latest.args => vhost-user-fs-fd-openfiles.x86_64-latest.args} (100%)
 create mode 120000 tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.xml
 rename tests/qemuxmlconfdata/{vhost-user-fs-fd-rlimit.xml => vhost-user-fs-fd-openfiles.xml} (97%)
 delete mode 120000 tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.xml

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 10584dfe83..c2a6d0b910 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -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
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6733857a3a..d1c59f7a91 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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);
 
     }
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8283493dfc..6972f6ae9b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -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;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index ab5374d5f0..8dae6416e9 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -3381,9 +3381,9 @@
           </element>
         </optional>
         <optional>
-          <element name="rlimit_nofile">
+          <element name="openfiles">
             <optional>
-              <attribute name="size">
+              <attribute name="max">
                 <data type="positiveInteger"/>
               </attribute>
             </optional>
diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
index 703f1226a2..a8f2416273 100644
--- a/src/qemu/qemu_virtiofs.c
+++ b/src/qemu/qemu_virtiofs.c
@@ -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-rlimit.x86_64-latest.args b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.args
similarity index 100%
rename from tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.args
rename to tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.args
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
index 0000000000..74761b0d0f
--- /dev/null
+++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.x86_64-latest.xml
@@ -0,0 +1 @@
+vhost-user-fs-fd-openfiles.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-openfiles.xml
similarity index 97%
rename from tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.xml
rename to tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.xml
index 2983d3f275..3e925a8c8b 100644
--- a/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.xml
+++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-openfiles.xml
@@ -32,7 +32,7 @@
         <cache mode='always'/>
         <sandbox mode='chroot'/>
         <thread_pool size='16'/>
-        <rlimit_nofile size='122333'/>
+        <openfiles max='122333'/>
       </binary>
       <idmap>
         <uid start='0' target='100000' count='65535'/>
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
index 68c4e8a482..0000000000
--- a/tests/qemuxmlconfdata/vhost-user-fs-fd-rlimit.x86_64-latest.xml
+++ /dev/null
@@ -1 +0,0 @@
-vhost-user-fs-fd-rlimit.xml
\ No newline at end of file
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index cc984440ea..bf88bd2f8d 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -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");
 
-- 
2.45.2




[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