Re: [devel] [PATCH 1/1] pyosaf: High level python interfaces for IMM [#2602]

2017-10-27 Thread Quyen Dao

Hi Hieu,

Ack. Tested with basic scenarios.

Thanks,
Quyen

On 10/27/2017 9:46 PM, Hieu Nguyen wrote:

---
  python/Makefile.am   |4 +-
  python/pyosaf/utils/immoi/__init__.py|  456 ++
  python/pyosaf/utils/immoi/implementer.py | 1009 --
  python/pyosaf/utils/immom/__init__.py|  241 ---
  python/pyosaf/utils/immom/accessor.py|  135 
  python/pyosaf/utils/immom/agent.py   |  421 +
  python/pyosaf/utils/immom/ccb.py |  455 --
  python/pyosaf/utils/immom/iterator.py|  109 ++--
  python/pyosaf/utils/immom/object.py  |   34 +-
  9 files changed, 1882 insertions(+), 982 deletions(-)
  create mode 100644 python/pyosaf/utils/immom/accessor.py
  create mode 100644 python/pyosaf/utils/immom/agent.py

diff --git a/python/Makefile.am b/python/Makefile.am
index 390366a..bc0f32a 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -48,7 +48,9 @@ pkgpyosafutilsimmom_PYTHON = \
python/pyosaf/utils/immom/__init__.py \
python/pyosaf/utils/immom/ccb.py \
python/pyosaf/utils/immom/iterator.py \
-   python/pyosaf/utils/immom/object.py
+   python/pyosaf/utils/immom/object.py \
+   python/pyosaf/utils/immom/agent.py \
+   python/pyosaf/utils/immom/accessor.py
  
  pkgpyosafutilsclm_PYTHON = \

python/pyosaf/utils/clm/__init__.py
diff --git a/python/pyosaf/utils/immoi/__init__.py 
b/python/pyosaf/utils/immoi/__init__.py
index 55cb1ff..1b4dece 100644
--- a/python/pyosaf/utils/immoi/__init__.py
+++ b/python/pyosaf/utils/immoi/__init__.py
@@ -25,28 +25,27 @@ Supported functions:
  - Get IMM error strings
  """
  from __future__ import print_function
-
+from copy import deepcopy
  from ctypes import c_char_p, c_void_p, cast, pointer
  
  from pyosaf.saAis import SaStringT, SaVersionT, SaNameT, SaSelectionObjectT, \

-unmarshalSaStringTArray, eSaDispatchFlagsT
+unmarshalSaStringTArray, eSaDispatchFlagsT, eSaAisErrorT
  from pyosaf import saImm, saImmOi
  from pyosaf.saImm import unmarshalSaImmValue, SaImmAttrNameT,  \
  SaImmAttrValuesT_2, SaImmClassNameT, SaImmSearchParametersT_2, \
  eSaImmValueTypeT, SaImmAttrDefinitionT_2, SaImmClassCategoryT, \
  SaImmAttrModificationT_2, eSaImmAttrModificationTypeT
  from pyosaf.saImmOi import SaImmOiHandleT, SaImmOiImplementerNameT
-from pyosaf.utils import immom
+from pyosaf.utils import immom, log_err, bad_handle_retry, decorate, \
+deprecate, initialize_decorate, SafException
  from pyosaf.utils.immom.object import ImmObject
  from pyosaf.utils.immom.ccb import marshal_c_array
  from pyosaf.utils.immom.iterator import SearchIterator
-from pyosaf.utils import decorate, initialize_decorate
  
  
-selection_object = SaSelectionObjectT()

-handle = SaImmOiHandleT()
-TRY_AGAIN_CNT = 60
  OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,safApp=safImmService"
+_oi_agent = None
+
  
  # Decorate pure saImmOi* API's with error-handling retry and exception raising

  saImmOiInitialize_2 = initialize_decorate(saImmOi.saImmOiInitialize_2)
@@ -71,61 +70,290 @@ saImmOiAugmentCcbInitialize = 
decorate(saImmOi.saImmOiAugmentCcbInitialize)
  saImmOiCcbSetErrorString = decorate(saImmOi.saImmOiCcbSetErrorString)
  
  
-def initialize(callbacks=None):

-""" Initialize the IMM OI library
-
-Args:
-callbacks (SaImmOiCallbacksT_2): OI callbacks to register with IMM
+class OiAgent(object):
+""" This class acts as a high-level OI agent, providing OI functions to
+the users as a higher level, and relieving the users of the need to manage
+the life cycle of the OI agent and providing general interface for
+Implementer or Applier used
  """
-version = SaVersionT('A', 2, 15)
-saImmOiInitialize_2(handle, callbacks, version)
+def __init__(self, version=None):
+""" Constructor for OiAgent class
+
+Args:
+version (SaVersionT): OI API version
+"""
+self.handle = None
+self.init_version = version if version is not None \
+else SaVersionT('A', 2, 15)
+self.version = None
+self.selection_object = None
+self.callbacks = None
+global _oi_agent
+_oi_agent = self
+
+def _fetch_sel_obj(self):
+""" Obtain a selection object (OS file descriptor)
+
+Returns:
+SaAisErrorT: Return code of the saImmOiSelectionObjectGet() API
+"""
+rc = saImmOiSelectionObjectGet(self.handle, self.selection_object)
+if rc != eSaAisErrorT.SA_AIS_OK:
+log_err("saImmOiSelectionObjectGet FAILED - %s" %
+eSaAisErrorT.whatis(rc))
+
+return rc
+
+def initialize(self, callbacks=None):
+""" Initialize the IMM OI agent
+
+Args:
+callbacks (SaImmOiCallbacksT_2): OI callbacks to register with IMM
+
+Returns:
+SaAisErrorT: Return code of OI initialize
+"""
+   

Re: [devel] [PATCH 1/1] pyosaf: High level python interfaces for IMM [#2602]

2017-10-27 Thread Quyen Dao

Hi Hieu,

Please see my comments marked with [Quyen]

Thanks,
Quyen

On 10/26/2017 3:21 PM, Hieu Nguyen wrote:

---
  python/pyosaf/utils/immoi/__init__.py|  275 +---
  python/pyosaf/utils/immoi/implementer.py | 1006 --
  python/pyosaf/utils/immom/__init__.py|  242 ---
  python/pyosaf/utils/immom/accessor.py|  112 
  python/pyosaf/utils/immom/agent.py   |  404 
  python/pyosaf/utils/immom/ccb.py |  455 --
  python/pyosaf/utils/immom/iterator.py|   95 +--
  python/pyosaf/utils/immom/object.py  |   34 +-
  8 files changed, 1697 insertions(+), 926 deletions(-)
  create mode 100644 python/pyosaf/utils/immom/accessor.py
  create mode 100644 python/pyosaf/utils/immom/agent.py

diff --git a/python/pyosaf/utils/immoi/__init__.py 
b/python/pyosaf/utils/immoi/__init__.py
index 55cb1ff..d1ff870 100644
--- a/python/pyosaf/utils/immoi/__init__.py
+++ b/python/pyosaf/utils/immoi/__init__.py
@@ -29,24 +29,24 @@ from __future__ import print_function
  from ctypes import c_char_p, c_void_p, cast, pointer
  
  from pyosaf.saAis import SaStringT, SaVersionT, SaNameT, SaSelectionObjectT, \

-unmarshalSaStringTArray, eSaDispatchFlagsT
+unmarshalSaStringTArray, eSaDispatchFlagsT, eSaAisErrorT
  from pyosaf import saImm, saImmOi
  from pyosaf.saImm import unmarshalSaImmValue, SaImmAttrNameT,  \
  SaImmAttrValuesT_2, SaImmClassNameT, SaImmSearchParametersT_2, \
  eSaImmValueTypeT, SaImmAttrDefinitionT_2, SaImmClassCategoryT, \
  SaImmAttrModificationT_2, eSaImmAttrModificationTypeT
  from pyosaf.saImmOi import SaImmOiHandleT, SaImmOiImplementerNameT
-from pyosaf.utils import immom
+from pyosaf.utils import immom, log_err, bad_handle_retry
  from pyosaf.utils.immom.object import ImmObject
  from pyosaf.utils.immom.ccb import marshal_c_array
  from pyosaf.utils.immom.iterator import SearchIterator
-from pyosaf.utils import decorate, initialize_decorate
+from pyosaf.utils import decorate, deprecate, initialize_decorate, SafException
  
  
-selection_object = SaSelectionObjectT()

-handle = SaImmOiHandleT()
  TRY_AGAIN_CNT = 60
  OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,safApp=safImmService"
+_oi_agent = None
+
  
  # Decorate pure saImmOi* API's with error-handling retry and exception raising

  saImmOiInitialize_2 = initialize_decorate(saImmOi.saImmOiInitialize_2)
@@ -71,68 +71,169 @@ saImmOiAugmentCcbInitialize = 
decorate(saImmOi.saImmOiAugmentCcbInitialize)
  saImmOiCcbSetErrorString = decorate(saImmOi.saImmOiCcbSetErrorString)
  
  
+class OiAgent(object):

+""" This class acts as a high-level OI agent, providing OI functions to
+the users as a higher level, and relieving the users of the need to manage
+the life cycle of the OI agent and providing general interface for
+Implementer or Applier used
+"""
+def __init__(self, callbacks=None, version=None):
+""" Constructor for OiAgent class
+
+Args:
+version (SaVersionT): OI API version
+"""
+self.handle = None
+self.version = version if version else SaVersionT('A', 2, 15)
+self.selection_object = None
+self.callbacks = callbacks
+global _oi_agent
+_oi_agent = self
+
+def _fetch_sel_obj(self):
+""" Obtain a selection object (OS file descriptor)
+
+Returns:
+SaAisErrorT: Return code of the saImmOiSelectionObjectGet() API
+"""
+rc = saImmOiSelectionObjectGet(self.handle, self.selection_object)
+if rc != eSaAisErrorT.SA_AIS_OK:
+log_err("saImmOiSelectionObjectGet FAILED - %s" %
+eSaAisErrorT.whatis(rc))
+
+return rc
+
+def initialize(self, callbacks):
+""" Initialize the IMM OI agent
+
+Args:
+callbacks (SaImmOiCallbacksT_2): OI callbacks to register with IMM
+
+Returns:
+SaAisErrorT: Return code of OI initialize
+"""
+self.handle = SaImmOiHandleT()
+self.selection_object = SaSelectionObjectT()
+if callbacks is not None:
+self.callbacks = callbacks
+rc = saImmOi.saImmOiInitialize_2(self.handle, self.callbacks,
+ self.version)
+if rc == eSaAisErrorT.SA_AIS_OK:
+rc = self._fetch_sel_obj()
+if rc == eSaAisErrorT.SA_AIS_ERR_BAD_HANDLE:
+rc = self.re_initialize(self.callbacks)
+
+return rc
+
+@bad_handle_retry
+def re_initialize(self, callbacks):
+""" Re-initialize the IMM OI agent
+
+Args:
+callbacks (SaImmOiCallbacksT_2): OI callbacks to register with IMM
+
+Returns:
+SaAisErrorT: Return code of OI initialize
+"""
+self.finalize()
+rc = self.initialize(callbacks=callbacks)
+if rc != eSaAisErrorT.SA_AIS_OK:
+log_err("saImmOiInitialize_2 FAILED - %s" %
+   

Re: [devel] [PATCH 1/1] pyosaf: High level python interfaces for LOG [#2602]

2017-10-27 Thread Quyen Dao

Hi Hoa,

Ack from me. Tested with some basic scenarios.

Thanks,
Quyen

On 10/27/2017 6:14 PM, Hoa Le wrote:

Improved implementation of LOG pyosaf utils

The following comments shall be removed when the patch is pushed.

- This is the 3rd patch in the series of patches to improve the
   implementation of the pyosaf utils of OpenSAF services.
- This patch is based on and uses the code change of the
   pyosaf/utils/__init__.py file in the following patch for CLM:

   [devel] [PATCH 1/1] pyosaf: High level python interfaces for CLM [#2602]
   https://sourceforge.net/p/opensaf/mailman/message/36088562/
---
  python/pyosaf/utils/log/logger.py | 468 +-
  1 file changed, 410 insertions(+), 58 deletions(-)

diff --git a/python/pyosaf/utils/log/logger.py 
b/python/pyosaf/utils/log/logger.py
index fc7739c..164409b 100644
--- a/python/pyosaf/utils/log/logger.py
+++ b/python/pyosaf/utils/log/logger.py
@@ -15,95 +15,447 @@
  # Author(s): Ericsson
  #
  
+# pylint: disable=unused-argument
  """ SAF Logger utility """
  import ctypes
+from copy import deepcopy
+from select import select
  
-from pyosaf import saLog, saAis

-from pyosaf.utils import log
+from pyosaf.saAis import eSaAisErrorT, SaVersionT, SaSelectionObjectT, \
+eSaDispatchFlagsT, SaNameT, saAis, SaStringT
+from pyosaf.saNtf import saNtf, eSaNtfEventTypeT, SaNtfClassIdT
+from pyosaf.saLog import saLog, eSaLogFileFullActionT, \
+SaLogFileCreateAttributesT_2, eSaLogHeaderTypeT, SaLogNtfLogHeaderT, \
+SaLogGenericLogHeaderT, SaLogRecordT, SaLogCallbacksT, \
+SaLogWriteLogCallbackT, SaLogHandleT, SaLogStreamHandleT, SaLogHeaderT, \
+SaLogBufferT
+from pyosaf.utils import log, bad_handle_retry, log_err
+
+SYSTEM_STREAM = saLog.SA_LOG_STREAM_SYSTEM
+NOTIF_STREAM = saLog.SA_LOG_STREAM_NOTIFICATION
+ALARM_STREAM = saLog.SA_LOG_STREAM_ALARM
+
+
+class LoggerInfo(object):
+""" This class encapsulates data structures used when opening a specific
+log stream, or writing a log record to a log stream """
+def __init__(self, service_user_name=""):
+self.stream_name = SYSTEM_STREAM
+# log file create attributes
+self.log_file_name = "saLogApplication"
+self.log_file_path_name = "."
+self.max_log_file_size = 500
+self.max_log_record_size = 150
+self.ha_property = True
+self.log_file_full_action = \
+eSaLogFileFullActionT.SA_LOG_FILE_FULL_ACTION_ROTATE
+self.max_files_rotated = 4
+self.log_file_format = "@Cr @Ch:@Cn:@Cs @Sv @Sl \"@Cb\""
+# notification header info
+self.event_type = eSaNtfEventTypeT.SA_NTF_ALARM_QOS
+self.notification_object = ""
+self.notifying_object = ""
+self.ntf_class_id = SaNtfClassIdT(0, 0, 0)
+self.event_time = saAis.SA_TIME_UNKNOWN
+# generic info
+self.log_severity = saLog.SA_LOG_SEV_INFO
+self.log_service_user_name = service_user_name
  
  
  class SafLogger(object):

-""" SafLogger class handling log record write to the system log stream """
-@staticmethod
-def write_log_callback(invocation, error):
-""" This callback is triggered when the operation requested by the
-invocation of saLogWriteLogAsync() completes
+""" This class provides logging function of the LOG service """
+def __init__(self, service_user_name="", version=None):
+""" Constructor for SafLogger class
+
+Args:
+service_user_name (str): Logger's service user name
+"""
+self.init_version = version if version else SaVersionT('A', 2, 3)
+self.version = None
+self.invocation = 0
+self.log_handle = None
+self.stream_handle = None
+self.sel_obj = SaSelectionObjectT()
+self.record = SaLogRecordT()
+self.log_write_error = eSaAisErrorT.SA_AIS_OK
+self.callbacks = SaLogCallbacksT()
+self.callbacks.saLogWriteLogCallback = \
+SaLogWriteLogCallbackT(self._log_write_callback)
+self.logger_info = LoggerInfo(service_user_name)
+
+def __enter__(self):
+""" Enter method for SafLogger class """
+return self
+
+def __exit__(self, exception_type, exception_value, traceback):
+""" Exit method for SafLogger class """
+self._finalize()
+
+def __del__(self):
+""" Destructor for SafLogger class """
+self._finalize()
+
+def _log_write_callback(self, invocation, error):
+""" This callback is invoked by the LOG service to acknowledge a
+previous invocation of the saLogWriteLogAsync() function with the
+SA_LOG_RECORD_WRITE_ACK flag, and also provides the result of the
+respective log write operation.
  
  Args:

  invocation (SaInvocationT): Invocation associated with an
  invocation of 

Re: [devel] [PATCH 1/1] pyosaf: High level python interfaces for CLM [#2602]

2017-10-27 Thread Quyen Dao

Hi Long

Ack from me. Tested with some basic scenarios.

Thanks,
Quyen

On 10/27/2017 5:26 PM, Long H Buu Nguyen wrote:

- Add more error handling
- Refactor clm code
- Keep raising exceptions for existing python methods
- Add __version__ attribute to utils
---
  python/pyosaf/utils/__init__.py | 263 +---
  python/pyosaf/utils/clm/__init__.py | 599 ++--
  2 files changed, 734 insertions(+), 128 deletions(-)

diff --git a/python/pyosaf/utils/__init__.py b/python/pyosaf/utils/__init__.py
index 7a1c21b79..a667e5172 100644
--- a/python/pyosaf/utils/__init__.py
+++ b/python/pyosaf/utils/__init__.py
@@ -16,17 +16,31 @@
  #
  
  """ pyosaf common utils """
+import os
+import syslog
  import time
+import warnings
  from copy import deepcopy
+from ctypes import POINTER
  
-from pyosaf.saAis import eSaAisErrorT

+from pyosaf import saImmOm
+from pyosaf.saAis import eSaAisErrorT, SaStringT, unmarshalNullArray
  
+# Version for pyosaf utils

+__version__ = "1.0.0"
  
-TRY_AGAIN_COUNT = 60

+# The 'MAX_RETRY_TIME' and 'RETRY_INTERVAL' environment variables shall be set
+# with user-defined values BEFORE importing the pyosaf 'utils' module;
+# Otherwise, the default values for MAX_RETRY_TIME(60s) and RETRY_INTERVAL(1s)
+# will be used throughout.
+MAX_RETRY_TIME = int(os.environ.get("MAX_RETRY_TIME")) \
+if "MAX_RETRY_TIME" in os.environ else 60
+RETRY_INTERVAL = int(os.environ.get("RETRY_INTERVAL")) \
+if "RETRY_INTERVAL" in os.environ else 1
  
  
  class SafException(Exception):

-""" SAF Exception that can be printed """
+""" SAF Exception for error during executing SAF functions """
  def __init__(self, value, msg=None):
  Exception.__init__(self)
  self.value = value
@@ -44,73 +58,244 @@ def raise_saf_exception(func, error):
  raise SafException(error, error_string)
  
  
+def check_resource_abort(ccb_handle):

+""" Get error strings from IMM and check if it is a resource abort case
+
+Args:
+ccb_handle (SaImmCcbHandleT): CCB handle
+
+Returns:
+bool: 'True' if it is a resource abort case. 'False', otherwise.
+"""
+c_error_strings = POINTER(SaStringT)()
+saImmOmCcbGetErrorStrings = decorate(saImmOm.saImmOmCcbGetErrorStrings)
+
+# Get error strings
+# As soon as the ccb_handle is finalized, the strings are freed
+rc = saImmOmCcbGetErrorStrings(ccb_handle, c_error_strings)
+if rc == eSaAisErrorT.SA_AIS_OK:
+if c_error_strings:
+list_err_strings = unmarshalNullArray(c_error_strings)
+for c_error_string in list_err_strings:
+if c_error_string.startswith("IMM: Resource abort: "):
+return True
+
+return False
+
+
  def decorate(func):
  """ Decorate the given SAF function so that it retries a fixed number of
-times if needed and raises an exception if it encounters any fault other
-than SA_AIS_ERR_TRY_AGAIN.
+times for certain returned error codes during execution
+
+Args:
+func (function): The decorated SAF function
+
+Returns:
+SaAisErrorT: Return code of the decorated SAF function
  """
  
  def inner(*args):

-""" Call "function" in the lexical scope in a retry loop and raise an
-exception if it encounters any fault other than TRY_AGAIN
+""" Call the decorated function in the lexical scope in a retry loop
+
+Args:
+args (tuple): Arguments of the decorated SAF function
  """
-one_sec_sleeps = 0
-error = func(*args)
+count_sec_sleeps = 0
+
+rc = func(*args)
  
-while error == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN:

-if one_sec_sleeps == TRY_AGAIN_COUNT:
+while rc != eSaAisErrorT.SA_AIS_OK:
+
+if count_sec_sleeps >= MAX_RETRY_TIME:
  break
-time.sleep(1)
-one_sec_sleeps += 1
  
-error = func(*args)

+if rc == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN:
+sleep_time_interval = RETRY_INTERVAL
+elif rc == eSaAisErrorT.SA_AIS_ERR_NO_RESOURCES:
+sleep_time_interval = RETRY_INTERVAL
+elif rc == eSaAisErrorT.SA_AIS_ERR_BUSY:
+sleep_time_interval = 3 * RETRY_INTERVAL
+elif rc == eSaAisErrorT.SA_AIS_ERR_FAILED_OPERATION:
+# Retry on getting FAILED_OPERATION only applies to IMM
+# CCB-related operations in case of a resource abort;
+ccb_handle = args[0]
+resource_abort = check_resource_abort(ccb_handle)
+if not resource_abort:
+break
+sleep_time_interval = RETRY_INTERVAL
+else:
+break  # Break out of the retry loop
  
-if error != eSaAisErrorT.SA_AIS_OK:

-

Re: [devel] [PATCH 1/1] pyosaf: High level python interfaces for LOG [#2602]

2017-10-27 Thread Quyen Dao

Hi Hoa,

Please find my comments marked with [Quyen]

Thanks,
Quyen

On 10/26/2017 3:33 PM, Hoa Le wrote:

Improved implementation of LOG pyosaf utils

The following comments shall be removed when the patch is pushed.

- This is the 3rd patch in the series of patches to improve the
   implementation of the pyosaf utils of OpenSAF services.
- This patch is based on and uses the code change of the
   pyosaf/utils/__init__.py file in the following patch for CLM:

   [devel] [PATCH 1/1] pyosaf: High level python interfaces for CLM [#2602]
   https://sourceforge.net/p/opensaf/mailman/message/36088562/
---
  python/pyosaf/utils/log/logger.py | 437 +-
  1 file changed, 378 insertions(+), 59 deletions(-)

diff --git a/python/pyosaf/utils/log/logger.py 
b/python/pyosaf/utils/log/logger.py
index fc7739c..27115ea 100644
--- a/python/pyosaf/utils/log/logger.py
+++ b/python/pyosaf/utils/log/logger.py
@@ -15,95 +15,414 @@
  # Author(s): Ericsson
  #
  
+# pylint: disable=unused-argument
  """ SAF Logger utility """
  import ctypes
+from copy import deepcopy
+from select import select
  
-from pyosaf import saLog, saAis

-from pyosaf.utils import log
+from pyosaf.saAis import eSaAisErrorT, SaVersionT, SaSelectionObjectT, \
+eSaDispatchFlagsT, SaNameT, saAis, SaStringT
+from pyosaf.saNtf import saNtf, eSaNtfEventTypeT, SaNtfClassIdT
+from pyosaf.saLog import saLog, eSaLogFileFullActionT, \
+SaLogFileCreateAttributesT_2, eSaLogHeaderTypeT, SaLogNtfLogHeaderT, \
+SaLogGenericLogHeaderT, SaLogRecordT, SaLogCallbacksT, \
+SaLogWriteLogCallbackT, SaLogHandleT, SaLogStreamHandleT, SaLogHeaderT, \
+SaLogBufferT
+from pyosaf.utils import log, bad_handle_retry, log_err
+
+SYSTEM_STREAM = saLog.SA_LOG_STREAM_SYSTEM
+NOTIF_STREAM = saLog.SA_LOG_STREAM_NOTIFICATION
+ALARM_STREAM = saLog.SA_LOG_STREAM_ALARM
+
+
+class LoggerInfo(object):
+""" This class encapsulates data structures used when opening a specific
+log stream, or writing a log record to a log stream """
+def __init__(self, exec_name=""):
+self.stream_name = SYSTEM_STREAM
+# log file create attributes
+self.log_file_name = "saLogApplication"
+self.log_file_path_name = "."
+self.max_log_file_size = 500
+self.max_log_record_size = 150
+self.ha_property = True
+self.log_file_full_action = \
+eSaLogFileFullActionT.SA_LOG_FILE_FULL_ACTION_ROTATE
+self.max_files_rotated = 4
+self.log_file_format = "@Cr @Ch:@Cn:@Cs @Sv @Sl \"@Cb\""
+# notification header info
+self.event_type = eSaNtfEventTypeT.SA_NTF_ALARM_QOS
+self.notification_object = ""
+self.notifying_object = ""
+self.ntf_class_id = SaNtfClassIdT(0, 0, 0)
+self.event_time = saAis.SA_TIME_UNKNOWN
+# generic info
+self.log_severity = saLog.SA_LOG_SEV_INFO
+self.log_service_user_name = exec_name
  
  
  class SafLogger(object):

-""" SafLogger class handling log record write to the system log stream """
-@staticmethod
-def write_log_callback(invocation, error):
-""" This callback is triggered when the operation requested by the
-invocation of saLogWriteLogAsync() completes
+""" This class provides logging function of the LOG service """
+def __init__(self, exec_name="", version=None):
[Quyen] Please consider change a better name for "exec_name" as this 
argument is to initialize the service_user_name

+""" Constructor for SafLogger class
+
+Args:
+exec_name (str): Logger's service user name
+"""
+self.exec_name = exec_name
+self.init_version = version if version else SaVersionT('A', 2, 3)
+self.version = None
+self.invocation = 0
+self.log_handle = None
+self.stream_handle = None
+self.sel_obj = SaSelectionObjectT()
+self.record = SaLogRecordT()
+self.log_write_error = eSaAisErrorT.SA_AIS_OK
+self.callbacks = SaLogCallbacksT()
+self.callbacks.saLogWriteLogCallback = \
+SaLogWriteLogCallbackT(self._log_write_callback)
+self.logger_info = LoggerInfo(exec_name)
+
+def __enter__(self):
+""" Enter method for SafLogger class """
+return self
+
+def __exit__(self, exception_type, exception_value, traceback):
+""" Exit method for SafLogger class """
+self._finalize()
+
+def __del__(self):
+""" Destructor for SafLogger class """
+self._finalize()
+
+def _log_write_callback(self, invocation, error):
+""" This callback is invoked by the LOG service to acknowledge a
+previous invocation of the saLogWriteLogAsync() function with the
+SA_LOG_RECORD_WRITE_ACK flag, and also provides the result of the
+respective log write operation.
  
  Args:

  

Re: [devel] [PATCH 1/1] pyosaf: retry SAF initialize() function with original version [#2524]

2017-10-17 Thread Quyen Dao

Hi Hieu,

Ack from me.

Thanks,
Quyen

On 10/17/2017 12:47 PM, Hieu Nguyen wrote:

---
  python/pyosaf/utils/__init__.py   | 44 +++
  python/pyosaf/utils/clm/__init__.py   | 11 +
  python/pyosaf/utils/immoi/__init__.py |  7 +++---
  python/pyosaf/utils/immom/__init__.py |  7 +++---
  python/pyosaf/utils/log/__init__.py   |  4 ++--
  python/pyosaf/utils/ntf/__init__.py   | 16 ++---
  6 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/python/pyosaf/utils/__init__.py b/python/pyosaf/utils/__init__.py
index 0d4b648..3776cef 100644
--- a/python/pyosaf/utils/__init__.py
+++ b/python/pyosaf/utils/__init__.py
@@ -16,6 +16,7 @@
  
  
  import time

+from copy import deepcopy
  
  from pyosaf.saAis import eSaAisErrorT
  
@@ -70,3 +71,46 @@ def decorate(function):

  return error
  
  return inner

+
+
+def initialize_decorate(function):
+''' Decorate the given SAF initialize(handle, callbacks, version) so that
+it retries a fixed number of times if needed with the same arguments 
and
+raises an exception if it encounters any fault other than
+SA_AIS_ERR_TRY_AGAIN.
+'''
+
+def inner(*args):
+''' Calls "function" in the lexical scope in a retry loop and raises
+an exception if it encounters any other faults.
+
+Args:
+args(tuple): Argument of initialize() with format:
+ tuple(handle, callbacks, version)
+'''
+# Backup current version
+backup_version = deepcopy(args[2])
+
+one_sec_sleeps = 0
+error = function(*args)
+
+while error == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN:
+if one_sec_sleeps == TRY_AGAIN_COUNT:
+break
+
+time.sleep(1)
+one_sec_sleeps += 1
+
+# If SAF initialize() returns ERR_TRY_AGAIN, the version will be
+# updated to the latest version, so set original version on
+# next initialization.
+version = deepcopy(backup_version)
+args = args[:2] + (version,)
+error = function(*args)
+
+if error != eSaAisErrorT.SA_AIS_OK:
+raise_saf_exception(function, error)
+
+return error
+
+return inner
diff --git a/python/pyosaf/utils/clm/__init__.py 
b/python/pyosaf/utils/clm/__init__.py
index 9b9e11f..b9b853a 100644
--- a/python/pyosaf/utils/clm/__init__.py
+++ b/python/pyosaf/utils/clm/__init__.py
@@ -20,12 +20,13 @@
  
  from pyosaf import saClm, saAis
  
-from pyosaf.utils import decorate

+from pyosaf.utils import decorate, initialize_decorate
+
  
  # Decorate the raw saClm* functions with retry and raising exceptions

-saClmInitialize= decorate(saClm.saClmInitialize)
-saClmInitialize_3  = decorate(saClm.saClmInitialize_3)
-saClmInitialize_4  = decorate(saClm.saClmInitialize_4)
+saClmInitialize = initialize_decorate(saClm.saClmInitialize)
+saClmInitialize_3 = initialize_decorate(saClm.saClmInitialize_3)
+saClmInitialize_4 = initialize_decorate(saClm.saClmInitialize_4)
  saClmSelectionObjectGet= decorate(saClm.saClmSelectionObjectGet)
  saClmDispatch  = decorate(saClm.saClmDispatch)
  saClmFinalize  = decorate(saClm.saClmFinalize)
@@ -131,7 +132,7 @@ def track(flags=saAis.saAis.SA_TRACK_CHANGES_ONLY):
  def get_members():
  notification_buffer = saClm.SaClmClusterNotificationBufferT_4()
  
-saClmClusterTrack_4(HANDLE, saAis.saAis.SA_TRACK_CURRENT,

+saClmClusterTrack_4(HANDLE, saAis.saAis.SA_TRACK_CURRENT,
  notification_buffer)
  
  cluster_nodes = []

diff --git a/python/pyosaf/utils/immoi/__init__.py 
b/python/pyosaf/utils/immoi/__init__.py
index 02ad89b..2ea0f33 100644
--- a/python/pyosaf/utils/immoi/__init__.py
+++ b/python/pyosaf/utils/immoi/__init__.py
@@ -38,7 +38,7 @@ from pyosaf.utils.immom.object import ImmObject
  from pyosaf.utils.immom.ccb import marshal_c_array
  from pyosaf.utils.immom.iterator import SearchIterator
  
-from pyosaf.utils import decorate

+from pyosaf.utils import decorate, initialize_decorate
  
  from ctypes import c_char_p, c_void_p, cast, pointer
  
@@ -49,8 +49,9 @@ TRYAGAIN_CNT = 60
  
  OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,safApp=safImmService"
  
+

  # Decorate the raw saImmOi* functions with retry and raising exceptions
-saImmOiInitialize_2   = decorate(saImmOi.saImmOiInitialize_2)
+saImmOiInitialize_2 = initialize_decorate(saImmOi.saImmOiInitialize_2)
  saImmOiSelectionObjectGet = decorate(saImmOi.saImmOiSelectionObjectGet)
  saImmOiDispatch   = decorate(saImmOi.saImmOiDispatch)
  saImmOiFinalize   = decorate(saImmOi.saImmOiFinalize)
@@ -71,9 +72,7 @@ saImmOiCcbSetErrorString  = 
decorate(saImmOi.saImmOiCcbSetErrorString)
  
  def initialize(callbacks=None):

  ''' Initializes 

Re: [devel] [PATCH 1/1] pyosaf: decorate function does not handle version struct in initialize functions [#2524]

2017-10-16 Thread Quyen Dao

Hi Hieu,

Please see my comment marked with [Quyen].

Thanks,
Quyen

On 10/5/2017 5:26 PM, Hieu Nguyen wrote:

---
  python/pyosaf/utils/__init__.py   | 38 +++
  python/pyosaf/utils/clm/__init__.py   | 18 -
  python/pyosaf/utils/immoi/__init__.py | 12 +--
  python/pyosaf/utils/immom/__init__.py | 11 +-
  python/pyosaf/utils/log/__init__.py   |  4 ++--
  python/pyosaf/utils/ntf/__init__.py   | 17 
  6 files changed, 69 insertions(+), 31 deletions(-)

diff --git a/python/pyosaf/utils/__init__.py b/python/pyosaf/utils/__init__.py
index 0d4b648..17a1408 100644
--- a/python/pyosaf/utils/__init__.py
+++ b/python/pyosaf/utils/__init__.py
@@ -16,6 +16,7 @@
  
  
  import time

+from copy import deepcopy
  
  from pyosaf.saAis import eSaAisErrorT
  
@@ -70,3 +71,40 @@ def decorate(function):

  return error
  
  return inner

+
+
+def initialize_decorate(function, current_version):
[Quyen] I think argument current_version should be removed, it should 
use the version that user passes to `function`

+''' Decorate the given SAF initialize() with current version so that it
+retries a fixed number of times if needed and raises an exception
+if it encounters any fault other than SA_AIS_ERR_TRY_AGAIN.
+'''
+# Backup current version
+backup_version = deepcopy(current_version)

[Quyen] Backing up the version should be done inside the inner function.

+
+def inner(*args):
+''' Calls "function" in the lexical scope in a retry loop and raises
+an exception if it encounters any other faults.
+'''
+one_sec_sleeps = 0
[Quyen] the backup_version should be done at here, please also have a 
note in the function docstring to emphasize that the give SAF initialize 
must have 3 arguments and the last argument is the version.

backup_version = deepcopy(args[2])

+error = function(*args)
+
+while error == eSaAisErrorT.SA_AIS_ERR_TRY_AGAIN:
+if one_sec_sleeps == TRY_AGAIN_COUNT:
+break
+
+time.sleep(1)
+one_sec_sleeps += 1
+
+# If SAF initialize() returns ERR_TRY_AGAIN, the version will be
+# updated to the latest version
+# Set current version in this case
[Quyen] Should we rephrase it like this: "So we need to revert the 
version back to the original version before trying again" or something 
similar.

+current_version = deepcopy(backup_version)
+args = args[:2] + (current_version,)
+error = function(*args)
+
+if error != eSaAisErrorT.SA_AIS_OK:
+raise_saf_exception(function, error)
+
+return error
+
+return inner
diff --git a/python/pyosaf/utils/clm/__init__.py 
b/python/pyosaf/utils/clm/__init__.py
index 9b9e11f..926e2f4 100644
--- a/python/pyosaf/utils/clm/__init__.py
+++ b/python/pyosaf/utils/clm/__init__.py
@@ -20,12 +20,15 @@
  
  from pyosaf import saClm, saAis
  
-from pyosaf.utils import decorate

+from pyosaf.utils import decorate, initialize_decorate
+
+# Define CLM version
+CLM_VER = saAis.SaVersionT('B', 4, 1)

[Quyen] No need to have a constant here as it's only used in one place
  
  # Decorate the raw saClm* functions with retry and raising exceptions

-saClmInitialize= decorate(saClm.saClmInitialize)
-saClmInitialize_3  = decorate(saClm.saClmInitialize_3)
-saClmInitialize_4  = decorate(saClm.saClmInitialize_4)
+saClmInitialize = initialize_decorate(saClm.saClmInitialize, CLM_VER)
+saClmInitialize_3 = initialize_decorate(saClm.saClmInitialize_3, CLM_VER)
+saClmInitialize_4 = initialize_decorate(saClm.saClmInitialize_4, CLM_VER)



  saClmSelectionObjectGet= decorate(saClm.saClmSelectionObjectGet)
  saClmDispatch  = decorate(saClm.saClmDispatch)
  saClmFinalize  = decorate(saClm.saClmFinalize)
@@ -119,11 +122,8 @@ def initialize(track_fn=None):
  callbacks.saClmClusterNodeGetCallback = 
saClm.SaClmClusterNodeGetCallbackT_4(node_get_callback)
  callbacks.saClmClusterTrackCallback = 
saClm.SaClmClusterTrackCallbackT_4(track_callback)
  
-# Define which version to use of the CLM API

-version = saAis.SaVersionT('B', 4, 1)
-
  # Initialize the CLM API
-saClmInitialize_4(HANDLE, callbacks, version)
+saClmInitialize_4(HANDLE, callbacks, CLM_VER)
[Quyen] Should keep the original code, no need to replace with constant 
CLM_VER
  
  def track(flags=saAis.saAis.SA_TRACK_CHANGES_ONLY):

  saClmClusterTrack_4(HANDLE, flags, None)
@@ -131,7 +131,7 @@ def track(flags=saAis.saAis.SA_TRACK_CHANGES_ONLY):
  def get_members():
  notification_buffer = saClm.SaClmClusterNotificationBufferT_4()
  
-saClmClusterTrack_4(HANDLE, saAis.saAis.SA_TRACK_CURRENT,

+saClmClusterTrack_4(HANDLE, 

Re: [devel] [PATCH 1/1] pyosaf: Raise ValueError instead NoneType Exception [#1410]

2017-10-16 Thread Quyen Dao

Hi Hieu,

Ack from me.

Thanks,
Quyen

On 10/17/2017 10:01 AM, Hieu Nguyen wrote:

---
  python/pyosaf/utils/immom/object.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/pyosaf/utils/immom/object.py 
b/python/pyosaf/utils/immom/object.py
index c2924d3..7d8ece8 100644
--- a/python/pyosaf/utils/immom/object.py
+++ b/python/pyosaf/utils/immom/object.py
@@ -59,7 +59,7 @@ class ImmObject(object):
  self.class_desc[class_name] = \
  pyosaf.utils.immom.class_description_get(class_name)
  else:
-raise
+raise ValueError("Class and attributes are None")
  
  self.__dict__["rdn_attribute"] = \

  pyosaf.utils.immom.get_rdn_attribute_for_class(class_name)


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] pyosaf: Invalid exception used in ImmObject (object.py) [#1410]

2017-10-16 Thread Quyen Dao

Hi Hieu,

Please see my minor comment marked with [Quyen]

Thanks,
Quyen

On 10/3/2017 10:50 AM, Hieu Nguyen wrote:

---
  python/pyosaf/utils/immom/object.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/pyosaf/utils/immom/object.py 
b/python/pyosaf/utils/immom/object.py
index c2924d3..30cd63c 100644
--- a/python/pyosaf/utils/immom/object.py
+++ b/python/pyosaf/utils/immom/object.py
@@ -59,7 +59,7 @@ class ImmObject(object):
  self.class_desc[class_name] = \
  pyosaf.utils.immom.class_description_get(class_name)
  else:
-raise
+raise Exception("ERROR: class and attributes are None")
[Quyen] I think it's better to raise ValueError instead Exception as 
Exception is quite general.

Please also remove the prefix "ERROR: " in the exception description.
BTW: The patch title should describe the summary of the change not the 
title of the ticket
  
  self.__dict__["rdn_attribute"] = \

  pyosaf.utils.immom.get_rdn_attribute_for_class(class_name)


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] amf: Improve SC status change callback style [#2594]

2017-10-05 Thread Quyen Dao

Hi,

If there is no more comment, this patch will be pushed by next Monday 
(2017-10-09)


Thanks,
Quyen

On 9/26/2017 12:54 PM, Gary Lee wrote:

Ack

Thanks
Gary

On 26/9/17, 2:56 pm, "Quyen Dao" <quyen@dektech.com.au> wrote:

 Make SC status change callback style to be consistent with other AMF 
callbacks
 * Define an alias named OsafAmfSCStatusChangeCallbackT for the SC status 
change callback type
 * Use osafAmfSCStatusChangeCallback as callback name
 * Change "OsafAmfSCStatusT state" to "OsafAmfSCStatusT status"
 ---
  src/ais/include/saAmf_B_04_02.h |  6 +-
  src/amf/README_SC_ABSENCE   |  4 ++--
  src/amf/agent/ava_mds.cc| 21 +++--
  src/amf/agent/ava_mds.h |  2 +-
  4 files changed, 19 insertions(+), 14 deletions(-)
 
 diff --git a/src/ais/include/saAmf_B_04_02.h b/src/ais/include/saAmf_B_04_02.h

 index e52564a..f8b31d6 100644
 --- a/src/ais/include/saAmf_B_04_02.h
 +++ b/src/ais/include/saAmf_B_04_02.h
 @@ -65,9 +65,13 @@ typedef enum {
  OSAF_AMF_SC_ABSENT = 2,
  } OsafAmfSCStatusT;
  
 +typedef void

 +(*OsafAmfSCStatusChangeCallbackT)(
 +OsafAmfSCStatusT status);
 +
  extern SaAisErrorT osafAmfInstallSCStatusChangeCallback(
  SaAmfHandleT amfHandle,
 -void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
 +OsafAmfSCStatusChangeCallbackT callback);
  
  #ifdef  __cplusplus

  }
 diff --git a/src/amf/README_SC_ABSENCE b/src/amf/README_SC_ABSENCE
 index 42042de..6f38237 100644
 --- a/src/amf/README_SC_ABSENCE
 +++ b/src/amf/README_SC_ABSENCE
 @@ -168,7 +168,7 @@ Information about the resources:
  
-Callback and its argument:
  
 -  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)

 +  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status)
where OsafAmfSCStatusT is defined as:
  typedef enum {
OSAF_AMF_SC_PRESENT = 1,
 @@ -188,7 +188,7 @@ Information about the resources:
  
  * An API to register/install above callback function:

 void osafAmfInstallSCStatusChangeCallback(SaAmfHandleT amfHandle,
 - void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
 + 
OsafAmfSCStatusChangeCallbackT callback);
 If 0 is passed as amfHandle, then callback will be invoked in the
 context of MDS thread. If a valid amfHandle is passed then callback
 will be invoked in the context of thread which is calling 
saAmfDispatch()
 diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
 index 4957b4f..4408853 100644
 --- a/src/amf/agent/ava_mds.cc
 +++ b/src/amf/agent/ava_mds.cc
 @@ -73,32 +73,32 @@ static void (*amf_down_cb)(void);
   * @brief  SC status change callback. It is called when cluster becomes
   * without SCs and with SCs. It can be used by a client to know
   * when cluster runs without SCs and with SCs.
 - * @param  state.
   */
 -static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state);
 +static OsafAmfSCStatusChangeCallbackT osafAmfSCStatusChangeCallback;
  
  //Wrapper function that AMFA uses to invoke SC status change callback.

 -void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
 +void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT status) {
TRACE_ENTER();
 -  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
 +  if (osafAmfSCStatusChangeCallback == nullptr) {
   TRACE("Callback not registered");
} else {
   TRACE("Invoking SC status change callback");
  /* A client has installed a callback pointer, call it */
 -OsafAmfSCStatusChangeCallbackT(state);
 +osafAmfSCStatusChangeCallback(status);
}
TRACE_LEAVE();
  }
 +
  bool is_osafAmfSCStatusChangeCallback_registered() {
 -  if (OsafAmfSCStatusChangeCallbackT == nullptr)
 +  if (osafAmfSCStatusChangeCallback == nullptr)
  return false;
else
  return true;
  }
  
  void uninstall_osafAmfSCStatusChangeCallback() {

 -  TRACE("uninstalling OsafAmfSCStatusChangeCallbackT.");
 -  OsafAmfSCStatusChangeCallbackT = nullptr;
 +  TRACE("uninstalling osafAmfSCStatusChangeCallback.");
 +  osafAmfSCStatusChangeCallback = nullptr;
  }
  
/
Name  : ava_mds_reg
 @@ -1206,7 +1206,7 @@ extern "C" void ava_install_amf_down_cb(void 
(*cb)(void)) {
   * @brief   API for client to install SC status change callback.
   */
  SaAisErrorT osafAmfInstallSCStatusChangeCallback(SaAmfHand

[devel] [PATCH 1/1] amf: Improve SC status change callback style [#2594]

2017-09-25 Thread Quyen Dao
Make SC status change callback style to be consistent with other AMF callbacks
* Define an alias named OsafAmfSCStatusChangeCallbackT for the SC status change 
callback type
* Use osafAmfSCStatusChangeCallback as callback name
* Change "OsafAmfSCStatusT state" to "OsafAmfSCStatusT status"
---
 src/ais/include/saAmf_B_04_02.h |  6 +-
 src/amf/README_SC_ABSENCE   |  4 ++--
 src/amf/agent/ava_mds.cc| 21 +++--
 src/amf/agent/ava_mds.h |  2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/ais/include/saAmf_B_04_02.h b/src/ais/include/saAmf_B_04_02.h
index e52564a..f8b31d6 100644
--- a/src/ais/include/saAmf_B_04_02.h
+++ b/src/ais/include/saAmf_B_04_02.h
@@ -65,9 +65,13 @@ typedef enum {
 OSAF_AMF_SC_ABSENT = 2,
 } OsafAmfSCStatusT;
 
+typedef void
+(*OsafAmfSCStatusChangeCallbackT)(
+OsafAmfSCStatusT status);
+
 extern SaAisErrorT osafAmfInstallSCStatusChangeCallback(
 SaAmfHandleT amfHandle,
-void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
+OsafAmfSCStatusChangeCallbackT callback);
 
 #ifdef  __cplusplus
 }
diff --git a/src/amf/README_SC_ABSENCE b/src/amf/README_SC_ABSENCE
index 42042de..6f38237 100644
--- a/src/amf/README_SC_ABSENCE
+++ b/src/amf/README_SC_ABSENCE
@@ -168,7 +168,7 @@ Information about the resources:
 
   -Callback and its argument:
 
-  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)
+  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status)
   where OsafAmfSCStatusT is defined as:
 typedef enum {
   OSAF_AMF_SC_PRESENT = 1,
@@ -188,7 +188,7 @@ Information about the resources:
 
 * An API to register/install above callback function:
void osafAmfInstallSCStatusChangeCallback(SaAmfHandleT amfHandle,
- void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
+ OsafAmfSCStatusChangeCallbackT 
callback);
If 0 is passed as amfHandle, then callback will be invoked in the
context of MDS thread. If a valid amfHandle is passed then callback
will be invoked in the context of thread which is calling saAmfDispatch()
diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
index 4957b4f..4408853 100644
--- a/src/amf/agent/ava_mds.cc
+++ b/src/amf/agent/ava_mds.cc
@@ -73,32 +73,32 @@ static void (*amf_down_cb)(void);
  * @brief  SC status change callback. It is called when cluster becomes
  * without SCs and with SCs. It can be used by a client to know
  * when cluster runs without SCs and with SCs.
- * @param  state.
  */
-static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state);
+static OsafAmfSCStatusChangeCallbackT osafAmfSCStatusChangeCallback;
 
 //Wrapper function that AMFA uses to invoke SC status change callback.
-void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
+void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT status) {
   TRACE_ENTER();
-  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
+  if (osafAmfSCStatusChangeCallback == nullptr) {
  TRACE("Callback not registered");
   } else {
  TRACE("Invoking SC status change callback");
 /* A client has installed a callback pointer, call it */
-OsafAmfSCStatusChangeCallbackT(state);
+osafAmfSCStatusChangeCallback(status);
   }
   TRACE_LEAVE();
 }
+
 bool is_osafAmfSCStatusChangeCallback_registered() {
-  if (OsafAmfSCStatusChangeCallbackT == nullptr)
+  if (osafAmfSCStatusChangeCallback == nullptr)
 return false;
   else
 return true;
 }
 
 void uninstall_osafAmfSCStatusChangeCallback() {
-  TRACE("uninstalling OsafAmfSCStatusChangeCallbackT.");
-  OsafAmfSCStatusChangeCallbackT = nullptr;
+  TRACE("uninstalling osafAmfSCStatusChangeCallback.");
+  osafAmfSCStatusChangeCallback = nullptr;
 }
 /
   Name  : ava_mds_reg
@@ -1206,7 +1206,7 @@ extern "C" void ava_install_amf_down_cb(void (*cb)(void)) 
{
  * @brief   API for client to install SC status change callback.
  */
 SaAisErrorT osafAmfInstallSCStatusChangeCallback(SaAmfHandleT hdl,
- void (*cb)(OsafAmfSCStatusT status)) {
+ 
OsafAmfSCStatusChangeCallbackT cb) {
   TRACE_ENTER2("handle:%llx", hdl);
 
   AVA_CB *ava_cb = 0;
@@ -1237,7 +1237,8 @@ SaAisErrorT 
osafAmfInstallSCStatusChangeCallback(SaAmfHandleT hdl,
 goto done;
   }
   ava_cb->ava_sc_status_handle = hdl;
-  OsafAmfSCStatusChangeCallbackT = cb;
+  osafAmfSCStatusChangeCallback = cb;
+
 
 done:
   if (ava_cb) {
diff --git a/src/amf/agent/ava_mds.h b/src/amf/agent/ava_mds.h
index 3de61db..8f35f75 100644
--- a/src/amf/agent/ava_mds.h
+++ b/src/amf/agent/ava_mds.h
@@ -102,7 +102,7 @@ uint32_t ava_mds_cbk(NCSMDS_CALLBACK_INFO*);
 uint32_t ava_mds_send(struct ava_cb_tag*, AVSV_NDA_AVA_MSG*,
   AVSV_NDA_AVA_MSG**);
 
-void 

[devel] [PATCH 0/1] Review Request for amf: Improve SC status change callback style [#2594]

2017-09-25 Thread Quyen Dao
Summary: amf: Improve SC status change callback style [#2594]
Review request for Ticket(s): 2594
Peer Reviewer(s): Gary, Hans, Praveen, Ravi
Pull request to: Gary
Affected branch(es): develop
Development branch: ticket-2594
Base revision: f3ef8eebf44f0eab4dcc65f83fe3119a77ef5067
Personal repository: git://git.code.sf.net/u/xquydao/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
amf: Improve SC status change callback style [#2594]

Make SC status change callback style to be consistent with other AMF callbacks
* Define an alias named OsafAmfSCStatusChangeCallbackT for the SC status change 
callback type
* Use osafAmfSCStatusChangeCallback as callback name
* Change "OsafAmfSCStatusT state" to "OsafAmfSCStatusT status"



Complete diffstat:
--
 src/ais/include/saAmf_B_04_02.h |  6 +-
 src/amf/README_SC_ABSENCE   |  4 ++--
 src/amf/agent/ava_mds.cc| 21 +++--
 src/amf/agent/ava_mds.h |  2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)


Testing Commands:
-
# amfclusterstatus


Testing, Expected Results:
--
amfclusterstatus works well


Conditions of Submission:
-
ACK from reviewers


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non extended SaNameT class [#1737]

2016-08-23 Thread Quyen Dao
Hi,

If no more comment, it will be pushed by tomorrow (2016/08/25)

Thanks,
Quyen

-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: Wednesday, August 10, 2016 7:27 PM
To: Quyen Dao <quyen@dektech.com.au>; srikanth.revan...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non
extended SaNameT class [#1737]

ack, code review only/Thanks HansN


On 08/05/2016 05:53 AM, Quyen Dao wrote:
> Hi,
>
> Please help review!
>
> Thanks,
> Quyen
>
> -Original Message-
> From: Quyen Dao [mailto:quyen@dektech.com.au]
> Sent: Wednesday, May 25, 2016 11:45 AM
> To: hans.nordeb...@ericsson.com; srikanth.revan...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non 
> extended SaNameT class [#1737]
>
>   python/pyosaf/saAis.py |  5 +
>   python/pyosaf/saImm.py |  2 +-
>   python/pyosaf/saNtf.py |  3 ++-
>   3 files changed, 8 insertions(+), 2 deletions(-)
>
>
> with this change, user can call str(sa_name_t_obj) to convert SaNameT 
> to str without caring it's extended or non extended.
>
> unmarshalSaImmValue and unmarshalSaNtfValue functions are also changed 
> to support both extended and non extended SaNameT
>
> diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py
> --- a/python/pyosaf/saAis.py
> +++ b/python/pyosaf/saAis.py
> @@ -198,6 +198,11 @@ else:
>   """
>   super(SaNameT, self).__init__(len(name), name)
>   
> + def __str__(self):
> + """Returns the content of SaNameT
> + """
> + return self.value
> +
>   
>   class SaVersionT(Structure):
>   """Contain software versions of area implementation.
> diff --git a/python/pyosaf/saImm.py b/python/pyosaf/saImm.py
> --- a/python/pyosaf/saImm.py
> +++ b/python/pyosaf/saImm.py
> @@ -71,7 +71,7 @@ def unmarshalSaImmValue(void_ptr, value_
>   val_ptr = SaImmValueTypeMap.get(value_type)
>   if val_ptr and void_ptr:
>   if val_ptr == SaNameT:
> - return cast(void_ptr, POINTER(val_ptr))[0].value
> + return str(cast(void_ptr, POINTER(val_ptr))[0])
>   return cast(void_ptr, POINTER(val_ptr))[0]
>   return None
>   
> diff --git a/python/pyosaf/saNtf.py b/python/pyosaf/saNtf.py
> --- a/python/pyosaf/saNtf.py
> +++ b/python/pyosaf/saNtf.py
> @@ -202,9 +202,10 @@ def unmarshalSaNtfValue(void_ptr, value_
>   val_ptr = SaNtfValueTypeMap.get(value_type)
>   if val_ptr and void_ptr:
>   if val_ptr == SaNameT:
> - return cast(void_ptr, POINTER(val_ptr))[0].value
> + return str(cast(void_ptr, POINTER(val_ptr))[0])
>   return cast(void_ptr, POINTER(val_ptr))[0]
>   return None
> +
>   class _ptrVal(Structure):
>   _fields_ = [('dataOffset', SaUint16T),
>   ('dataSize', SaUint16T)]
>
> --
> --
> --
> Mobile security can be enabling, not merely restricting. Employees who 
> bring their own devices (BYOD) to work are irked by the imposition of 
> MDM restrictions. Mobile Device Manager Plus allows you to control 
> only the apps on BYO-devices by containerizing them, leaving personal data
untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ___
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>



--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non extended SaNameT class [#1737]

2016-08-04 Thread Quyen Dao
Hi,

Please help review!

Thanks,
Quyen

-Original Message-
From: Quyen Dao [mailto:quyen@dektech.com.au] 
Sent: Wednesday, May 25, 2016 11:45 AM
To: hans.nordeb...@ericsson.com; srikanth.revan...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non extended
SaNameT class [#1737]

 python/pyosaf/saAis.py |  5 +
 python/pyosaf/saImm.py |  2 +-
 python/pyosaf/saNtf.py |  3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)


with this change, user can call str(sa_name_t_obj) to convert SaNameT to str
without caring it's extended or non extended.

unmarshalSaImmValue and unmarshalSaNtfValue functions are also changed to
support both extended and non extended SaNameT

diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py
--- a/python/pyosaf/saAis.py
+++ b/python/pyosaf/saAis.py
@@ -198,6 +198,11 @@ else:
"""
super(SaNameT, self).__init__(len(name), name)
 
+   def __str__(self):
+   """Returns the content of SaNameT
+   """
+   return self.value
+
 
 class SaVersionT(Structure):
"""Contain software versions of area implementation.
diff --git a/python/pyosaf/saImm.py b/python/pyosaf/saImm.py
--- a/python/pyosaf/saImm.py
+++ b/python/pyosaf/saImm.py
@@ -71,7 +71,7 @@ def unmarshalSaImmValue(void_ptr, value_
val_ptr = SaImmValueTypeMap.get(value_type)
if val_ptr and void_ptr:
if val_ptr == SaNameT:
-   return cast(void_ptr, POINTER(val_ptr))[0].value
+   return str(cast(void_ptr, POINTER(val_ptr))[0])
return cast(void_ptr, POINTER(val_ptr))[0]
return None
 
diff --git a/python/pyosaf/saNtf.py b/python/pyosaf/saNtf.py
--- a/python/pyosaf/saNtf.py
+++ b/python/pyosaf/saNtf.py
@@ -202,9 +202,10 @@ def unmarshalSaNtfValue(void_ptr, value_
val_ptr = SaNtfValueTypeMap.get(value_type)
if val_ptr and void_ptr:
if val_ptr == SaNameT:
-   return cast(void_ptr, POINTER(val_ptr))[0].value
+   return str(cast(void_ptr, POINTER(val_ptr))[0])
return cast(void_ptr, POINTER(val_ptr))[0]
return None
+
 class _ptrVal(Structure):
_fields_ = [('dataOffset', SaUint16T),
('dataSize', SaUint16T)]


--
Mobile security can be enabling, not merely restricting. Employees who bring
their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the apps
on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for pyosaf: Add __str__ method into non extended SaNameT class [#1737]

2016-05-24 Thread Quyen Dao
Summary: pyosaf: Add __str__ method into non extended SaNameT class [#1737]
Review request for Trac Ticket(s): #1737
Peer Reviewer(s): Hans, Srikanth
Pull request to: Hans
Affected branch(es): default
Development branch: default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset ea5807b590dbbaa235b5f368f7a0dd660e0fd214
Author: Quyen Dao <quyen@dektech.com.au>
Date:   Wed, 25 May 2016 10:52:46 +0700

pyosaf: Add __str__ method into non extended SaNameT class [#1737]

with this change, user can call str(sa_name_t_obj) to convert SaNameT 
to str
without caring it's extended or non extended.

unmarshalSaImmValue and unmarshalSaNtfValue functions are also changed 
to
support both extended and non extended SaNameT


Complete diffstat:
--
 python/pyosaf/saAis.py |  5 +
 python/pyosaf/saImm.py |  2 +-
 python/pyosaf/saNtf.py |  3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] pyosaf: Add __str__ method into non extended SaNameT class [#1737]

2016-05-24 Thread Quyen Dao
 python/pyosaf/saAis.py |  5 +
 python/pyosaf/saImm.py |  2 +-
 python/pyosaf/saNtf.py |  3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)


with this change, user can call str(sa_name_t_obj) to convert
SaNameT to str without caring it's extended or non extended.

unmarshalSaImmValue and unmarshalSaNtfValue functions are also changed
to support both extended and non extended SaNameT

diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py
--- a/python/pyosaf/saAis.py
+++ b/python/pyosaf/saAis.py
@@ -198,6 +198,11 @@ else:
"""
super(SaNameT, self).__init__(len(name), name)
 
+   def __str__(self):
+   """Returns the content of SaNameT
+   """
+   return self.value
+
 
 class SaVersionT(Structure):
"""Contain software versions of area implementation.
diff --git a/python/pyosaf/saImm.py b/python/pyosaf/saImm.py
--- a/python/pyosaf/saImm.py
+++ b/python/pyosaf/saImm.py
@@ -71,7 +71,7 @@ def unmarshalSaImmValue(void_ptr, value_
val_ptr = SaImmValueTypeMap.get(value_type)
if val_ptr and void_ptr:
if val_ptr == SaNameT:
-   return cast(void_ptr, POINTER(val_ptr))[0].value
+   return str(cast(void_ptr, POINTER(val_ptr))[0])
return cast(void_ptr, POINTER(val_ptr))[0]
return None
 
diff --git a/python/pyosaf/saNtf.py b/python/pyosaf/saNtf.py
--- a/python/pyosaf/saNtf.py
+++ b/python/pyosaf/saNtf.py
@@ -202,9 +202,10 @@ def unmarshalSaNtfValue(void_ptr, value_
val_ptr = SaNtfValueTypeMap.get(value_type)
if val_ptr and void_ptr:
if val_ptr == SaNameT:
-   return cast(void_ptr, POINTER(val_ptr))[0].value
+   return str(cast(void_ptr, POINTER(val_ptr))[0])
return cast(void_ptr, POINTER(val_ptr))[0]
return None
+
 class _ptrVal(Structure):
_fields_ = [('dataOffset', SaUint16T),
('dataSize', SaUint16T)]

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: do not checkpoint the nway sg fsm in case of no change [#1697]

2016-03-31 Thread Quyen Dao
Hi Praveen,

Please see my comments inline.

Thanks,
Quyen

-Original Message-
From: praveen malviya [mailto:praveen.malv...@oracle.com] 
Sent: Thursday, March 31, 2016 3:32 PM
To: Quyen Dao; 'Hans Nordebäck'; gary@dektech.com.au;
nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] amfd: do not checkpoint the nway sg fsm in case
of no change [#1697]

Hi Quyen,
avd_sg_nway_si_assign() is called even in the cases when SG is not stable
for example in

  1) node_fail_su_oper()  {
...
...
  /* if sg hasnt transitioned to sg-realign, initiate new si assignments
*/
 if (AVD_SG_FSM_SG_REALIGN != sg->sg_fsm_state)
 avd_sg_nway_si_assign(avd_cb, sg);
}
2) In avd_sg_nway_node_fail_sg_realign () also.
In such cases check-pointing is needed.

So in order to fix reported problem in #1697, check-pointing can be done
conditionally if old_fsm state before marking SG stable is other than
Stable. So patch can be modified to:

diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
@@ -1230,11 +1230,15 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
 bool is_act_ass_sent = false, is_all_su_oos = true, is_all_si_ok =
false, su_found = true;
 uint32_t rc = NCSCC_RC_SUCCESS;
 AVD_SU_SI_REL *tmp_susi;
+   AVD_SG_FSM_STATE old_fsm_state;

 TRACE_ENTER2("%s", sg->name.value);

+   //Remember old sg_fsm_state.
+   old_fsm_state = sg->sg_fsm_state;
 m_AVD_SET_SG_FSM(cb, sg, AVD_SG_FSM_STABLE);
-   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, sg, AVSV_CKPT_SG_FSM_STATE);
+   if (old_fsm_state != AVD_SG_FSM_STABLE)
+   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, sg, 
AVSV_CKPT_SG_FSM_STATE);

avd_sidep_update_si_dep_state_for_all_sis(sg);
/* assign active assignments to unassigned sis */

What do you think?
[Quyen] your suggested modification is not needed. It is already covered in
the macro `m_AVD_SET_SG_FSM`
(one line before the line I removed)

void AVD_SG::set_fsm_state(AVD_SG_FSM_STATE state) {
TRACE_ENTER();

if (sg_fsm_state != state) {
TRACE("%s sg_fsm_state %u => %u", name.value, sg_fsm_state,
state);
sg_fsm_state = state;
m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, this,
AVSV_CKPT_SG_FSM_STATE);
}

Please double check. Thanks!

Thanks,
Praveen

On 31-Mar-16 11:50 AM, Quyen Dao wrote:
> Hi,
>
> I will ask Hans N to push this patch tomorrow if there are no more
comments.
>
> Thanks,
> Quyen
>
> -Original Message-
> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> Sent: Friday, March 11, 2016 3:23 PM
> To: Quyen Dao; gary@dektech.com.au; praveen.malv...@oracle.com;
> nagendr...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] amfd: do not checkpoint the nway sg fsm in
case
> of no change [#1697]
>
> ack, code review only/Thanks HansN
>
> On 03/09/2016 11:35 AM, Quyen Dao wrote:
>>osaf/services/saf/amf/amfd/sg_nway_fsm.cc |  1 -
>>1 files changed, 0 insertions(+), 1 deletions(-)
>>
>>
>> After the nway application AMF entities are created, active amfd calls
>> avd_sg_nway_si_assign function to assign any unassigned SI but all SUs
>> are locked so no SI are assigned and the FSM is still stable. In this
>> function, it always checkpoints the nway sg fsm with state STABLE (at
>> the beginning of the function) to standby even the fsm state is not
> changed.
>> When the standby amfd receives the checkpoint message, it founds that
>> the nway sg doesn't exist in its database and does an assert to
>> generate the coredump. The nway sg doesn't exist in standby is because
>> checkpoint message arrives before the ccb_apply_ccb (which informs the
> nway sg creation) from immnd.
>>
>> Object's checkpoint message arrives to standby when the corresponding
>> object doesn't exist is a rare and race condition case, it needs a
general
> solution.
>>
>> But to solve for this particular crash, it is changed to not
>> checkpoint the nway sg fsm state as it's not changed (this is the correct
> behaviour and aligned with other sg).
>> Since nway sg fsm is not checkpointed because of no change, crash will
not
> happen.
>>
>> diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>> b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>> --- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>> +++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
>> @@ -1234,7 +1234,6 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
>>  TRACE_ENTER2

Re: [devel] [PATCH 1 of 1] pyosaf: Add support for extended SaNameT in saAis.py [#1676]

2016-03-10 Thread Quyen Dao
Hi Srikanth and Johan,

Could you please help review this patch? 

Thanks,
Quyen

-Original Message-
From: Quyen Dao [mailto:quyen@dektech.com.au] 
Sent: Wednesday, February 03, 2016 4:01 PM
To: hans.nordeb...@ericsson.com; srikanth.revan...@oracle.com;
johan.o.martens...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1 of 1] pyosaf: Add support for extended SaNameT in
saAis.py [#1676]

 python/pyosaf/saAis.py |  45 -
 1 files changed, 36 insertions(+), 9 deletions(-)


Set enviroment variable SA_ENABLE_EXTENDED_NAMES to 1 in order to use this
extended SaNameT

diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py
--- a/python/pyosaf/saAis.py
+++ b/python/pyosaf/saAis.py
@@ -18,9 +18,11 @@
 '''
 Common types and prototypes used by all modules in pyosaf  '''
+from os import environ
 
 import ctypes
-from ctypes import pointer, POINTER, cast, byref, c_void_p, Structure,
Union
+from ctypes import pointer, POINTER, cast, byref, c_void_p, Structure, \
+   Union, CDLL
 from pyosaf.saEnumConst import Enumeration, Const
 
 SaInt8T = ctypes.c_char
@@ -159,17 +161,42 @@ class SaAnyT(Structure):
_fields_ = [('bufferSize', SaSizeT),
('bufferAddr', POINTER(SaInt8T))]
 
+if environ.get('SA_ENABLE_EXTENDED_NAMES') == '1':
+   immdll = CDLL('libSaImmOm.so.0')
+   SaConstStringT = ctypes.c_char_p
 
-class SaNameT(Structure):
-   """Contain names.
-   """
-   _fields_ = [('length', SaUint16T),
-   ('value', (SaInt8T*saAis.SA_MAX_NAME_LENGTH))]
+   class SaNameT(Structure):
+   """Extended SaNameT
+   """
+   _fields_ = [('_opaque', SaUint16T*129)]
 
-   def __init__(self, name=''):
-   """Construct instance with contents of 'name'.
+   def __init__(self, name=''):
+   """Construct instance with contents of 'name'.
+   """
+   super(SaNameT, self).__init__()
+   immdll.saAisNameLend.argtypes = [SaConstStringT,
+
POINTER(SaNameT)]
+   immdll.saAisNameLend.restype = None
+
+   immdll.saAisNameLend(name, BYREF(self))
+
+   def __str__(self):
+   """Returns the content of SaNameT
+   """
+   immdll.saAisNameBorrow.argtypes = [POINTER(SaNameT)]
+   immdll.saAisNameBorrow.restype = SaConstStringT
+   return immdll.saAisNameBorrow(BYREF(self))
+else:
+   class SaNameT(Structure):
+   """Contain names.
"""
-   super(SaNameT, self).__init__(len(name), name)
+   _fields_ = [('length', SaUint16T),
+   ('value', (SaInt8T*saAis.SA_MAX_NAME_LENGTH))]
+
+   def __init__(self, name=''):
+   """Construct instance with contents of 'name'.
+   """
+   super(SaNameT, self).__init__(len(name), name)
 
 
 class SaVersionT(Structure):


--
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM +
Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor
end-to-end web transactions and take corrective actions now Troubleshoot
faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] amfd: do not checkpoint the nway sg fsm in case of no change [#1697]

2016-03-09 Thread Quyen Dao
 osaf/services/saf/amf/amfd/sg_nway_fsm.cc |  1 -
 1 files changed, 0 insertions(+), 1 deletions(-)


After the nway application AMF entities are created, active amfd calls 
avd_sg_nway_si_assign
function to assign any unassigned SI but all SUs are locked so no SI are 
assigned
and the FSM is still stable. In this function, it always checkpoints
the nway sg fsm with state STABLE (at the beginning of the function) to standby
even the fsm state is not changed.
When the standby amfd receives the checkpoint message, it founds that the nway 
sg doesn't exist
in its database and does an assert to generate the coredump. The nway sg 
doesn't exist in standby
is because checkpoint message arrives before the ccb_apply_ccb (which informs 
the nway sg creation)
from immnd.

Object's checkpoint message arrives to standby when the corresponding object 
doesn't exist is a rare
and race condition case, it needs a general solution.

But to solve for this particular crash, it is changed to not checkpoint the 
nway sg fsm state as
it's not changed (this is the correct behaviour and aligned with other sg).
Since nway sg fsm is not checkpointed because of no change, crash will not 
happen.

diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc 
b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
@@ -1234,7 +1234,6 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
TRACE_ENTER2("%s", sg->name.value);
 
m_AVD_SET_SG_FSM(cb, sg, AVD_SG_FSM_STABLE);
-   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, sg, AVSV_CKPT_SG_FSM_STATE);
 
avd_sidep_update_si_dep_state_for_all_sis(sg);
/* assign active assignments to unassigned sis */

--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] pyosaf: Add support for extended SaNameT in saAis.py [#1676]

2016-02-03 Thread Quyen Dao
 python/pyosaf/saAis.py |  45 -
 1 files changed, 36 insertions(+), 9 deletions(-)


Set enviroment variable SA_ENABLE_EXTENDED_NAMES to 1 in order to use
this extended SaNameT

diff --git a/python/pyosaf/saAis.py b/python/pyosaf/saAis.py
--- a/python/pyosaf/saAis.py
+++ b/python/pyosaf/saAis.py
@@ -18,9 +18,11 @@
 '''
 Common types and prototypes used by all modules in pyosaf
 '''
+from os import environ
 
 import ctypes
-from ctypes import pointer, POINTER, cast, byref, c_void_p, Structure, Union
+from ctypes import pointer, POINTER, cast, byref, c_void_p, Structure, \
+   Union, CDLL
 from pyosaf.saEnumConst import Enumeration, Const
 
 SaInt8T = ctypes.c_char
@@ -159,17 +161,42 @@ class SaAnyT(Structure):
_fields_ = [('bufferSize', SaSizeT),
('bufferAddr', POINTER(SaInt8T))]
 
+if environ.get('SA_ENABLE_EXTENDED_NAMES') == '1':
+   immdll = CDLL('libSaImmOm.so.0')
+   SaConstStringT = ctypes.c_char_p
 
-class SaNameT(Structure):
-   """Contain names.
-   """
-   _fields_ = [('length', SaUint16T),
-   ('value', (SaInt8T*saAis.SA_MAX_NAME_LENGTH))]
+   class SaNameT(Structure):
+   """Extended SaNameT
+   """
+   _fields_ = [('_opaque', SaUint16T*129)]
 
-   def __init__(self, name=''):
-   """Construct instance with contents of 'name'.
+   def __init__(self, name=''):
+   """Construct instance with contents of 'name'.
+   """
+   super(SaNameT, self).__init__()
+   immdll.saAisNameLend.argtypes = [SaConstStringT,
+   
POINTER(SaNameT)]
+   immdll.saAisNameLend.restype = None
+
+   immdll.saAisNameLend(name, BYREF(self))
+
+   def __str__(self):
+   """Returns the content of SaNameT
+   """
+   immdll.saAisNameBorrow.argtypes = [POINTER(SaNameT)]
+   immdll.saAisNameBorrow.restype = SaConstStringT
+   return immdll.saAisNameBorrow(BYREF(self))
+else:
+   class SaNameT(Structure):
+   """Contain names.
"""
-   super(SaNameT, self).__init__(len(name), name)
+   _fields_ = [('length', SaUint16T),
+   ('value', (SaInt8T*saAis.SA_MAX_NAME_LENGTH))]
+
+   def __init__(self, name=''):
+   """Construct instance with contents of 'name'.
+   """
+   super(SaNameT, self).__init__(len(name), name)
 
 
 class SaVersionT(Structure):

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for pyosaf: Add support for extended SaNameT in saAis.py [#1676]

2016-02-03 Thread Quyen Dao
Summary: pyosaf: Add support for extended SaNameT in saAis.py [#1676]
Review request for Trac Ticket(s): #1676
Peer Reviewer(s): HansN, Srikanth, Johan
Pull request to: HansN
Affected branch(es): default
Development branch: default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   Y


Comments (indicate scope for each "y" above):
-
 <>

changeset 1325333fe6225fe133d14c3f759c63c32e74f859
Author: Quyen Dao <quyen@dektech.com.au>
Date:   Wed, 03 Feb 2016 14:21:47 +0700

pyosaf: Add support for extended SaNameT in saAis.py [#1676]

Set enviroment variable SA_ENABLE_EXTENDED_NAMES to 1 in order to use 
this
extended SaNameT


Complete diffstat:
--
 python/pyosaf/saAis.py |  45 -
 1 files changed, 36 insertions(+), 9 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 2 of 2] amfnd: fix amfnd crash due to inst failure of a restarting npi comp [#1587]

2016-01-11 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Friday, January 08, 2016 8:27 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au; minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 2 of 2] amfnd: fix amfnd crash due to inst failure of a
restarting npi comp [#1587]

 osaf/services/saf/amf/amfnd/susm.cc |  14 +-
 1 files changed, 9 insertions(+), 5 deletions(-)


amfnd crashes when comp instantiation fails as a part of comp restart
recovery.
Applicable to a NPI SU only.

Crash occurs because AMFND is trying to respond to AMFD for assignment
status.
If a healthy comp faults in stable state of SG with comp-restart or
su-restart recovery and it results in INST_FAILED state of SU, then there
will be no pending assignments to AMFD. AMFND must inform to AMFD only when
SU enters INST_FAILED state during handling of assignments sent by AMFD.

diff --git a/osaf/services/saf/amf/amfnd/susm.cc
b/osaf/services/saf/amf/amfnd/susm.cc
--- a/osaf/services/saf/amf/amfnd/susm.cc
+++ b/osaf/services/saf/amf/amfnd/susm.cc
@@ -1818,11 +1818,15 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C
if (((SA_AMF_PRESENCE_INSTANTIATING == prv_st) ||
 (SA_AMF_PRESENCE_INSTANTIATED == prv_st)) &&
(SA_AMF_PRESENCE_INSTANTIATION_FAILED == final_st)) {
TRACE("SU Instantiating/Instantiated ->
Instantiation Failed");
-   /* si-assignment failed .. inform avd */
-   TRACE("SI-Assignment failed, Informing AVD");
-   rc = avnd_di_susi_resp_send(cb, su, si);
-   if (NCSCC_RC_SUCCESS != rc)
-   goto done;
+   /*SU may fail with INST_FAILED state as a part of
recovery 
+ like comp-restart and su-restart. Inform AMFD if 
+ assignments are pending from AMFD.*/
+   if (m_AVND_SU_IS_ASSIGN_PEND(su)) {
+   TRACE("SI-Assignment failed, Informing
AVD");
+   rc = avnd_di_susi_resp_send(cb, su, si);
+   if (NCSCC_RC_SUCCESS != rc)
+   goto done;
+   }
 
/* mark su as failed */
m_AVND_SU_FAILED_SET(su);


--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 2] amfnd: fix continuous restart of a inst_failed comp during su restart[#1556]

2016-01-11 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Friday, January 08, 2016 8:27 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au; minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 2] amfnd: fix continuous restart of a inst_failed comp
during su restart[#1556]

 osaf/services/saf/amf/amfnd/clc.cc|  87
+++---
 osaf/services/saf/amf/amfnd/include/avnd_su.h |   2 +
 osaf/services/saf/amf/amfnd/su.cc |  18 +
 osaf/services/saf/amf/amfnd/susm.cc   |  19 +-
 4 files changed, 100 insertions(+), 26 deletions(-)


During su-restart recovery or RESTART admin op, if instantiation of a
component
fails amfnd keeps on restarting it after each inst_failure.

AMFND must give up re-instantiation of a inst_fail compoent after trying
saAmfNumMaxInstantiateWithoutDelay value of comp global class or
saAmfCompNumMaxInstantiateWithoutDelay value in comp class.

Patch stops re-instantiation of a inst_failed comp when max retries is
reached.

diff --git a/osaf/services/saf/amf/amfnd/clc.cc
b/osaf/services/saf/amf/amfnd/clc.cc
--- a/osaf/services/saf/amf/amfnd/clc.cc
+++ b/osaf/services/saf/amf/amfnd/clc.cc
@@ -891,7 +891,8 @@ uint32_t avnd_comp_clc_fsm_run(AVND_CB *
(final_st == SA_AMF_PRESENCE_RESTARTING)) &&
((ev == AVND_COMP_CLC_PRES_FSM_EV_INST_SUCC)
||
 (ev == AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC)
|| 
-(ev ==
AVND_COMP_CLC_PRES_FSM_EV_CLEANUP_SUCC
+(ev ==
AVND_COMP_CLC_PRES_FSM_EV_CLEANUP_SUCC)) && 
+   (comp->clc_info.exec_cmd ==
AVND_COMP_CLC_CMD_TYPE_NONE)))
rc = avnd_comp_clc_st_chng_prc(cb, comp, prv_st, final_st);
 
  done:
@@ -1669,6 +1670,62 @@ uint32_t avnd_comp_clc_insting_clean_hdl
return rc;
 }
 
+/**
+ * @brief  Checks for eligibility of a failed component for instantiation 
+ *when it has been successfully cleaned up. Instantiation depends
+ *upon recovery context or Restart admin op. 
+ *
+ * @return true/false
+ */
+static bool is_failed_comp_eligible_for_instantiation(AVND_COMP *comp) {
+
+  if (isRestartSet(comp->su)) { //SU is restarting (RESTART admin op or
recovery policy).
+ if (isFailed(comp->su)) { //SU is failed (case surestart
recovery).
+ /*During surestart recovery, after cleanup of all
components, amfnd starts 
+   instantiation of components. A component may fault at
this stage. Such a 
+   component is eligible for instantiation.*/
+ if ((comp->pres == SA_AMF_PRESENCE_INSTANTIATING) &&
+ (comp->su->pres == SA_AMF_PRESENCE_INSTANTIATING))
+   return true;
+
+ /*This component is being cleaned up because of su restart
recovery. 
+   In this case component is not eligible for
instantiation.*/
+ if ((comp->pres == SA_AMF_PRESENCE_RESTARTING) &&
+ (comp->su->pres ==
SA_AMF_PRESENCE_TERMINATING)) {
+ /* Component got cleaned up in RESTARTING state
and surestart recovery is going on.
+In surestart recovery component never enters in
RESTARTING state. This means
+component was cleaned up in the context of
comp-restart recovery.
+Since further escalation has reached to
surestart, same cleanup can be used
+and thus comp can be marked uninstantiated.*/
+ avnd_comp_pres_state_set(comp,
SA_AMF_PRESENCE_UNINSTANTIATED);
+ return false;
+}
+ } else { //Case of RESTART admin op or assignment phase of
surestart recovery.
+   if (isAdminRestarted(comp->su)) { //RESTART admin op.
+   /*During RESTART admin op on SU, after termination
of all components, amfnd
+ starts instantiation of components. A component
may fault at this stage. 
+ Such a component is eligible for instantiation.*/
+   if  ((comp->pres == SA_AMF_PRESENCE_RESTARTING) ||
+   (comp->pres ==
SA_AMF_PRESENCE_INSTANTIATING)) 
+   return true;
+   } else {//Assignment phase during RESTART admin op or during
surestart recovery. 
+   /*After successful instantiation of all the
components of SU because of either
+ su restart recovery or RESTART admin op on SU,
amfnd starts reassigning
+ the components in SU. A component may fault during
reassignment. Such a
+   

Re: [devel] [PATCH 1 of 1] amfd: fix amfd crash during modification of comp global attributes[#1612]

2015-12-24 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Thursday, December 24, 2015 1:34 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd crash during modification of comp
global attributes[#1612]

 osaf/services/saf/amf/amfd/comptype.cc |  83
+
 1 files changed, 63 insertions(+), 20 deletions(-)


AMFD crashes for following commands:
immcfg -a saAmfNumMaxInstantiateWithoutDelay=
safRdn=compGlobalAttributes,safApp=safAmfService
immcfg -a saAmfNumMaxInstantiateWithDelay=
safRdn=compGlobalAttributes,safApp=safAmfService
immcfg -a saAmfNumMaxAmStopAttempts=
safRdn=compGlobalAttributes,safApp=safAmfService
immcfg -a saAmfNumMaxAmStartAttempts=
safRdn=compGlobalAttributes,safApp=safAmfService
immcfg -a saAmfDelayBetweenInstantiateAttempts=
safRdn=compGlobalAttributes,safApp=safAmfService

Patch fixes the problem by restoring the default values as per spec.

diff --git a/osaf/services/saf/amf/amfd/comptype.cc
b/osaf/services/saf/amf/amfd/comptype.cc
--- a/osaf/services/saf/amf/amfd/comptype.cc
+++ b/osaf/services/saf/amf/amfd/comptype.cc
@@ -794,46 +794,89 @@ static void avd_compglobalattrs_ccb_appl
 {
int i = 0;
const SaImmAttrModificationT_2 *attrMod;
+   bool value_is_deleted;
 
TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId,
opdata->objectName.value);
 
switch (opdata->operationType) {
case CCBUTIL_MODIFY:
while ((attrMod = opdata->param.modify.attrMods[i++]) !=
nullptr) {
+   void *value = nullptr;
+
+   if ((attrMod->modType == SA_IMM_ATTR_VALUES_DELETE)
||
+   (attrMod->modAttr.attrValues ==
nullptr)) {
+   /* Attribute value is deleted, revert to
default value */
+   value_is_deleted = true;
+   } else {
+   /* Attribute value is modified */
+   value_is_deleted = false;
+   value = attrMod->modAttr.attrValues[0];
+   }
+
if (!strcmp("saAmfNumMaxInstantiateWithoutDelay",
attrMod->modAttr.attrName)) {
+   SaUint32T old_value =
avd_comp_global_attrs.saAmfNumMaxInstantiateWithoutDelay;
+   if (value_is_deleted == true) {
+//Default value as per Section 8.14
(B0401).
+
avd_comp_global_attrs.saAmfNumMaxInstantiateWithoutDelay = 2;
+   } else {
+
avd_comp_global_attrs.saAmfNumMaxInstantiateWithoutDelay =
+   *((SaUint32T *)value);
+   }
TRACE("saAmfNumMaxInstantiateWithoutDelay
modified from '%u' to '%u'",
-
avd_comp_global_attrs.saAmfNumMaxInstantiateWithoutDelay, 
-   *((SaUint32T
*)attrMod->modAttr.attrValues[0]));
-
avd_comp_global_attrs.saAmfNumMaxInstantiateWithoutDelay =
-   *((SaUint32T
*)attrMod->modAttr.attrValues[0]);
+   old_value,
+
avd_comp_global_attrs.saAmfNumMaxInstantiateWithoutDelay); 
}
if (!strcmp("saAmfNumMaxInstantiateWithDelay",
attrMod->modAttr.attrName)) {
+   SaUint32T old_value =
avd_comp_global_attrs.saAmfNumMaxInstantiateWithDelay;
+   if (value_is_deleted == true) {
+   //Default value as per Section 8.14
(B0401).
+
avd_comp_global_attrs.saAmfNumMaxInstantiateWithDelay = 0;
+   } else {
+
avd_comp_global_attrs.saAmfNumMaxInstantiateWithDelay =
+   *((SaUint32T *)value);
+   }
TRACE("saAmfNumMaxInstantiateWithDelay
modified from '%u' to '%u'",
-
avd_comp_global_attrs.saAmfNumMaxInstantiateWithDelay, 
-   *((SaUint32T
*)attrMod->modAttr.attrValues[0]));
-
avd_comp_global_attrs.saAmfNumMaxInstantiateWithDelay =
-   *((SaUint32T
*)attrMod->modAttr.attrValues[0]);
+   old_value,
+
avd_comp_global_attrs.saAmfNumMaxInstantiateWithDelay); 
}
if (!strcmp("saAmfNumMaxAmStartAttempts",
attrMod->modAttr.attrName)) {
+   SaUint32T old_value =
avd_comp_global_attrs.saAmfNumMaxAmStartAttempts;
+   if (value_is_deleted == true) {
+   //Default value as 

Re: [devel] [PATCH 1 of 1] amfd: fix amfd crash during modification of saAmfSGSuHostNodeGroup [#1594]

2015-12-10 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Thursday, December 10, 2015 1:43 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd crash during modification of
saAmfSGSuHostNodeGroup [#1594]

 osaf/services/saf/amf/amfd/sg.cc |  28 +++-
 1 files changed, 23 insertions(+), 5 deletions(-)


Command immcfg -a saAmfSGSuHostNodeGroup=""  safSg=2N,safApp=OpenSAF
causes amfd crash.

Patch adds check to prevent deletion of saAmfSGSuHostNodeGroup or its
modification
to null value.

diff --git a/osaf/services/saf/amf/amfd/sg.cc
b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -556,11 +556,15 @@ static SaAisErrorT ccb_completed_modify_
/* Attribute value removed */
if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE)
||
(attribute->attrValues == nullptr))
-   continue;
-
-   value = attribute->attrValues[0];
+   value_is_deleted = true;
+   else {
+   value_is_deleted = false;
+   value = attribute->attrValues[0];
+   }
 
if (!strcmp(attribute->attrName, "saAmfSGType")) {
+   if (value_is_deleted == true)
+   continue;
SaNameT sg_type_name = *((SaNameT *)value);
 
if (sg->saAmfSGAdminState ==
SA_AMF_ADMIN_LOCKED) {
@@ -579,6 +583,12 @@ static SaAisErrorT ccb_completed_modify_
}
 
} else if (!strcmp(attribute->attrName,
"saAmfSGSuHostNodeGroup")) {
+   if (value_is_deleted == true) {
+   report_ccb_validation_error(opdata,
+   "Deletion or Modification to
NULL value not allowed");
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
if (ng_change_is_valid(sg, (SaNameT *)value,
opdata) == false) {
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;
@@ -587,6 +597,8 @@ static SaAisErrorT ccb_completed_modify_
} else if (!strcmp(attribute->attrName,
"saAmfSGNumPrefActiveSUs")) {
} else if (!strcmp(attribute->attrName,
"saAmfSGNumPrefStandbySUs")) {
} else if (!strcmp(attribute->attrName,
"saAmfSGNumPrefInserviceSUs")) {
+   if (value_is_deleted == true)
+   continue;
uint32_t pref_inservice_su;
pref_inservice_su = *((SaUint32T *)value);
 
@@ -608,6 +620,8 @@ static SaAisErrorT ccb_completed_modify_
} else if (!strcmp(attribute->attrName,
"saAmfSGSuRestartProb")) {
} else if (!strcmp(attribute->attrName,
"saAmfSGSuRestartMax")) {
} else if (!strcmp(attribute->attrName,
"saAmfSGAutoRepair")) {
+   if (value_is_deleted == true)
+   continue;
uint32_t sg_autorepair = *((SaUint32T
*)attribute->attrValues[0]);
if (sg_autorepair > true ) {
report_ccb_validation_error(opdata,
@@ -669,8 +683,12 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfSGSuHostNodeGroup")) {
-   if (value_is_deleted == true)
-   continue;
+   if (value_is_deleted == true) {
+   report_ccb_validation_error(opdata,
+   "Deletion or Modification to
NULL value not allowed");
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
if (ng_change_is_valid(sg, (SaNameT *)value,
opdata) == false) {
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;


--

Re: [devel] [PATCH 1 of 1] amfd: fix amfd assert during modification of comp attributes v2 [#1592]

2015-11-26 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Wednesday, November 25, 2015 1:21 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd assert during modification of comp
attributes v2 [#1592]

 osaf/services/saf/amf/amfd/comp.cc |  64
++---
 1 files changed, 58 insertions(+), 6 deletions(-)


Following three commands causes assert in amfd:
immcfg -a saAmfCompNumMaxAmStopAttempts=
safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1
immcfg -a saAmfCompNumMaxAmStartAttempts=
safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1
immcfg -a osafAmfCompHcCmdArgv=
safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1

Patch rejects CCB modification on unsupported attributes and avoids amfd
assert.

diff --git a/osaf/services/saf/amf/amfd/comp.cc
b/osaf/services/saf/amf/amfd/comp.cc
--- a/osaf/services/saf/amf/amfd/comp.cc
+++ b/osaf/services/saf/amf/amfd/comp.cc
@@ -886,6 +886,7 @@ static SaAisErrorT ccb_completed_modify_
int i = 0;
AVD_COMP *comp;
SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION;
+   bool value_is_deleted;
 
TRACE_ENTER();
 
@@ -893,15 +894,20 @@ static SaAisErrorT ccb_completed_modify_
 
while ((attr_mod = opdata->param.modify.attrMods[i++]) != nullptr) {
const SaImmAttrValuesT_2 *attribute = _mod->modAttr;
-   void *value;
+   void *value = nullptr;
 
-   /* Attribute value removed */
-   if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
(attribute->attrValues == nullptr))
-   continue;
-
-   value = attribute->attrValues[0];
+if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
(attribute->attrValues == nullptr)) {
+/* Attribute value is deleted, revert to default
value */
+value_is_deleted = true;
+} else {
+/* Attribute value is modified */
+value_is_deleted = false;
+value = attribute->attrValues[0];
+}
 
if (!strcmp(attribute->attrName, "saAmfCompType")) {
+   if (value_is_deleted == true)
+   continue;
SaNameT dn = *((SaNameT*)value);
if (nullptr ==
comptype_db->find(Amf::to_string())) {
report_ccb_validation_error(opdata,
"saAmfCompType '%s' not found", dn.value); @@ -941,6 +947,8 @@ static
SaAisErrorT ccb_completed_modify_
}
}
} else if (!strcmp(attribute->attrName,
"saAmfCompInstantiateCmdArgv")) {
+   if (value_is_deleted == true)
+   continue;
char *param_val = *((char **)value);
if (nullptr == param_val) {
report_ccb_validation_error(opdata,
@@ -948,6 +956,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfCompInstantiateTimeout")) {
+   if (value_is_deleted == true)
+   continue;
SaTimeT timeout;
m_NCS_OS_HTONLL_P(, (*((SaTimeT *)value)));
if (timeout == 0) {
@@ -956,6 +966,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfCompInstantiationLevel")) {
+   if (value_is_deleted == true)
+   continue;
uint32_t num_inst = *((SaUint32T *)value);
if (num_inst == 0) {
report_ccb_validation_error(opdata,
"Modification of saAmfCompInstantiationLevel Fail,"
@@ -963,6 +975,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfCompNumMaxInstantiateWithoutDelay")) {
+   if (value_is_deleted == true)
+   continue;
uint32_t num_inst = *((SaUint32T *)value);
if (num_inst == 0) {
report_ccb_validation_error(opdata,
"Modification of saAmfCompNumMaxInstantiateWithoutDelay"
@@ -970,6 +984,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,

[devel] [PATCH 0 of 1] Review Request for AMF: Add directory and Makefile.am for amfa and amfnd unit test [#1610]

2015-11-25 Thread Quyen Dao
Summary: Setup directory and Makefile.am for amfa and amfnd google unit test 
[#1610]
Review request for Trac Ticket(s): #1610
Peer Reviewer(s): Hans, Nagu, Praveen, Gary 
Pull request to: Hans
Affected branch(es): default
Development branch: default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset 56a846d07f0093202d11bb89347e60709369bdfa
Author: Quyen Dao <quyen@dektech.com.au>
Date:   Thu, 26 Nov 2015 14:25:06 +0700

Setup directory and Makefile.am for amfa and amfnd google unit test 
[#1610]


Added Files:

 osaf/libs/agents/saf/amfa/tests/Makefile.am
 osaf/services/saf/amf/amfnd/tests/Makefile.am


Complete diffstat:
--
 configure.ac  |   2 ++
 osaf/libs/agents/saf/amfa/Makefile.am |   2 +-
 osaf/libs/agents/saf/amfa/tests/Makefile.am   |  35 
+++
 osaf/services/saf/amf/amfnd/Makefile.am   |   2 +-
 osaf/services/saf/amf/amfnd/tests/Makefile.am |  35 
+++
 5 files changed, 74 insertions(+), 2 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] Setup directory and Makefile.am for amfa and amfnd google unit test [#1610]

2015-11-25 Thread Quyen Dao
 configure.ac  |   2 +
 osaf/libs/agents/saf/amfa/Makefile.am |   2 +-
 osaf/libs/agents/saf/amfa/tests/Makefile.am   |  35 +++
 osaf/services/saf/amf/amfnd/Makefile.am   |   2 +-
 osaf/services/saf/amf/amfnd/tests/Makefile.am |  35 +++
 5 files changed, 74 insertions(+), 2 deletions(-)


diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -690,6 +690,7 @@ AC_CONFIG_FILES([
 osaf/libs/agents/saf/Makefile
 osaf/libs/agents/saf/amfa/Makefile
 osaf/libs/agents/saf/amfa/include/Makefile
+osaf/libs/agents/saf/amfa/tests/Makefile
 osaf/libs/agents/saf/imma/Makefile
 osaf/libs/agents/saf/plma/Makefile
 osaf/libs/agents/saf/lga/Makefile
@@ -809,6 +810,7 @@ AC_CONFIG_FILES([
 osaf/services/saf/amf/amfnd/include/Makefile
 osaf/services/saf/amf/amfnd/scripts/Makefile
 osaf/services/saf/amf/amfnd/scripts/osaf-amfnd
+osaf/services/saf/amf/amfnd/tests/Makefile
 osaf/services/saf/amf/amfwdog/Makefile
 osaf/services/saf/amf/amfwdog/scripts/Makefile
 osaf/services/saf/amf/amfwdog/scripts/osaf-amfwd
diff --git a/osaf/libs/agents/saf/amfa/Makefile.am 
b/osaf/libs/agents/saf/amfa/Makefile.am
--- a/osaf/libs/agents/saf/amfa/Makefile.am
+++ b/osaf/libs/agents/saf/amfa/Makefile.am
@@ -18,7 +18,7 @@ include $(top_srcdir)/Makefile.common
 
 MAINTAINERCLEANFILES = Makefile.in
 
-SUBDIRS = include
+SUBDIRS = include tests
 
 noinst_LTLIBRARIES = libava.la
 
diff --git a/osaf/libs/agents/saf/amfa/tests/Makefile.am 
b/osaf/libs/agents/saf/amfa/tests/Makefile.am
new file mode 100644
--- /dev/null
+++ b/osaf/libs/agents/saf/amfa/tests/Makefile.am
@@ -0,0 +1,35 @@
+#  -*- OpenSAF  -*-
+#
+# (C) Copyright 2015 The OpenSAF Foundation
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+# under the GNU Lesser General Public License Version 2.1, February 1999.
+# The complete license can be accessed from the following location:
+# http://opensource.org/licenses/lgpl-license.php
+# See the Copying file included with the OpenSAF distribution for full
+# licensing terms.
+#
+# Author(s): Ericsson AB
+#
+
+include $(top_srcdir)/Makefile.common
+
+TESTS = testamfa
+
+check_PROGRAMS = testamfa
+
+testamfa_CXXFLAGS =$(AM_CXXFLAGS)
+
+testamfa_CPPFLAGS = \
+   -I$(GTEST_DIR)/include
+
+testamfa_LDFLAGS =
+
+# Add test case cc files here
+testamfa_SOURCES =
+
+testamfa_LDADD = \
+   $(GTEST_DIR)/lib/libgtest.la \
+   $(GTEST_DIR)/lib/libgtest_main.la
diff --git a/osaf/services/saf/amf/amfnd/Makefile.am 
b/osaf/services/saf/amf/amfnd/Makefile.am
--- a/osaf/services/saf/amf/amfnd/Makefile.am
+++ b/osaf/services/saf/amf/amfnd/Makefile.am
@@ -18,7 +18,7 @@ include $(top_srcdir)/Makefile.common
 
 MAINTAINERCLEANFILES = Makefile.in
 
-SUBDIRS = include scripts
+SUBDIRS = include scripts tests
 
 osaf_execbindir = $(pkglibdir)
 osaf_execbin_PROGRAMS = osafamfnd
diff --git a/osaf/services/saf/amf/amfnd/tests/Makefile.am 
b/osaf/services/saf/amf/amfnd/tests/Makefile.am
new file mode 100644
--- /dev/null
+++ b/osaf/services/saf/amf/amfnd/tests/Makefile.am
@@ -0,0 +1,35 @@
+#  -*- OpenSAF  -*-
+#
+# (C) Copyright 2015 The OpenSAF Foundation
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+# under the GNU Lesser General Public License Version 2.1, February 1999.
+# The complete license can be accessed from the following location:
+# http://opensource.org/licenses/lgpl-license.php
+# See the Copying file included with the OpenSAF distribution for full
+# licensing terms.
+#
+# Author(s): Ericsson AB
+#
+
+include $(top_srcdir)/Makefile.common
+
+TESTS = testamfnd
+
+check_PROGRAMS = testamfnd
+
+testamfnd_CXXFLAGS =$(AM_CXXFLAGS)
+
+testamfnd_CPPFLAGS = \
+   -I$(GTEST_DIR)/include
+
+testamfnd_LDFLAGS =
+
+# Add test case cc files here
+testamfnd_SOURCES =
+
+testamfnd_LDADD = \
+   $(GTEST_DIR)/lib/libgtest.la \
+   $(GTEST_DIR)/lib/libgtest_main.la

--
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551=/4140
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: fix amfd assert during modofication of comp attributes [#1592]

2015-11-24 Thread Quyen Dao
Hi Praveen,

I got the below error when compiling the latest changeset with your patch.

comp.cc:1189:30: error: 'value' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
name = *((SaNameT *)value);
  ^
comp.cc:897:9: note: 'value' was declared here
   void *value;
 ^
cc1plus: all warnings being treated as errors
make[7]: *** [osafamfd-comp.o] Error 1

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Tuesday, November 24, 2015 12:47 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd assert during modofication of comp
attributes [#1592]

 osaf/services/saf/amf/amfd/comp.cc |  62
++---
 1 files changed, 57 insertions(+), 5 deletions(-)


Following three commands causes assert in amfd:
immcfg -a saAmfCompNumMaxAmStopAttempts=
safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1
immcfg -a saAmfCompNumMaxAmStartAttempts=
safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1
immcfg -a osafAmfCompHcCmdArgv=
safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1

Patch rejects CCB modification on unsupported attributes and avoids amfd
assert.

diff --git a/osaf/services/saf/amf/amfd/comp.cc
b/osaf/services/saf/amf/amfd/comp.cc
--- a/osaf/services/saf/amf/amfd/comp.cc
+++ b/osaf/services/saf/amf/amfd/comp.cc
@@ -886,6 +886,7 @@ static SaAisErrorT ccb_completed_modify_
int i = 0;
AVD_COMP *comp;
SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION;
+   bool value_is_deleted;
 
TRACE_ENTER();
 
@@ -895,13 +896,18 @@ static SaAisErrorT ccb_completed_modify_
const SaImmAttrValuesT_2 *attribute = _mod->modAttr;
void *value;
 
-   /* Attribute value removed */
-   if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
(attribute->attrValues == nullptr))
-   continue;
-
-   value = attribute->attrValues[0];
+if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
(attribute->attrValues == nullptr)) {
+/* Attribute value is deleted, revert to default
value */
+value_is_deleted = true;
+} else {
+/* Attribute value is modified */
+value_is_deleted = false;
+value = attribute->attrValues[0];
+}
 
if (!strcmp(attribute->attrName, "saAmfCompType")) {
+   if (value_is_deleted == true)
+   continue;
SaNameT dn = *((SaNameT*)value);
if (nullptr ==
comptype_db->find(Amf::to_string())) {
report_ccb_validation_error(opdata,
"saAmfCompType '%s' not found", dn.value);
@@ -941,6 +947,8 @@ static SaAisErrorT ccb_completed_modify_
}
}
} else if (!strcmp(attribute->attrName,
"saAmfCompInstantiateCmdArgv")) {
+   if (value_is_deleted == true)
+   continue;
char *param_val = *((char **)value);
if (nullptr == param_val) {
report_ccb_validation_error(opdata,
@@ -948,6 +956,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfCompInstantiateTimeout")) {
+   if (value_is_deleted == true)
+   continue;
SaTimeT timeout;
m_NCS_OS_HTONLL_P(, (*((SaTimeT *)value)));
if (timeout == 0) {
@@ -956,6 +966,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfCompInstantiationLevel")) {
+   if (value_is_deleted == true)
+   continue;
uint32_t num_inst = *((SaUint32T *)value);
if (num_inst == 0) {
report_ccb_validation_error(opdata,
"Modification of saAmfCompInstantiationLevel Fail,"
@@ -963,6 +975,8 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfCompNumMaxInstantiateWithoutDelay")) {
+   if (value_is_deleted == true)
+   continue;
uint32_t num_inst = *((SaUint32T *)value);
if (num_inst == 0) {

Re: [devel] [PATCH 1 of 1] amfd: fix amfd crash during attribute modification in compType [#1593]

2015-11-24 Thread Quyen Dao
Hi Praveen,

When the cluster starts, the saAmfCtDefInstantiationLevel is .

root@SC-1:~# immlist -a saAmfCtDefInstantiationLevel
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG
saAmfCtDefInstantiationLevel=

If I change saAmfCtDefInstantiationLevel to 1 then change it back to
. 
It fails at changing back to , the admin op is rejected due to the
change/intention of your patch

root@SC-1:~# immcfg -a saAmfCtDefInstantiationLevel=1
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG
root@SC-1:~# immcfg -a saAmfCtDefInstantiationLevel=""
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG
error - saImmOmCcbApply FAILED: SA_AIS_ERR_FAILED_OPERATION (21)
OI reports: IMM: Validation abort: Completed validation fails
(ERR_BAD_OPERATION)
   OI reports: Value deletion for 'saAmfCtDefInstantiationLevel' is not
supported
   
   root@SC-1:~# immlist -a saAmfCtDefInstantiationLevel
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG
   saAmfCtDefInstantiationLevel=1
   root@SC-1:~#

>From the user perspective, I would expect that saAmfCtDefInstantiationLevel
can be set back to  
as its initial value of saAmfCtDefInstantiationLevel is .

Please give your comment. 

Thanks,
Quyen

P.S. same comment for saAmfCtDefDisableRestart


-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Wednesday, November 25, 2015 12:20 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd crash during attribute modification
in compType [#1593]

 osaf/services/saf/amf/amfd/comptype.cc |  28 
 1 files changed, 28 insertions(+), 0 deletions(-)


Following commands causes amfd crash:
immcfg -a saAmfCtDefQuiescingCompleteTimeout=
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG
immcfg -a saAmfCtDefInstantiationLevel=
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG
immcfg -a saAmfCtDefDisableRestart=
safVersion=4.0.0,safCompType=OpenSafCompTypeAMFWDOG

Patch adds check to prevent CCB modification to null value.

diff --git a/osaf/services/saf/amf/amfd/comptype.cc
b/osaf/services/saf/amf/amfd/comptype.cc
--- a/osaf/services/saf/amf/amfd/comptype.cc
+++ b/osaf/services/saf/amf/amfd/comptype.cc
@@ -587,6 +587,13 @@ static SaAisErrorT ccb_completed_modify_
} else if (strcmp(mod->modAttr.attrName,
"osafAmfCtDefHcCmdArgv") == 0) {
; // Allow modification, no validation can be done
} else if (strcmp(mod->modAttr.attrName,
"saAmfCtDefQuiescingCompleteTimeout") == 0) {
+   if ((mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
+   (mod->modAttr.attrValues ==
nullptr)) {
+   report_ccb_validation_error(opdata,
+   "Value deletion for '%s' is not
supported", mod->modAttr.attrName);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
SaTimeT value = *((SaTimeT
*)mod->modAttr.attrValues[0]);
if (value < 100 * SA_TIME_ONE_MILLISECOND) {
report_ccb_validation_error(opdata,
@@ -595,6 +602,13 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (!strcmp(mod->modAttr.attrName,
"saAmfCtDefInstantiationLevel")) {
+   if ((mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
+   (mod->modAttr.attrValues ==
nullptr)) {
+   report_ccb_validation_error(opdata,
+   "Value deletion for '%s' is not
supported", mod->modAttr.attrName);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
uint32_t num_inst = *((SaUint32T
*)mod->modAttr.attrValues[0]);
if (num_inst == 0) {
report_ccb_validation_error(opdata,
"Modification of saAmfCtDefInstantiationLevel Fail,"
@@ -603,6 +617,13 @@ static SaAisErrorT ccb_completed_modify_
goto done;
}
} else if (strcmp(mod->modAttr.attrName,
"saAmfCtDefRecoveryOnError") == 0) {
+   if ((mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
+   (mod->modAttr.attrValues ==
nullptr)) {
+   report_ccb_validation_error(opdata,
+   "Value deletion for '%s' is not
supported", mod->modAttr.attrName);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
uint32_t value = 

Re: [devel] [PATCH 1 of 1] amfd: change saAmfSIPrefActiveAssignments after adjusting assignments [#1489]

2015-11-18 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen


-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Wednesday, November 18, 2015 12:42 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: change saAmfSIPrefActiveAssignments after
adjusting assignments [#1489]

 osaf/services/saf/amf/amfd/si.cc |  7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


AMFD asserts for following CCB modification:
immcfg -a saAmfSIPrefActiveAssignments= safSi=All-NWayActive,safApp=DemoApp

When AMFD gets CCB apply callback, it is setting
saAmfSIPrefActiveAssignments to its
default value 1 before adjusting assignments.

Patch fixes the problem by setting saAmfSIPrefActiveAssignments only after
adjusting assignments.

diff --git a/osaf/services/saf/amf/amfd/si.cc
b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -1145,10 +1145,11 @@ static void si_ccb_apply_modify_hdlr(Ccb
 
if (!strcmp(attribute->attrName,
"saAmfSIPrefActiveAssignments")) {
 
-   if (value_is_deleted)
-   mod_pref_assignments =
si->saAmfSIPrefActiveAssignments = 1;
-   else
+   if (value_is_deleted) {
+   mod_pref_assignments = 1;
+   } else {
mod_pref_assignments = *((SaUint32T
*)attr_mod->modAttr.attrValues[0]);
+   }
 
if (avd_cb->avail_state_avd != SA_AMF_HA_ACTIVE) {
si->saAmfSIPrefActiveAssignments =
mod_pref_assignments;


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: fix SHUTTING_DOWN state validation during standby AMFD initialization [#1560]

2015-11-17 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Tuesday, November 17, 2015 3:57 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix SHUTTING_DOWN state validation during
standby AMFD initialization [#1560]

 osaf/services/saf/amf/amfd/app.cc |  2 +-
 osaf/services/saf/amf/amfd/cluster.cc |  2 +-
 osaf/services/saf/amf/amfd/include/util.h |  3 ++-
 osaf/services/saf/amf/amfd/node.cc|  2 +-
 osaf/services/saf/amf/amfd/nodegroup.cc   |  2 +-
 osaf/services/saf/amf/amfd/sg.cc  |  2 +-
 osaf/services/saf/amf/amfd/si.cc  |  2 +-
 osaf/services/saf/amf/amfd/su.cc  |  2 +-
 osaf/services/saf/amf/amfd/util.cc|  7 +--
 9 files changed, 14 insertions(+), 10 deletions(-)


AMFD intialization fails for standby controller if any AMF entities is in
SHUTTING_DOWN state.

In the pushed patch for #1560, AMF does not allow creation of AMF entities
in SHUTTING_DOWN
state. Function avd_admin_state_is_valid() must handle both the cases
1)When controller joins the cluster.
2)When a new AMF having admin state entity is configured.
Currently it is handling case 2) only.

Patch fixes the problem for case 1).

diff --git a/osaf/services/saf/amf/amfd/app.cc
b/osaf/services/saf/amf/amfd/app.cc
--- a/osaf/services/saf/amf/amfd/app.cc
+++ b/osaf/services/saf/amf/amfd/app.cc
@@ -190,7 +190,7 @@ static int is_config_valid(const SaNameT
}
 
if
((immutil_getAttr(const_cast("saAmfApplicationAdminState"),
attributes, 0, ) == SA_AIS_OK) &&
-   !avd_admin_state_is_valid(admstate)) {
+   !avd_admin_state_is_valid(admstate, opdata)) {
report_ccb_validation_error(opdata, "Invalid
saAmfApplicationAdminState %u for '%s'", admstate, dn->value);
return 0;
}
diff --git a/osaf/services/saf/amf/amfd/cluster.cc
b/osaf/services/saf/amf/amfd/cluster.cc
--- a/osaf/services/saf/amf/amfd/cluster.cc
+++ b/osaf/services/saf/amf/amfd/cluster.cc
@@ -243,7 +243,7 @@ SaAisErrorT avd_cluster_config_get(void)
avd_cluster->saAmfClusterAdminState = SA_AMF_ADMIN_UNLOCKED;
}
 
-   if (!avd_admin_state_is_valid(avd_cluster->saAmfClusterAdminState))
{
+   if (!avd_admin_state_is_valid(avd_cluster->saAmfClusterAdminState,
nullptr)) {
LOG_ER("Invalid saAmfClusterAdminState %u",
avd_cluster->saAmfClusterAdminState);
return static_cast(-1);
}
diff --git a/osaf/services/saf/amf/amfd/include/util.h
b/osaf/services/saf/amf/amfd/include/util.h
--- a/osaf/services/saf/amf/amfd/include/util.h
+++ b/osaf/services/saf/amf/amfd/include/util.h
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class AVD_SU;
 
@@ -133,7 +134,7 @@ uint32_t avd_d2d_msg_snd(struct cl_cb_ta
 
 std::string to_string(const SaNameT );
 
-extern int avd_admin_state_is_valid(SaAmfAdminStateT state);
+extern int avd_admin_state_is_valid(SaAmfAdminStateT state, const
CcbUtilOperationData_t *opdata);
 extern SaAisErrorT avd_object_name_create(SaNameT *rdn_attr_value, SaNameT
*parentName, SaNameT *object_name);
 int amfd_file_dump(const char* filename);
 
diff --git a/osaf/services/saf/amf/amfd/node.cc
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -253,7 +253,7 @@ static int is_config_valid(const SaNameT
}
 
if
((immutil_getAttr(const_cast("saAmfNodeAdminState"),
attributes, 0, ) == SA_AIS_OK) &&
-   !avd_admin_state_is_valid(admstate)) {
+   !avd_admin_state_is_valid(admstate, opdata)) {
report_ccb_validation_error(opdata, "Invalid
saAmfNodeAdminState %u for '%s'", admstate, dn->value);
return 0;
}
diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -106,7 +106,7 @@ static int is_config_valid(const SaNameT
return 0;
}
//Check if admin state is valid or not.
-   if (!avd_admin_state_is_valid(tmp_ng->saAmfNGAdminState)) {
+   if (!avd_admin_state_is_valid(tmp_ng->saAmfNGAdminState, opdata)) {
LOG_ER("Incorrect saAmfNGAdminState:'%u' for
'%s'",tmp_ng->saAmfNGAdminState,
tmp_ng->name.value);
delete tmp_ng;
diff --git a/osaf/services/saf/amf/amfd/sg.cc
b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -242,7 +242,7 @@ static int is_config_valid(const SaNameT
}
 
if
((immutil_getAttr(const_cast("saAmfSGAdminState"),
attributes, 0, ) == SA_AIS_OK) &&
-   !avd_admin_state_is_valid(admstate)) {
+   !avd_admin_state_is_valid(admstate, 

Re: [devel] [PATCH 1 of 1] amfd: fix amfd crash during node attribute modification [#1591]

2015-11-10 Thread Quyen Dao
Hi Praveen,

Ack (Test only)

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Tuesday, November 10, 2015 5:45 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: fix amfd crash during node attribute
modification [#1591]

 osaf/services/saf/amf/amfd/node.cc |  18 --
 1 files changed, 16 insertions(+), 2 deletions(-)


command immcfg -a saAmfNodeAutoRepair=
safAmfNode=PL-3,safAmfCluster=myAmfCluster
causes AMFD crash.

Patch adds check to prevent CCB modification to null value.

diff --git a/osaf/services/saf/amf/amfd/node.cc
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -598,6 +598,13 @@ static SaAisErrorT node_ccb_completed_mo
} else if (!strcmp(attribute->attrName,
"saAmfNodeSuFailoverMax")) {
/*  No validation needed, avoiding fall-through to
Unknown Attribute error-case */
} else if (!strcmp(attribute->attrName,
"saAmfNodeAutoRepair")) {
+   if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE)
|| (attribute->attrValues == NULL)) {
+   report_ccb_validation_error(opdata,
+   "Invalid saAmfNodeAutoRepair
value for '%s'",
+   opdata->objectName.value);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
uint32_t value = *((SaUint32T
*)attribute->attrValues[0]);
if (value > SA_TRUE) {
report_ccb_validation_error(opdata,
@@ -607,10 +614,17 @@ static SaAisErrorT node_ccb_completed_mo
goto done;
}
} else if (!strcmp(attribute->attrName,
"saAmfNodeFailfastOnTerminationFailure")) {
+   if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE)
|| (attribute->attrValues == NULL)) {
+   report_ccb_validation_error(opdata,
+   "Invalid
saAmfNodeFailfastOnTerminationFailure value for '%s'",
+   opdata->objectName.value);
+   rc = SA_AIS_ERR_BAD_OPERATION;
+   goto done;
+   }
uint32_t value = *((SaUint32T
*)attribute->attrValues[0]);
if (value > SA_TRUE) {
report_ccb_validation_error(opdata,
-   "Invalid
saAmfNodeFailfastOnTerminationFailure '%s'",
+   "Invalid
saAmfNodeFailfastOnTerminationFailure value for %s'",
opdata->objectName.value);
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;
@@ -626,7 +640,7 @@ static SaAisErrorT node_ccb_completed_mo
uint32_t value = *((SaUint32T
*)attribute->attrValues[0]);
if (value > SA_TRUE) {
report_ccb_validation_error(opdata,
-   "Invalid
saAmfNodeFailfastOnInstantiationFailure '%s'",
+   "Invalid
saAmfNodeFailfastOnInstantiationFailure value for '%s'",
opdata->objectName.value);
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 2] amfd: fix SU presence state transition during restart admin op [#1518]

2015-10-22 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Tested 2 patches with the latest changeset (changeset:   7033:e03de11423ca)
on default branch.

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Wednesday, October 21, 2015 7:39 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com;
quyen@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 2] amfd: fix SU presence state transition during
restart admin op [#1518]

 osaf/services/saf/amf/amfd/comp.cc|   10 +
 osaf/services/saf/amf/amfd/include/comp.h |1 +
 osaf/services/saf/amf/amfd/include/su.h   |4 +-
 osaf/services/saf/amf/amfd/ndproc.cc  |   24 ++-
 osaf/services/saf/amf/amfd/su.cc  |   18 ++
 osaf/services/saf/amf/amfnd/clc.cc|5 +-
 osaf/services/saf/amf/amfnd/include/avnd_su.h |2 +
 osaf/services/saf/amf/amfnd/su.cc |   11 +
 osaf/services/saf/amf/amfnd/susm.cc   |  165
+++--
 9 files changed, 186 insertions(+), 54 deletions(-)


Note:Issue is valid for a restartable SU only.

When RESTART operation is invoked on a restartable SU, its presence state
transtions:
INSTANTIATED => RESTARTING => INSTANTIATING => INSTANTIATED.
which is incorrect as per  AIS-AMF-B.04.01-Table 5 Page 74.

At present, when all the components are in RESTARTING state, SU is marked as
RESTARTING.
As soon as AMF starts instantiating first comp by keeping it in RESTARTING
state, AMF is marking SU INSTANTIATING. Here AMF must wait for the
instantiation of component and should not mark SU INSTANTIATING. When first
comp gets successfully instantiated, AMF imust mark first comp INSTANTIATED
and SU will also be marked INSTANTIATED as per AIS-AMF-B.04.01-Table 5 Page
74.

Patch fixes the problem by marking the SU INSTANTIATED as soons as first
component enters into INSTANTIATED state. During the instantiation of other
components, SU will remain in INSTANTIATED state. AMF will reply to IMM for
the operation when all the components enters into INSTATANTIATED state.

diff --git a/osaf/services/saf/amf/amfd/comp.cc
b/osaf/services/saf/amf/amfd/comp.cc
--- a/osaf/services/saf/amf/amfd/comp.cc
+++ b/osaf/services/saf/amf/amfd/comp.cc
@@ -1711,3 +1711,13 @@ SaAisErrorT check_comp_stability(const A
 }
 return SA_AIS_OK;
 }
+/**
+ * @brief  CHeck if component is SA_AWARE. 
+ * @Return true/false.
+ */
+bool AVD_COMP::saaware()
+{
+AVD_COMP_TYPE *comptype =
comptype_db->find(Amf::to_string());
+return (IS_COMP_SAAWARE(comptype->saAmfCtCompCategory));
+}
+
diff --git a/osaf/services/saf/amf/amfd/include/comp.h
b/osaf/services/saf/amf/amfd/include/comp.h
--- a/osaf/services/saf/amf/amfd/include/comp.h
+++ b/osaf/services/saf/amf/amfd/include/comp.h
@@ -125,6 +125,7 @@ class AVD_COMP {
 
   void set_assigned(bool assigned) {assign_flag = assigned;}
   bool assigned() const {return assign_flag;}
+  bool saaware();
  private:
   void initialize();
   // disallow copy and assign
diff --git a/osaf/services/saf/amf/amfd/include/su.h
b/osaf/services/saf/amf/amfd/include/su.h
--- a/osaf/services/saf/amf/amfd/include/su.h
+++ b/osaf/services/saf/amf/amfd/include/su.h
@@ -145,7 +145,9 @@ class AVD_SU {
bool is_any_non_restartable_comp_assigned();
bool all_pi_comps_restartable();
bool all_pi_comps_nonrestartable();
-   
+   SaAmfAdminOperationIdT get_admin_op_id();
+   bool all_comps_in_presence_state(SaAmfPresenceStateT pres);
+
  private:
void initialize();
void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id); diff
--git a/osaf/services/saf/amf/amfd/ndproc.cc
b/osaf/services/saf/amf/amfd/ndproc.cc
--- a/osaf/services/saf/amf/amfd/ndproc.cc
+++ b/osaf/services/saf/amf/amfd/ndproc.cc
@@ -369,20 +369,18 @@ static void surestart_admin_op_report_to
if ((su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_INSTANTIATED) &&
(pres != SA_AMF_PRESENCE_RESTARTING))
rc = SA_AIS_ERR_BAD_OPERATION; 
-   else if ((su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_RESTARTING) &&
-   (pres != SA_AMF_PRESENCE_INSTANTIATING))
-   rc = SA_AIS_ERR_BAD_OPERATION;
-   else if (su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_INSTANTIATING) {
-   if (pres == SA_AMF_PRESENCE_INSTANTIATED)
-   rc = SA_AIS_OK;
+   else if ((su->saAmfSUPresenceState ==
SA_AMF_PRESENCE_RESTARTING) && 
+   (pres != SA_AMF_PRESENCE_INSTANTIATED))
+   rc = SA_AIS_ERR_REPAIR_PENDING; 
+   else if (pres == SA_AMF_PRESENCE_INSTANTIATED) {
+   if
(su->all_comps_in_presence_state(SA_AMF_PRESENCE_INSTANTIATED) == true)
+   rc = SA_AIS_OK;
else
-   rc = 

Re: [devel] [PATCH 1 of 2] amfd: fix SU presence state transition during restart admin op [#1518]

2015-10-21 Thread Quyen Dao
Hi Praveen,

I applied 2 patches on top of changeset:   7019:f378a750ff34. The presence
state transition works correctly during admin SU restart.

BUT the new code change causes the amfnd crash when restarting the NPI comp.

Here are the backtrace and syslog.

Backtrace

(gdb) bt full
#0  0x7fc47f0f1cc9 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
resultvar = 0
pid = 420
selftid = 420
#1  0x7fc47f0f50d8 in __GI_abort () at abort.c:89
save_stage = 2
act = {__sigaction_handler = {sa_handler = 0x13d1ea0, sa_sigaction =
0x13d1ea0}, sa_mask = {__val = {20782752, 6697632, 140481942730071, 5, 0,
6697632, 140481921817896, 1, 6697632, 20773058,
  140481942758677, 0, 0, 140481925715856, 4294967295, 0}},
sa_flags = 0, sa_restorer = 0x13d8050}
sigs = {__val = {32, 0 }}
#2  0x7fc48024ca4e in __osafassert_fail (__file=,
__line=, __func=, __assertion=)
at sysf_def.c:281
No locals.
#3  0x00437f50 in avnd_su_si_oper_done (cb=0x6632a0 <_avnd_cb>,
su=su@entry=0x13cf8a0, si=0x13d1ea0) at susm.cc:1067
curr_si = 0x13d1ea0
curr_csi = 
opr_done = true
__FUNCTION__ = "avnd_su_si_oper_done"
t_csi = 0x0
rc = 1
#4  0x00439119 in npi_su_instantiating_to_instantiated
(su=su@entry=0x13cf8a0) at susm.cc:1585
si = 0x13d1ea0
rc = 1
__FUNCTION__ = "npi_su_instantiating_to_instantiated"
#5  0x004395b0 in avnd_su_pres_inst_compinst_hdler
(cb=cb@entry=0x6632a0 <_avnd_cb>, su=su@entry=0x13cf8a0,
comp=comp@entry=0x13d6200) at susm.cc:3738
curr_csi = 0x0
compname = 0x13d623a
"safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1"
__FUNCTION__ = "avnd_su_pres_inst_compinst_hdler"
curr_comp = 
rc = 1
#6  0x00436734 in avnd_su_pres_fsm_run (cb=cb@entry=0x6632a0
<_avnd_cb>, su=0x13cf8a0, comp=comp@entry=0x13d6200,
ev=ev@entry=AVND_SU_PRES_FSM_EV_COMP_INSTANTIATED) at susm.cc:1517
prv_st = SA_AMF_PRESENCE_INSTANTIATED
final_st = 21
rc = 1
__FUNCTION__ = "avnd_su_pres_fsm_run"
#7  0x00413f90 in avnd_comp_clc_st_chng_prc (cb=cb@entry=0x6632a0
<_avnd_cb>, comp=comp@entry=0x13d6200,
prv_st=prv_st@entry=SA_AMF_PRESENCE_RESTARTING,
final_st=final_st@entry=SA_AMF_PRESENCE_INSTANTIATED) at clc.cc:1357
csi = 
__FUNCTION__ = "avnd_comp_clc_st_chng_prc"
ev = AVND_SU_PRES_FSM_EV_COMP_INSTANTIATED
is_en = 
rc = 
#8  0x0041584f in avnd_comp_clc_fsm_run (cb=cb@entry=0x6632a0
<_avnd_cb>, comp=comp@entry=0x13d6200,
ev=AVND_COMP_CLC_PRES_FSM_EV_INST_SUCC) at clc.cc:894
prv_st = SA_AMF_PRESENCE_RESTARTING
final_st = 
rc = 1
__FUNCTION__ = "avnd_comp_clc_fsm_run"
#9  0x00415e39 in avnd_evt_clc_resp_evh (cb=0x6632a0 <_avnd_cb>,
evt=0x7fc4740008c0) at clc.cc:417
__FUNCTION__ = "avnd_evt_clc_resp_evh"
ev = 
clc_evt = 0x7fc4740008e0
comp = 0x13d6200
rc = 1
#10 0x00429282 in avnd_evt_process (evt=0x7fc4740008c0) at
main.cc:660
cb = 0x6632a0 <_avnd_cb>
rc = 1
#11 avnd_main_process () at main.cc:604
ret = 
fds = {{fd = 11, events = 1, revents = 1}, {fd = 15, events = 1,
revents = 0}, {fd = 13, events = 1, revents = 0}, {fd = 0, events = 0,
revents = 0}}
evt = 0x7fc4740008c0
__FUNCTION__ = "avnd_main_process"
#12 0x0040469c in main (argc=2, argv=0x7ffc927dd938) at main.cc:178
error = 0
(gdb)

syslog
=
Oct 21 14:43:22 PL-3 osafimmnd[394]: NO Ccb 2 COMMITTED (immcfg_SC-1_1107)
Oct 21 14:44:01 PL-3 osafamfnd[420]: NO Assigning
'safSi=AmfDemo,safApp=AmfDemo1' ACTIVE to
'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1'
Oct 21 14:44:01 PL-3 osafamfnd[420]: NO
'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1' Presence State UNINSTANTIATED =>
INSTANTIATING
Oct 21 14:44:01 PL-3 osafamfnd[420]: NO
'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1' Presence State INSTANTIATING =>
INSTANTIATED
Oct 21 14:44:01 PL-3 osafamfnd[420]: NO Assigned
'safSi=AmfDemo,safApp=AmfDemo1' ACTIVE to
'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1'
Oct 21 14:45:30 PL-3 osafamfnd[420]: NO Admin restart requested for
'safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1'
Oct 21 14:45:30 PL-3 osafamfnd[420]: CR current si name
='safSi=AmfDemo,safApp=AmfDemo1'
Oct 21 14:45:30 PL-3 osafamfnd[420]: CR SI: curr_assign_state = 3,
prv_assign_state = 0, curr_state = 1, prv_state = 0
Oct 21 14:45:30 PL-3 osafamfnd[420]: susm.cc:1067: avnd_su_si_oper_done:
Assertion '0' failed.
Oct 21 14:45:30 PL-3 osafclmna[412]: AL AMF Node Director is down, terminate
this process
Oct 21 14:45:30 PL-3 osafamfwd[463]: Rebooting OpenSAF NodeId = 0 EE Name =
No EE Mapped, Reason: AMF unexpectedly crashed, OwnNodeId = 131855,
SupervisionTime = 60

Thanks,
Quyen



-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: 

Re: [devel] [PATCH 1 of 1] amfd: do not assign SUs on locked nodes when ng is deleted. [#1507]

2015-10-15 Thread Quyen Dao
Hi Praveen,

Ack (Test only).

Thanks,
Quyen

Subject: [devel] [PATCH 1 of 1] amfd: do not assign SUs on locked nodes 
when ng is  deleted. [#1507]
Date: Tue, 29 Sep 2015 12:37:07 +0530
From: praveen.malv...@oracle.com
To: hans.nordeb...@ericsson.com, nagendr...@oracle.com,
quyen@dektech.com.au
CC: opensaf-devel@lists.sourceforge.net

  osaf/services/saf/amf/amfd/nodegroup.cc |  44 
++---
  1 files changed, 40 insertions(+), 4 deletions(-)


A nodegroup is deleted in locked state when some of the nodes are kept in
admin unlocked state. Application remains in unassigned state.

In CCB apply for deletion of NG, AMF is going for new assignments on the
nodes of NG which are in locked state.

Patch fixes the problem by calling the assignment logic only for unlocked
nodes in CCB apply for deletion of NG.

diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -568,14 +568,49 @@ static void ng_ccb_apply_modify_hdlr(Ccb
TRACE_LEAVE();
  }

-static void node_ccb_completed_delete_hdlr(CcbUtilOperationData_t *opdata)
+static void ng_ccb_apply_delete_hdlr(CcbUtilOperationData_t *opdata)
  {
TRACE_ENTER();
AVD_AMF_NG *ng = avd_ng_get(>objectName);
+   if (avd_cb->avail_state_avd != SA_AMF_HA_ACTIVE) {
+   //Since AMF will delete NG, clear its pointers in node.
+   for (std::set::const_iterator iter =
ng->saAmfNGNodeList.begin();
+   iter != ng->saAmfNGNodeList.end(); ++iter) {
+   AVD_AVND *node = avd_node_get(*iter);
+   node->admin_ng = NULL;
+   }
+   ng_delete(ng);
+   goto done;
+}
//Temporarily keep NG in UNLOCKED state to assign SUs.
ng->saAmfNGAdminState = SA_AMF_ADMIN_UNLOCKED;  
-   ng_unlock(ng);
-
+   for (std::set::const_iterator iter =
ng->saAmfNGNodeList.begin();
+iter != ng->saAmfNGNodeList.end(); ++iter) {
+AVD_AVND *node = avd_node_get(*iter);
+if ((node->saAmfNodeOperState ==
SA_AMF_OPERATIONAL_DISABLED) ||
+(node->saAmfNodeAdminState !=
SA_AMF_ADMIN_UNLOCKED) ||
+(node->node_info.member == false))
+continue;
+for (const auto& su : node->list_of_su) {
+if (su->is_in_service() == true) {
+ 
su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
+}
+}
+}
+   for (std::set::const_iterator iter =
ng->saAmfNGNodeList.begin();
+   iter != ng->saAmfNGNodeList.end(); ++iter) {
+   AVD_AVND *node = avd_node_get(*iter);
+   if ((node->saAmfNodeOperState ==
SA_AMF_OPERATIONAL_DISABLED) ||
+   (node->node_info.member == false) ||
+   (node->saAmfNodeAdminState !=
SA_AMF_ADMIN_UNLOCKED) ||
+   (avd_cb->init_state == AVD_INIT_DONE))
+   continue;
+   /* This node is capable of assignment. Let the SG semantics
decide which
+  su to choose for assignment.
+*/
+   for (const auto& su : node->list_of_su)
+   su->sg_of_su->su_insvc(avd_cb, su);
+   }
//Since AMF will delete NG, clear its pointers in node.
for (std::set::const_iterator iter = 
ng->saAmfNGNodeList.begin();
iter != ng->saAmfNGNodeList.end(); ++iter) { @@
-584,6 +619,7 @@ static void node_ccb_completed_delete_hd
}
ng->node_oper_list.clear();
ng_delete(ng);
+done:
TRACE_LEAVE2("deleted %s", opdata->objectName.value);
  }
  /**
@@ -606,7 +642,7 @@ static void ng_ccb_apply_cb(CcbUtilOpera
ng_ccb_apply_modify_hdlr(opdata);
break;
case CCBUTIL_DELETE:
-   node_ccb_completed_delete_hdlr(opdata);
+   ng_ccb_apply_delete_hdlr(opdata);
break;
default:
osafassert(0);


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel



--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: fix comp term_failed state alarm [#1473]

2015-09-29 Thread Quyen Dao
Hi Praveen,

Ack (Test only)
 
Thanks,
Quyen

-Original Message-
From: praveen malviya [mailto:praveen.malv...@oracle.com] 
Sent: Monday, September 28, 2015 4:25 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 1 of 1] amfd: fix comp term_failed state alarm
[#1473]

Any update on this patch?

Thanks,
Praveen

On 17-Sep-15 7:06 PM, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/su.cc |  14 +-
>   1 files changed, 13 insertions(+), 1 deletions(-)
>
>
> In the reported problem when component enters into TERM_FAILED state 
> during clean up failure, AMFD raises alarm and clears it immediately.
> In the reported problem saAmfNodeFailfastOnTerminationFailure is set
false.
>
> When component enters term_failed state AMFD raises alrams on it.
> When all components are cleaned up, amfnd sends a su-failover request to
amfd.
> As a part of sufailover request amfd marks all the comps 
> uninstantiated and clears any pending alrams on them. Since 
> saAmfNodeFailfastOnTerminationFailure is false, clearence of alarm should
be done as a part of repair operation on SU.
> Even in the case when saAmfNodeFailfastOnTerminationFailure=1, Alarm 
> should be cleared only when AMFD has detected that node has gone for
reboot.
>
> Patch fixes both the problems.
>
> diff --git a/osaf/services/saf/amf/amfd/su.cc 
> b/osaf/services/saf/amf/amfd/su.cc
> --- a/osaf/services/saf/amf/amfd/su.cc
> +++ b/osaf/services/saf/amf/amfd/su.cc
> @@ -2103,7 +2103,19 @@ void AVD_SU::disable_comps(SaAisErrorT r
>   comp->curr_num_csi_actv = 0;
>   comp->curr_num_csi_stdby = 0;
>   avd_comp_oper_state_set(comp, SA_AMF_OPERATIONAL_DISABLED);
> - avd_comp_pres_state_set(comp,
SA_AMF_PRESENCE_UNINSTANTIATED);
> + if (comp->saAmfCompPresenceState !=
SA_AMF_PRESENCE_TERMINATION_FAILED)
> + avd_comp_pres_state_set(comp,
SA_AMF_PRESENCE_UNINSTANTIATED);
> +
> + /*
> +Mark a term_failed component uninstantiated when node is
rebooted.
> +When node goes for reboot then AMFD marks node absent. If
node does
> +not go for reboot then term_fail state of comp will be
cleared
> +as part of admin repair operation.
> +  */
> + if ((comp->saAmfCompPresenceState ==
SA_AMF_PRESENCE_TERMINATION_FAILED) &&
> + (su_on_node->node_state ==
AVD_AVND_STATE_ABSENT)) {
> + avd_comp_pres_state_set(comp,
SA_AMF_PRESENCE_UNINSTANTIATED);
> + }
>   comp->saAmfCompRestartCount = 0;
>   comp_complete_admin_op(comp, result);
>   m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, comp, 
> AVSV_CKPT_AVD_COMP_CONFIG);
>
> --
>  Monitor Your Dynamic Infrastructure at Any Scale With 
> Datadog!
> Get real-time metrics from all of your servers, apps and tools in one 
> place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140
> ___
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: ignore invalid operations on nodegroup [#1389]

2015-07-13 Thread Quyen Dao
Hi Gary,

Ack from me (Test only)

Regards,
Quyen

-Original Message-
From: Gary Lee [mailto:gary@dektech.com.au] 
Sent: Thursday, July 09, 2015 5:44 PM
To: praveen.malv...@oracle.com; nagendr...@oracle.com;
quyen@dektech.com.au; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] amfd: ignore invalid operations on nodegroup [#1389]

 osaf/services/saf/amf/amfd/nodegroup.cc |  10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


If a lock-in operation is ordered on a nodegroup, only perform this on a
node if the node is in 'locked' state.

diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -972,9 +972,9 @@
AVD_AVND *node = avd_node_get(*iter);
node-su_cnt_admin_oper = 0;
node-admin_ng = ng;
-   node_sus_termstate_set(node, true);
if (node-saAmfNodeAdminState !=
SA_AMF_ADMIN_LOCKED)
continue;
+   node_sus_termstate_set(node, true);
node_admin_state_set(node,
SA_AMF_ADMIN_LOCKED_INSTANTIATION);
}
for (std::setstd::string::const_iterator iter =
ng-saAmfNGNodeList.begin(); @@ -988,6 +988,12 @@
LOG_NO('%s' LOCK_INSTANTIATION: AMF node
oper state disabled, node-name.value);
continue;
}
+   if (node-saAmfNodeAdminState !=
SA_AMF_ADMIN_LOCKED_INSTANTIATION) {
+   // this failed the test above, where we
check 
+   // saAmfNodeAdminState ==
SA_AMF_ADMIN_LOCKED
+   LOG_NO('%s' LOCK_INSTANTIATION: AMF node
admin state is not LOCKED, node-name.value);
+   continue;
+   }
avd_node_admin_lock_instantiation(node);
TRACE(node:'%s', su_cnt_admin_oper:%u,
node-name.value,
node-su_cnt_admin_oper); @@ -1039,9 +1045,9 @@
AVD_AVND *node = avd_node_get(*iter);
node-su_cnt_admin_oper = 0;
node-admin_ng = ng;
-   node_sus_termstate_set(node, false);  
if (node-saAmfNodeAdminState !=
SA_AMF_ADMIN_LOCKED_INSTANTIATION)
continue;
+   node_sus_termstate_set(node, false);
node_admin_state_set(node, SA_AMF_ADMIN_LOCKED);
}
ng_admin_unlock_inst(ng);


--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: ignore unlocked node during unlock-in op on ng [#1389]

2015-06-26 Thread Quyen Dao
Hi Praveen,

I applied your patch on top of latest changeset 6631:593bc933f80c on default
branch and tried to verify
by following steps:

1. Start cluster
2. Load the NWayActive model (AppConfig-nwayactive.xml) and unlock-in then
unlock all the SUs
3. Create a node group containing PL-3 and PL-4 with admin state as
LOCKED-INSTANTIATION
4. lock then lock-in PL-4 - admin state of PL4 is LOCKED-INSTANTIATION, PL3
is UNLOCKED
5. unlock-in node group
The result is expected i.e PL-4 is LOCKED and PL-3 remains UNLOCKED

But If I do 1 more step i.e 6. lock-in node group, PL-3 gets rebooted. 
Not sure if this fault has any relation with the patch, please have a look.

Syslog

Jun 26 14:19:14 PL-3 osafamfnd[419]: NO
'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo2' component restart probation timer
stopped
Jun 26 14:19:14 PL-3 osafamfnd[419]: susm.cc:1253: avnd_evt_avd_su_pres_evh:
Assertion '!m_NCS_DBLIST_FIND_FIRST(su-si_list)' failed.
Jun 26 14:19:14 PL-3 amf_demo[719]: AL AMF Node Director is down, terminate
this process
Jun 26 14:19:14 PL-3 amf_demo[719]: exiting (caught term signal)
Jun 26 14:19:14 PL-3 osafclmna[410]: AL AMF Node Director is down, terminate
this process
Jun 26 14:19:14 PL-3 osafamfwd[463]: Rebooting OpenSAF NodeId = 0 EE Name =
No EE Mapped, Reason: AMF unexpectedly crashed, OwnNodeId = 131855,
SupervisionTime = 60
Jun 26 14:19:14 PL-3 osafckptnd[454]: AL AMF Node Director is down,
terminate this process
Jun 26 14:19:14 PL-3 osafimmnd[398]: AL AMF Node Director is down, terminate
this process

Backtrace

(gdb) bt full
#0  0x7fbc66b9fcc9 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
resultvar = 0
pid = 419
selftid = 419
#1  0x7fbc66ba30d8 in __GI_abort () at abort.c:89
save_stage = 2
act = {__sigaction_handler = {sa_handler = 0x449bc4, sa_sigaction =
0x449bc4}, sa_mask = {__val = {140728344390272, 6685344, 140447174767959, 5,
0, 6685344, 140447153847592, 39287648, 
  6685344, 140447041203168, 140447174796565, 1,
18446744073709551615, 0, 0, 140447157745504}}, sa_flags = 0, sa_restorer =
0x0}
sigs = {__val = {32, 0 repeats 15 times}}
#2  0x7fbc67cfae7e in __osafassert_fail (__file=optimized out,
__line=optimized out, __func=optimized out, __assertion=optimized out)
at sysf_def.c:281
No locals.
#3  0x00437bc6 in avnd_evt_avd_su_pres_evh (cb=0x6602a0 _avnd_cb,
evt=optimized out) at susm.cc:1253
info = 0x7fbc60002be8
su = 0x2577b60
rc = 1
__FUNCTION__ = avnd_evt_avd_su_pres_evh
#4  0x004287e2 in avnd_evt_process (evt=0x7fbc60006d10) at
main.cc:660
cb = 0x6602a0 _avnd_cb
rc = 1
#5  avnd_main_process () at main.cc:604
ret = optimized out
fds = {{fd = 10, events = 1, revents = 1}, {fd = 14, events = 1,
revents = 0}, {fd = 12, events = 1, revents = 0}, {fd = 0, events = 0,
revents = 0}}
evt = 0x7fbc60006d10
__FUNCTION__ = avnd_main_process
#6  0x0040469c in main (argc=1, argv=0x7ffddefa2be8) at main.cc:178
error = 0
(gdb)

Thanks,
Quyen

-Original Message-
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Wednesday, June 24, 2015 12:23 PM
To: hans.nordeb...@ericsson.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1 of 1] amfd: ignore unlocked node during unlock-in
op on ng [#1389]

 osaf/services/saf/amf/amfd/include/node.h |   1 +
 osaf/services/saf/amf/amfd/node.cc|  24 
 osaf/services/saf/amf/amfd/nodegroup.cc   |   4 
 osaf/services/saf/amf/amfd/sgproc.cc  |   6 --
 4 files changed, 33 insertions(+), 2 deletions(-)


Create a nodegroup in locked-in state while all of its nodes are in unlocked
state. Now if unlock-in operation is performed on the nodegroup then, nodes
state will be updated as LOCKED.

AMF should ignore those nodes which are in unlocked state while performing
unlock-in operation on nodegroup. At the same time if unlock-in admin
operation is performed on a node in lockied-in state and its nodegroup in
lock-in state, then AMF should not instantiate any SU on this node.

Patch fixes both the problems by including checks on node admin states and
nodegroup admin state.

diff --git a/osaf/services/saf/amf/amfd/include/node.h
b/osaf/services/saf/amf/amfd/include/node.h
--- a/osaf/services/saf/amf/amfd/include/node.h
+++ b/osaf/services/saf/amf/amfd/include/node.h
@@ -238,4 +238,5 @@ extern void avd_nodeswbundle_constructor  extern void
ng_complete_admin_op(AVD_AMF_NG *ng, SaAisErrorT result);  extern void
avd_ng_admin_state_set(AVD_AMF_NG* ng, SaAmfAdminStateT state);  extern bool
are_all_ngs_in_unlocked_state(const AVD_AVND *node);
+extern bool any_ng_in_locked_in_state(const AVD_AVND *node);
 #endif
diff --git a/osaf/services/saf/amf/amfd/node.cc
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++