aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2019-01-22 11:52:15 +0100
committerJesper Dangaard Brouer <brouer@redhat.com>2019-01-22 11:52:15 +0100
commit0dd79e16e53378e9f999d082ac0baae4668a53bf (patch)
treeb79251632b9dbe4997e15d9304abbd72e86c04ce
parent5cd1778489c52d480df64d4541a48258b88d10de (diff)
parent1892dd2d3a04c4bb78dc97e6bcfde33bf6aa2d5e (diff)
downloadipvsadm-0dd79e16e53378e9f999d082ac0baae4668a53bf.tar.gz
Merge: ipvsadm: Document/add support for fo/ovf/mh schedulers
Quentin Armitage <quentin@armitage.org.uk> writes: The kernel supports the fo, ovf and mh IPVS schedulers, but ipvsadm has not yet been updated to document/support them. Currently ipvsadm can support them, but users of ipvsadm will not be aware of their existence without reading the kernel sources. The following patches document support for these schedulers, and also adds new flags mh-fallback and mh-port. Changes since v1: - Correct description of fo scheduler - Correct description of ovf scheduler - Completely rewrite description of mh scheduler - Move definitions of IP_VS_SVC_F_SCHED_MH* from ipvsadm.c to libipvs/ip_vs.h - Don't print flag-3 for SH and MH schedulers With many thanks to Julian Anastasov for pointing out the errors in the v1 patches and the suggested improvements. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
-rw-r--r--SCHEDULERS2
-rw-r--r--ipvsadm.818
-rw-r--r--ipvsadm.c17
-rw-r--r--libipvs/ip_vs.h3
4 files changed, 37 insertions, 3 deletions
diff --git a/SCHEDULERS b/SCHEDULERS
index 84ba299..06d3357 100644
--- a/SCHEDULERS
+++ b/SCHEDULERS
@@ -1 +1 @@
-rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq
+rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq|fo|ovf|mh
diff --git a/ipvsadm.8 b/ipvsadm.8
index dad1712..1b25888 100644
--- a/ipvsadm.8
+++ b/ipvsadm.8
@@ -267,6 +267,24 @@ fixed service rate (weight) of the ith server.
\fBnq\fR - Never Queue: assigns an incoming job to an idle server if
there is, instead of waiting for a fast one; if all the servers are
busy, it adopts the Shortest Expected Delay policy to assign the job.
+.sp
+\fBfo\fR - Weighted Failover: assigns an incoming job to the server
+with the highest weight that is currently available.
+.sp
+\fBovf\fR - Weighted Overflow: assigns an incoming job to the server
+with the highest weight that is currently available and overflows
+to the next when active connections exceed the node's weight. Note
+that this scheduler might not be suitable for UDP because it only uses
+active connections.
+.sp
+\fBmh\fR - Maglev Hashing: assigns incoming jobs based on Google's
+Maglev hashing algorithm, providing an almost equal share of jobs to
+each real server and provides minimal disruption. When the set of real
+servers changes, a connection will likely be sent to the same real
+server as it was before.
+This scheduler has two flags: mh-fallback, which enables fallback to a
+different server if the selected server was unavailable, and mh-port,
+which adds the source port number to the hash computation.
.TP
.B -p, --persistent [\fItimeout\fP]
Specify that a virtual service is persistent. If this option is
diff --git a/ipvsadm.c b/ipvsadm.c
index 7695006..0cb2b68 100644
--- a/ipvsadm.c
+++ b/ipvsadm.c
@@ -1145,6 +1145,16 @@ static unsigned int parse_sched_flags(const char *sched, char *optarg)
if (strcmp(sched, "sh"))
fail(2, "incompatible scheduler flag `%s'",
flag);
+ } else if (!strcmp(flag, "mh-fallback")) {
+ flags |= IP_VS_SVC_F_SCHED_MH_FALLBACK;
+ if (strcmp(sched, "mh"))
+ fail(2, "incompatible scheduler flag `%s'",
+ flag);
+ } else if (!strcmp(flag, "mh-port")) {
+ flags |= IP_VS_SVC_F_SCHED_MH_PORT;
+ if (strcmp(sched, "mh"))
+ fail(2, "incompatible scheduler flag `%s'",
+ flag);
} else {
fail(2, "invalid scheduler flag `%s'", flag);
}
@@ -1589,8 +1599,11 @@ static void print_sched_flags(ipvs_service_entry_t *se)
strcat(flags, "sh-fallback,");
if (se->flags & IP_VS_SVC_F_SCHED_SH_PORT)
strcat(flags, "sh-port,");
- if (se->flags & IP_VS_SVC_F_SCHED3)
- strcat(flags, "flag-3,");
+ } else if (!strcmp(se->sched_name, "mh")) {
+ if (se->flags & IP_VS_SVC_F_SCHED_MH_FALLBACK)
+ strcat(flags, "mh-fallback,");
+ if (se->flags & IP_VS_SVC_F_SCHED_MH_PORT)
+ strcat(flags, "mh-port,");
} else {
if (se->flags & IP_VS_SVC_F_SCHED1)
strcat(flags, "flag-1,");
diff --git a/libipvs/ip_vs.h b/libipvs/ip_vs.h
index e57d55a..ad0141c 100644
--- a/libipvs/ip_vs.h
+++ b/libipvs/ip_vs.h
@@ -36,6 +36,9 @@
#define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */
#define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */
+#define IP_VS_SVC_F_SCHED_MH_FALLBACK IP_VS_SVC_F_SCHED1 /* MH fallback */
+#define IP_VS_SVC_F_SCHED_MH_PORT IP_VS_SVC_F_SCHED2 /* MH use port */
+
/*
* IPVS sync daemon states