osaf/services/saf/amf/amfd/imm.cc         |   9 ++++++++-
 osaf/services/saf/amf/amfd/include/util.h |   1 +
 osaf/services/saf/amf/amfd/util.cc        |  22 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletions(-)


Use command immadm -a safAmfService -o 100 safAmfService to order cluster reboot

diff --git a/osaf/services/saf/amf/amfd/imm.cc 
b/osaf/services/saf/amf/amfd/imm.cc
--- a/osaf/services/saf/amf/amfd/imm.cc
+++ b/osaf/services/saf/amf/amfd/imm.cc
@@ -722,7 +722,14 @@ static void admin_operation_cb(SaImmOiHa
                        else
                                report_admin_op_error(immoi_handle, invocation,
                                        SA_AIS_ERR_INVALID_PARAM, nullptr,      
"%s", strerror(rc));
-               } else
+               } else if (op_id == 100) {
+                  LOG_WA("Cluster reboot requested. Ordering cluster reboot");
+                    avd_d2n_snd_reboot_req_msg();
+                   for (;;) {
+                       LOG_WA("Waiting for reboot");
+                       sleep(1);
+                   }
+                } else
                        report_admin_op_error(immoi_handle, invocation, 
SA_AIS_ERR_INVALID_PARAM, nullptr,
                                "Admin operation not supported for %s (%u)", 
object_name.c_str(), type);
                goto done;
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
@@ -89,6 +89,7 @@ uint32_t avd_snd_pg_upd_msg(struct cl_cb
                                  SaAmfProtectionGroupChangesT, const 
std::string&);
 uint32_t avd_snd_comp_validation_resp(struct cl_cb_tag *cb, AVD_AVND *avnd,
                                            AVD_COMP *comp_ptr, AVD_DND_MSG 
*n2d_msg);
+void avd_d2n_snd_reboot_req_msg();
 std::string to_string(const SaNameT &s);
 extern int avd_admin_state_is_valid(SaAmfAdminStateT state, const 
CcbUtilOperationData_t *opdata);
 extern SaAisErrorT avd_object_name_create(const std::string& rdn_attr_value, 
const std::string& parentName, const std::string& object_name);
diff --git a/osaf/services/saf/amf/amfd/util.cc 
b/osaf/services/saf/amf/amfd/util.cc
--- a/osaf/services/saf/amf/amfd/util.cc
+++ b/osaf/services/saf/amf/amfd/util.cc
@@ -2065,3 +2065,25 @@ uint32_t avd_snd_compcsi_msg(AVD_COMP *c
   return NCSCC_RC_SUCCESS;
 }
 
+/**
+ * Broadcasts a reboot request to all amf node directors.
+ * Use broadcast as adests may not be available at the time of reboot
+ * request.
+ */
+void avd_d2n_snd_reboot_req_msg() {
+  TRACE_ENTER();
+
+  AVD_DND_MSG *reboot_req_msg = new AVSV_DND_MSG();
+
+  /* prepare the reboot request message. */
+  reboot_req_msg->msg_type = AVSV_D2N_REBOOT_MSG;
+  reboot_req_msg->msg_info.d2n_reboot_info.msg_id = 0;
+
+  /* Broadcast the operation request message to all the nodes. */
+  avd_d2n_msg_bcast(avd_cb, reboot_req_msg);
+
+  delete reboot_req_msg;
+
+  TRACE_LEAVE();
+}
+

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

Reply via email to