2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

ovn-nbctl: Add LB commands.

This patch provides the command line to create a load balancer.
You can create a load balancer independently and add it to multiple
switches or routers. A single load balancer can have multiple vips.
Add a name column for the load balancer. With --add-duplicate,
the command really creates a new load balancer with a duplicate name.
This name has no special meaning or purpose other than to provide
convenience for human interaction with the ovn-nb database.
This patch also provides the unit tests and the documentation.

Signed-off-by: nickcooper-zhangtonghao <nickcooper-zhangtonghao@opencloud.tech>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
This commit is contained in:
nickcooper-zhangtonghao
2016-10-03 01:57:37 -07:00
committed by Gurucharan Shetty
parent ab187e7e30
commit e2bfcad6cb
7 changed files with 856 additions and 3 deletions

View File

@@ -427,6 +427,24 @@ ip_parse(const char *s, ovs_be32 *ip)
return inet_pton(AF_INET, s, ip) == 1;
}
/* Parses string 's', which must be an IP address with a port number
* with ":" as a separator (e.g.: 192.168.1.2:80).
* Stores the IP address into '*ip' and port number to '*port'. */
char * OVS_WARN_UNUSED_RESULT
ip_parse_port(const char *s, ovs_be32 *ip, ovs_be16 *port)
{
int n = 0;
if (!ovs_scan_len(s, &n, IP_PORT_SCAN_FMT,
IP_PORT_SCAN_ARGS(ip, port))) {
return xasprintf("%s: invalid IP address or port number", s);
}
if (s[n]) {
return xasprintf("%s: invalid IP address or port number", s);
}
return NULL;
}
/* Parses string 's', which must be an IP address with an optional netmask or
* CIDR prefix length. Stores the IP address into '*ip', netmask into '*mask',
* (255.255.255.255, if 's' lacks a netmask), and number of scanned characters