1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

ifupdown: vxlan-remoteip not getting applied when vxrd is not configured to run

Ticket: CM-7410
Reviewed By: CCR-3470
Testing Done:

When vxrd is not enabled in /etc/default/vxrd, the 'service vxrd status'
command returns 0, causing the vxlan-remoteip to be not applied even
though it should have. Fix is to change to checking pidfile of vxrd.
This commit is contained in:
Wilson Kok
2015-09-10 13:57:14 -07:00
parent 42a9d19335
commit dae9c5dee0
3 changed files with 36 additions and 3 deletions

View File

@ -3,6 +3,7 @@
from ifupdown.iface import *
from ifupdownaddons.modulebase import moduleBase
from ifupdownaddons.iproute2 import iproute2
from ifupdownaddons.systemutils import systemUtils
import ifupdown.rtnetlink_api as rtnetlink_api
import logging
import os
@ -120,7 +121,7 @@ class vxlan(moduleBase):
ifaceobj.get_attr_value('vxlan-svcnodeip'),
vxlanattrs.get('svcnode', []))
if os.system('service vxrd status > /dev/null 2>&1') != 0:
if not systemUtils.is_service_running(None, '/var/run/vxrd.pid'):
# vxlan-remoteip config is allowed only if vxrd is not running
self._query_check_n_update_addresses(ifaceobjcurr, 'vxlan-remoteip',
ifaceobj.get_attr_value('vxlan-remoteip'),
@ -156,7 +157,7 @@ class vxlan(moduleBase):
if attrval:
[ifaceobjrunning.update_config('vxlan-svcnode', a)
for a in attrval]
if os.system('service vxrd status > /dev/null 2>&1') != 0:
if not systemUtils.is_service_running(None, '/var/run/vxrd.pid'):
# vxlan-remoteip config is allowed only if vxrd is not running
attrval = vxlanattrs.get('remote')
if attrval:

View File

@ -7,6 +7,7 @@
import os
from collections import OrderedDict
from utilsbase import *
from systemutils import *
from cache import *
VXLAN_UDP_PORT = 4789
@ -531,7 +532,7 @@ class iproute2(utilsBase):
else:
self.exec_command('ip %s' %cmd)
if os.system('service vxrd status > /dev/null 2>&1') != 0:
if not systemUtils.is_service_running(None, '/var/run/vxrd.pid'):
#figure out the diff for remotes and do the bridge fdb updates
#only if provisioned by user and not by vxrd
cur_peers = set(self.get_vxlan_peers(name))

View File

@ -0,0 +1,31 @@
#!/usr/bin/python
#
# Copyright 2015 Cumulus Networks, Inc. All rights reserved.
# Author: Roopa Prabhu, roopa@cumulusnetworks.com
#
import os
from utilsbase import *
class systemUtils():
@classmethod
def is_service_running(cls, procname=None, pidfile=None):
utilsobj = utilsBase()
if pidfile:
if os.path.exists(pidfile):
pid = utilsobj.read_file_oneline(pidfile)
if not os.path.exists('/proc/%s' %pid):
return False
else:
return False
return True
if procname:
try:
utilsobj.exec_command('/bin/pidof %s' %procname)
except:
return False
else:
return True
return False