osaf/services/saf/amf/amfnd/compdb.cc           |  15 +++++++++++----
 osaf/services/saf/amf/amfnd/include/avnd_util.h |   7 +++++++
 2 files changed, 18 insertions(+), 4 deletions(-)


An upgrade campaign may 'change' saAmfCompType of IMMND to the same
version, forcing comp->config_is_valid to be set to 0.

If the nodes are not rebooted as part of the campaign,
and immnd is later restarted for whatever reason, the restart will fail as 
amfnd is trying to
refresh immnd's config when immnd is down.

If no version change actually occurs, we don't need to touch config_is_valid.

diff --git a/osaf/services/saf/amf/amfnd/compdb.cc 
b/osaf/services/saf/amf/amfnd/compdb.cc
--- a/osaf/services/saf/amf/amfnd/compdb.cc
+++ b/osaf/services/saf/amf/amfnd/compdb.cc
@@ -816,15 +816,22 @@
                                break;
                        }
                        case saAmfCompType_ID: {
-                               comp->saAmfCompType = param->name_sec;
                                /* 
                                ** Indicate that comp config is no longer valid 
and have to be
                                ** refreshed from IMM. We cannot refresh here 
since it is probably
                                ** not yet in IMM.
                                */
-                               comp->config_is_valid = 0;
-                               LOG_NO("saAmfCompType changed to '%s' for '%s'",
-                                       comp->saAmfCompType.value, 
comp->name.value);
+                               const std::string 
oldType(Amf::to_string(&comp->saAmfCompType));
+                               if 
(oldType.compare(Amf::to_string(&param->name_sec)) != 0) {
+                                       // only trigger a reload if the type 
has changed
+                                       comp->saAmfCompType = param->name_sec;
+                                       comp->config_is_valid = 0;
+                                       LOG_NO("saAmfCompType changed to '%s' 
for '%s'",
+                                               comp->saAmfCompType.value, 
comp->name.value);
+                               } else {
+                                       LOG_NO("saAmfCompType '%s' unchanged 
for '%s'",
+                                               comp->saAmfCompType.value, 
comp->name.value);
+                               }
                                break;
                        }
                        default:
diff --git a/osaf/services/saf/amf/amfnd/include/avnd_util.h 
b/osaf/services/saf/amf/amfnd/include/avnd_util.h
--- a/osaf/services/saf/amf/amfnd/include/avnd_util.h
+++ b/osaf/services/saf/amf/amfnd/include/avnd_util.h
@@ -37,6 +37,13 @@
 extern const char *presence_state[];
 extern const char *ha_state[];
 
+class Amf {
+public:
+  static std::string to_string(const SaNameT *name) {
+          return std::string((char*)name->value, name->length);
+  }
+};
+
 void avnd_msg_content_free(struct avnd_cb_tag *, AVND_MSG *);
 
 uint32_t avnd_msg_copy(struct avnd_cb_tag *, AVND_MSG *, AVND_MSG *);

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to