Make specifying the nic optional
If a nic is not specified when setting up a vip resource then corosync should just do the right thing. This change makes the nic field optional as there is little benefit in using it. Change-Id: I022a43df0a50a21df3c5f021dcd563da4d20db53
This commit is contained in:
parent
8c72945ead
commit
ad21b5daed
|
@ -11,6 +11,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import hashlib
|
||||
import ipaddress
|
||||
from six import string_types
|
||||
|
||||
|
@ -565,7 +566,12 @@ class VirtualIP(ResourceDescriptor):
|
|||
:param crm: CRM() instance - Config object for Pacemaker resources
|
||||
:returns: None
|
||||
"""
|
||||
vip_key = 'res_{}_{}_vip'.format(self.service_name, self.nic)
|
||||
if self.nic:
|
||||
vip_key = 'res_{}_{}_vip'.format(self.service_name, self.nic)
|
||||
else:
|
||||
vip_key = 'res_{}_{}_vip'.format(
|
||||
self.service_name,
|
||||
hashlib.sha1(self.vip.encode('UTF-8')).hexdigest()[:7])
|
||||
ipaddr = ipaddress.ip_address(self.vip)
|
||||
if isinstance(ipaddr, ipaddress.IPv4Address):
|
||||
res_type = 'ocf:heartbeat:IPaddr2'
|
||||
|
|
|
@ -100,7 +100,7 @@ class HAClusterRequires(RelationBase):
|
|||
self.set_local(**relation_data)
|
||||
self.set_remote(**relation_data)
|
||||
|
||||
def bind_resources(self, iface, mcastport=None):
|
||||
def bind_resources(self, iface=None, mcastport=None):
|
||||
"""Inform the ha subordinate about each service it should manage. The
|
||||
child class specifies the services via self.ha_resources
|
||||
|
||||
|
@ -114,7 +114,7 @@ class HAClusterRequires(RelationBase):
|
|||
self.bind_on(iface=iface, mcastport=mcastport)
|
||||
self.manage_resources(resources)
|
||||
|
||||
def add_vip(self, name, vip, iface, netmask):
|
||||
def add_vip(self, name, vip, iface=None, netmask=None):
|
||||
"""Add a VirtualIP object for each user specified vip to self.resources
|
||||
|
||||
:param name: string - Name of service
|
||||
|
|
Loading…
Reference in New Issue