You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2019/06/29 14:04:20 UTC

svn commit: r1862310 - in /uima/uima-ducc/trunk/src/main: admin/ducc_util.py admin/virtual_ipaddress.py resources/default.ducc.properties

Author: degenaro
Date: Sat Jun 29 14:04:20 2019
New Revision: 1862310

URL: http://svn.apache.org/viewvc?rev=1862310&view=rev
Log: (empty)

Added:
    uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py   (with props)
Modified:
    uima/uima-ducc/trunk/src/main/admin/ducc_util.py
    uima/uima-ducc/trunk/src/main/resources/default.ducc.properties

Modified: uima/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1862310&r1=1862309&r2=1862310&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Sat Jun 29 14:04:20 2019
@@ -1351,13 +1351,49 @@ class DuccUtil(DuccBase):
             return False
         return True
 
-    keepalivd_conf = '/etc/keepalived/keepalived.conf'
+    keepalived_conf = '/etc/keepalived/keepalived.conf'
+
+    def get_virtual_ipaddress(self):
+        state = 0
+        vip = 'unspecified'
+        if ( os.path.exists(self.keepalived_conf) ):
+            with open(self.keepalived_conf) as f:
+                for line in f:
+                    tokens = line.split(' ')
+                    if(tokens == None):
+                        pass
+                    elif(len(tokens) == 0):
+                        pass
+                    elif(tokens[0] == '!'):
+                        pass
+                    else:
+                        for token in tokens:
+                            token = token.strip()
+                            if(len(token) == 0):
+                                continue
+                            elif(token == '#'):
+                                break
+                            if(state == 0):
+                                if(token == 'virtual_ipaddress'):
+                                    state = 1
+                            elif(state == 1):
+                                if(token == '{'):
+                                    state = 2
+                            elif(state == 2):
+                                vip = token
+                                state = 3
+                            elif(state == 3):
+                                if(token == '}'):
+                                    state = 4
+                            else:
+                                pass
+        return vip
 
     # eligible when keepalived config comprises the ip
     def is_reliable_eligible(self, ip):
         retVal = False
-        if ( os.path.exists(self.keepalivd_conf) ):
-            with open(self.keepalivd_conf) as f:
+        if ( os.path.exists(self.keepalived_conf) ):
+            with open(self.keepalived_conf) as f:
                 for line in f:
                     if ip in line:
                         retVal = True

Added: uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py?rev=1862310&view=auto
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py (added)
+++ uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py Sat Jun 29 14:04:20 2019
@@ -0,0 +1,31 @@
+#! /usr/bin/env python
+# -----------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# -----------------------------------------------------------------------
+
+from ducc_util import DuccUtil
+
+class VirtualIpAddress(DuccUtil):
+    
+    def main(self):
+    	result = self.get_virtual_ipaddress()
+    	print result
+        
+if __name__ == '__main__':
+    instance = VirtualIpAddress()
+    instance.main()
\ No newline at end of file

Propchange: uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/uima-ducc/trunk/src/main/admin/virtual_ipaddress.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: uima/uima-ducc/trunk/src/main/resources/default.ducc.properties
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/resources/default.ducc.properties?rev=1862310&r1=1862309&r2=1862310&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/resources/default.ducc.properties (original)
+++ uima/uima-ducc/trunk/src/main/resources/default.ducc.properties Sat Jun 29 14:04:20 2019
@@ -53,6 +53,13 @@
 # DUCC head node.
 ducc.head = <head-node>
 
+# The ip address of the node where DUCC runs.
+# Reliable DUCC: if running reliably, then this value must be the same ip address
+# specified for the virtual_ipaddress in /etc/keepalived/keepalived.conf for master and
+# backup nodes.  If not specified, then the nameserver is used to get the ip address based
+# on the name specified for ducc.head.
+ducc.head.ip = 
+
 # Reliable DUCC: if running reliably, then this value must comprise the blank delimited list
 # of nodes that are eligible to become the DUCC head node.  Admin commands start_ducc and 
 # stop_ducc are only allowed on the ducc.head node or any node in the ducc.head.reliable.list.