From 77c2b2540777674b6dfb8d7e924a1125b264debe Mon Sep 17 00:00:00 2001 From: David Ames Date: Thu, 17 Aug 2017 15:44:53 -0700 Subject: [PATCH] Dualstack IPv4/IPv6 support Allow for two VIPs on a single interface as in IPv4/IPv6 dual stack scenarios. Add missing group membership for VIPs. Change-Id: Ieba9fd453efcd3d407baaeb8d0d6f3f71750060e --- common.py | 3 +++ requires.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/common.py b/common.py index e6f37e4..d70f704 100644 --- a/common.py +++ b/common.py @@ -573,6 +573,9 @@ class VirtualIP(ResourceDescriptor): else: res_type = 'ocf:heartbeat:IPv6addr' res_params = 'ipv6addr="{}"'.format(self.vip) + vip_params = 'ipv6addr' + vip_key = 'res_{}_{}_{}_vip'.format(self.service_name, self.nic, + vip_params) if self.nic: res_params = '{} nic="{}"'.format(res_params, self.nic) diff --git a/requires.py b/requires.py index 5fbb848..ad3346e 100644 --- a/requires.py +++ b/requires.py @@ -103,6 +103,14 @@ class HAClusterRequires(RelationBase): vip, nic=iface, cidr=netmask,)) + + # Vip Group + group = 'grp_{}_vips'.format(name) + if resource_dict: + vip_resources = resource_dict.get('resources') + if vip_resources: + resources.group(group, *vip_resources.keys()) + self.set_local(resources=resources) def add_init_service(self, name, service, clone=True):