Skip to contentSkip to conversation

Added simple weighted failover scheduler to ipvs

PATCH Superseded Kenny Mathis 2 participants 2 messages Sep 8, 2014 – Sep 9, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added simple weighted failover scheduler to ipvs

Please consider this patch for addition in 3.17

Creates net/netfilter/ipvs/ip_vs_fo.c

Added simple weighted IPVS failover support to the Linux kernel. All other scheduling modules implement some form of load balancing, while this offers a simple failover solution. Connections are directed to the appropriate server based solely on highest weight value and server availability. Tested functionality with keepalived.

---
 net/netfilter/ipvs/Kconfig    |   10 ++++++
 net/netfilter/ipvs/Makefile   |    1 +
 net/netfilter/ipvs/ip_vs_fo.c |   79 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 net/netfilter/ipvs/ip_vs_fo.c
net/netfilter/ipvs/Kconfig +10 -0
index 0c3b167..3b6929d 100644
@@ -152,6 +152,16 @@ config	IP_VS_WLC
 	  If you want to compile it in kernel, say Y. To compile it as a
 	  module, choose M here. If unsure, say N.
 
+config  IP_VS_FO
+		tristate "weighted failover scheduling"
+	---help---
+	  The weighted failover scheduling algorithm directs network
+	  connections to the server with the highest weight that is
+	  currently available.
+
+	  If you want to compile it in kernel, say Y. To compile it as a
+	  module, choose M here. If unsure, say N.
+
 config	IP_VS_LBLC
 	tristate "locality-based least-connection scheduling"
 	---help---
net/netfilter/ipvs/Makefile +1 -0
index 34ee602..38b2723 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_IP_VS_RR) += ip_vs_rr.o
 obj-$(CONFIG_IP_VS_WRR) += ip_vs_wrr.o
 obj-$(CONFIG_IP_VS_LC) += ip_vs_lc.o
 obj-$(CONFIG_IP_VS_WLC) += ip_vs_wlc.o
+obj-$(CONFIG_IP_VS_FO) += ip_vs_fo.o
 obj-$(CONFIG_IP_VS_LBLC) += ip_vs_lblc.o
 obj-$(CONFIG_IP_VS_LBLCR) += ip_vs_lblcr.o
 obj-$(CONFIG_IP_VS_DH) += ip_vs_dh.o
net/netfilter/ipvs/ip_vs_fo.c new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

Hello,

Quoted 3 lines · Kenny Mathis

Please consider this patch for addition in 3.17

Creates net/netfilter/ipvs/ip_vs_fo.c

Lines like the two above usually go after
the '---' line. New features go first to the
{ipvs,nf,net}-next trees.

Quoted 5 lines

Added simple weighted IPVS failover support to the Linux kernel. All other scheduling modules implement some form of load balancing, while this offers a simple failover solution. Connections are directed to the appropriate server based solely on highest weight value and server availability. Tested functionality with keepalived.

What about changing 'Added' with 'Add', using
'ipvs: Add simple ...' in Subject line and reducing the many spaces in above comments to one? The main thing, there must be a Signed-off-by: line:

# scripts/checkpatch.pl --strict /tmp/fo.diff 
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 0 checks, 102 lines checked

/tmp/fo.diff has style problems, please review.

net/netfilter/ipvs/ip_vs_fo.c line 29

Quoted 5 lines
net/netfilter/ipvs/ip_vs_fo.c new file +5 -0
+static struct ip_vs_dest *
+ip_vs_fo_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
+		  struct ip_vs_iphdr *iph)
+{
+	struct ip_vs_dest *dest = NULL, *hweight = NULL;

' = NULL' after dest is not needed. Otherwise,
the module looks correctly implemented. You can post PATCHv2 after making all needed changes.

Regards

--
Julian Anastasov <[email protected]>