ACK.
-----Original Message-----
From: Thien Minh Huynh <[email protected]>
Sent: Friday, December 29, 2023 1:51 PM
To: Thang Duc Nguyen <[email protected]>; Dat Tran Quoc Phan
<[email protected]>
Cc: [email protected]; Thien Minh Huynh
<[email protected]>
Subject: [PATCH 1/1] amf: check the existing sg before create new one [#3345]
When IMM is restarted, AMF will be re-initialized.
AMF constantly adds fresh entries to the local database.
So while delete an app, it always leaves one more sg in the database.
As a consequence of this, the assertion 'app->list_of_sg == nullptr' failed.
The solution is to check for existing sg before creating new one.
---
src/amf/amfd/sg.cc | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/amf/amfd/sg.cc b/src/amf/amfd/sg.cc index 6ed585c49..ee6d00ca8
100644
--- a/src/amf/amfd/sg.cc
+++ b/src/amf/amfd/sg.cc
@@ -274,14 +274,20 @@ static AVD_SG *sg_create(const std::string &sg_name,
TRACE_ENTER2("'%s'", sg_name.c_str());
- SaNameT sgtype_dn;
- error = immutil_getAttr("saAmfSGType", attributes, 0, &sgtype_dn);
- osafassert(error == SA_AIS_OK);
- sgt = sgtype_db->find(Amf::to_string(&sgtype_dn));
- osafassert(sgt);
- sg = sg_new(sg_name, sgt->saAmfSgtRedundancyModel);
- sg->saAmfSGType = Amf::to_string(&sgtype_dn);
- sg->sg_type = sgt;
+ sg = sg_db->find(sg_name);
+ if (sg == nullptr) {
+ SaNameT sgtype_dn;
+ error = immutil_getAttr("saAmfSGType", attributes, 0, &sgtype_dn);
+ osafassert(error == SA_AIS_OK);
+ sgt = sgtype_db->find(Amf::to_string(&sgtype_dn));
+ osafassert(sgt);
+ sg = sg_new(sg_name, sgt->saAmfSgtRedundancyModel);
+ sg->saAmfSGType = Amf::to_string(&sgtype_dn);
+ sg->sg_type = sgt;
+ } else {
+ TRACE("already created, refreshing config...");
+ sgt = sg->sg_type;
+ }
if (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfSGSuHostNodeGroup"),
attributes, 0, &temp_name) == SA_AIS_OK) {
--
2.40.1
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel