]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: Fix error message in virNetServerSetClientLimits
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 2 Jan 2023 15:21:24 +0000 (16:21 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 2 Jan 2023 19:39:09 +0000 (20:39 +0100)
That way it actually fits with what the condition checks for.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/rpc/virnetserver.c
tests/virnetdaemondata/input-data-invalid-max-clients-failure.json [new file with mode: 0644]
tests/virnetdaemondata/output-data-invalid-max-clients-failure.err [new file with mode: 0644]
tests/virnetdaemontest.c

index 17ab61b88245de59be55b5824906a35301a053f4..2ec4b9a6c94726e7f60fd789301cb5fba303b07a 100644 (file)
@@ -1114,9 +1114,9 @@ virNetServerSetClientLimits(virNetServer *srv,
 
     if (max < max_unauth) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
-                       _("The overall maximum number of clients must be "
-                         "greater than the maximum number of clients waiting "
-                         "for authentication"));
+                       _("The overall maximum number of clients waiting "
+                         "for authentication must not be less than the overall "
+                         "maximum number of clients"));
         return -1;
     }
 
diff --git a/tests/virnetdaemondata/input-data-invalid-max-clients-failure.json b/tests/virnetdaemondata/input-data-invalid-max-clients-failure.json
new file mode 100644 (file)
index 0000000..9bd5592
--- /dev/null
@@ -0,0 +1,31 @@
+{
+    "servers": {
+        "testServer0": {
+            "min_workers": 10,
+            "max_workers": 50,
+            "priority_workers": 5,
+            "max_clients": 5,
+            "max_anonymous_clients": 10,
+            "keepaliveInterval": 120,
+            "keepaliveCount": 5,
+            "next_client_id": 5,
+            "services": [
+                {
+                    "auth": 0,
+                    "readonly": true,
+                    "nrequests_client_max": 2,
+                    "socks": [
+                        {
+                            "fd": 100,
+                            "errfd": -1,
+                            "pid": 0,
+                            "isClient": false
+                        }
+                    ]
+                }
+            ],
+            "clients": [
+            ]
+        }
+    }
+}
diff --git a/tests/virnetdaemondata/output-data-invalid-max-clients-failure.err b/tests/virnetdaemondata/output-data-invalid-max-clients-failure.err
new file mode 100644 (file)
index 0000000..00c2cee
--- /dev/null
@@ -0,0 +1 @@
+internal error: The overall maximum number of clients must not be less than the number of clients waiting for authentication
index 47d0923bdd9324eec071fa74764cf7e0aa8f2914..110ec748f8b661c3eeedb097cd70116af2eae062 100644 (file)
@@ -413,6 +413,7 @@ mymain(void)
     EXEC_RESTART_TEST_FAIL("anon-clients", 2);
     EXEC_RESTART_TEST("client-auth-pending", 1);
     EXEC_RESTART_TEST_FAIL("client-auth-pending-failure", 1);
+    EXEC_RESTART_TEST_FAIL("invalid-max-clients-failure", 1);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }