Commit 268c847c authored by Claes's avatar Claes Committed by Esteban Blanc

Alias node works for sev, and 'localnode' can be used in SevHistThread.ServerNode

parent cb1522c1
...@@ -100,8 +100,10 @@ int sev_server::init(int noneth) ...@@ -100,8 +100,10 @@ int sev_server::init(int noneth)
if (!m_noneth) { if (!m_noneth) {
// Check server config object // Check server config object
pwr_tOid conf_oid; pwr_tOid conf_oid;
pwr_sNode *np;
pwr_tOid node_oid;
sts = gdh_Init("sev_server"); m_sts = gdh_Init("sev_server");
if (EVEN(m_sts)) if (EVEN(m_sts))
throw co_error(m_sts); throw co_error(m_sts);
...@@ -121,6 +123,19 @@ int sev_server::init(int noneth) ...@@ -121,6 +123,19 @@ int sev_server::init(int noneth)
memset(m_config->ServerThreads, 0, sizeof(m_config->ServerThreads)); memset(m_config->ServerThreads, 0, sizeof(m_config->ServerThreads));
if (!m_config->GarbageInterval) if (!m_config->GarbageInterval)
m_config->GarbageInterval = sev_cGarbageInterval; m_config->GarbageInterval = sev_cGarbageInterval;
sts = gdh_GetNodeObject(0, &node_oid);
if (EVEN(sts)) {
errh_CErrLog(PWR__SRVNOTCONF, 0);
exit(0);
}
sts = gdh_ObjidToPointer(node_oid, (void **)&np);
if (EVEN(sts)) {
errh_CErrLog(PWR__SRVNOTCONF, 0);
exit(0);
}
sev_db::set_orignode(np->OrigName);
} else { } else {
// Read config from proview.cnf // Read config from proview.cnf
static pwr_sClass_SevServer config; static pwr_sClass_SevServer config;
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include "sev_dbsqlite.h" #include "sev_dbsqlite.h"
#include "sev_dbhdf5.h" #include "sev_dbhdf5.h"
char sev_db::m_orignode[80] = "";
sev_attr::sev_attr() : type(pwr_eType_), size(0), elem(0), ip(0), refid(pwr_cNRefId) sev_attr::sev_attr() : type(pwr_eType_), size(0), elem(0), ip(0), refid(pwr_cNRefId)
{ {
strcpy(aname, ""); strcpy(aname, "");
...@@ -105,6 +107,7 @@ sev_item::~sev_item() ...@@ -105,6 +107,7 @@ sev_item::~sev_item()
sev_db::sev_db() : m_meanvalue_interval1(0), m_meanvalue_interval2(0) sev_db::sev_db() : m_meanvalue_interval1(0), m_meanvalue_interval2(0)
{ {
strcpy(m_orignode, "");
} }
sev_db::~sev_db() sev_db::~sev_db()
......
...@@ -166,6 +166,7 @@ public: ...@@ -166,6 +166,7 @@ public:
float m_meanvalue_interval1; float m_meanvalue_interval1;
float m_meanvalue_interval2; float m_meanvalue_interval2;
sev_sDbConfig m_cnf; sev_sDbConfig m_cnf;
static char m_orignode[80];
sev_db(); sev_db();
virtual ~sev_db(); virtual ~sev_db();
...@@ -174,6 +175,8 @@ public: ...@@ -174,6 +175,8 @@ public:
pwr_tStatus tree_update_value(int item_idx, int attr_idx, pwr_tTime time, void* buf); pwr_tStatus tree_update_value(int item_idx, int attr_idx, pwr_tTime time, void* buf);
void get_item_idx(pwr_tStatus* sts, unsigned int* item_idx, pwr_tOid oid, void get_item_idx(pwr_tStatus* sts, unsigned int* item_idx, pwr_tOid oid,
char* attributename); char* attributename);
static void set_orignode(char *node) {strncpy(m_orignode, node, sizeof(m_orignode));}
static void get_orignode(char *node) {strcpy(node, m_orignode);}
virtual int check_item(pwr_tStatus* sts, pwr_tOid oid, char* oname, virtual int check_item(pwr_tStatus* sts, pwr_tOid oid, char* oname,
char* aname, pwr_tDeltaTime storatetime, pwr_eType type, char* aname, pwr_tDeltaTime storatetime, pwr_eType type,
......
...@@ -846,7 +846,7 @@ int sev_dbms_env::get_systemname() ...@@ -846,7 +846,7 @@ int sev_dbms_env::get_systemname()
{ {
FILE* file; FILE* file;
pwr_tFileName fname; pwr_tFileName fname;
char nodename[40]; char nodename[80];
char* bus_str; char* bus_str;
int bus; int bus;
char line[200]; char line[200];
...@@ -855,10 +855,12 @@ int sev_dbms_env::get_systemname() ...@@ -855,10 +855,12 @@ int sev_dbms_env::get_systemname()
if (!streq(m_systemName, "")) if (!streq(m_systemName, ""))
return 1; return 1;
syi_NodeName(&sts, nodename, sizeof(nodename)); sev_db::get_orignode(nodename);
if (EVEN(sts)) if (streq(nodename, "")) {
return 0; syi_NodeName(&sts, nodename, sizeof(nodename));
if (EVEN(sts))
return 0;
}
bus_str = getenv("PWR_BUS_ID"); bus_str = getenv("PWR_BUS_ID");
if (!bus_str) if (!bus_str)
return 0; return 0;
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "co_error.h" #include "co_error.h"
#include "co_string.h" #include "co_string.h"
#include "co_time.h" #include "co_time.h"
#include "co_syi.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_qcom_msg.h" #include "rt_qcom_msg.h"
...@@ -56,6 +57,8 @@ ...@@ -56,6 +57,8 @@
#include "rt_sev_msg.h" #include "rt_sev_msg.h"
#include "rt_pwr_msg.h" #include "rt_pwr_msg.h"
static int plog = 1;
#define evbuf_next_idx(idx) \ #define evbuf_next_idx(idx) \
idx++; \ idx++; \
if (idx >= sizeof(event_buffer) / sizeof(event_buffer[0])) \ if (idx >= sizeof(event_buffer) / sizeof(event_buffer[0])) \
...@@ -146,6 +149,8 @@ int rt_sevhistmon::init() ...@@ -146,6 +149,8 @@ int rt_sevhistmon::init()
for (nid = qcom_cNNid; qcom_NextNode(&sts, &node, nid); nid = node.nid) { for (nid = qcom_cNNid; qcom_NextNode(&sts, &node, nid); nid = node.nid) {
sev_node n; sev_node n;
if (node.nid == m_nodes[0].nid)
continue;
n.nid = node.nid; n.nid = node.nid;
strncpy(n.name, node.name, sizeof(n.name)); strncpy(n.name, node.name, sizeof(n.name));
...@@ -191,6 +196,9 @@ int rt_sevhistmon::init_objects() ...@@ -191,6 +196,9 @@ int rt_sevhistmon::init_objects()
hs.oid = hs_oid; hs.oid = hs_oid;
hs.scantime = hs.threadp->ScanTime; hs.scantime = hs.threadp->ScanTime;
strncpy(hs.nodename, hs.threadp->ServerNode, sizeof(hs.nodename)); strncpy(hs.nodename, hs.threadp->ServerNode, sizeof(hs.nodename));
if (strcmp(hs.nodename, "localhost") == 0)
syi_NodeName(&m_sts, hs.nodename, sizeof(hs.nodename));
hs.threadp->NoOfItems = 0;
hs.size = 0; hs.size = 0;
bool found = false; bool found = false;
...@@ -1052,6 +1060,9 @@ bool rt_sevhistmon::send_connect(pwr_tNid nid, pwr_tStatus* sts) ...@@ -1052,6 +1060,9 @@ bool rt_sevhistmon::send_connect(pwr_tNid nid, pwr_tStatus* sts)
qcom_sPut put; qcom_sPut put;
pwr_tStatus lsts; pwr_tStatus lsts;
if (plog)
printf("rt_sevhistmon: Send connect %d\n", nid);
tgt.nid = nid; tgt.nid = nid;
tgt.qix = sev_eProcSevServer; tgt.qix = sev_eProcSevServer;
...@@ -1887,14 +1898,18 @@ int rt_sevhistmon::mainloop() ...@@ -1887,14 +1898,18 @@ int rt_sevhistmon::mainloop()
case sev_cMsgClass: case sev_cMsgClass:
switch ((int)get.type.s) { switch ((int)get.type.s) {
case sev_eMsgType_NodeUp: case sev_eMsgType_NodeUp:
printf("rt_sevhistmon: Node up received\n"); if (plog)
printf("rt_sevhistmon: Node up received\n");
send_itemlist(get.sender.nid); send_itemlist(get.sender.nid);
break; break;
case sev_eMsgType_ExportNodeUp: case sev_eMsgType_ExportNodeUp:
printf("rt_sevhistmon: Export node up received\n"); if (plog)
printf("rt_sevhistmon: Export node up received\n");
send_exportitemlist(get.sender.nid); send_exportitemlist(get.sender.nid);
break; break;
case sev_eMsgType_HistItemsRequest: case sev_eMsgType_HistItemsRequest:
if (plog)
printf("rt_sevhistmon: Export histitems request received\n");
send_itemlist(get.sender.nid); send_itemlist(get.sender.nid);
break; break;
case sev_eMsgType_ExportItemsRequest: case sev_eMsgType_ExportItemsRequest:
......
...@@ -1066,6 +1066,7 @@ struct pwr_s_Node { ...@@ -1066,6 +1066,7 @@ struct pwr_s_Node {
pwr_tBoolean EmergBreakTrue pwr_dAlignW; pwr_tBoolean EmergBreakTrue pwr_dAlignW;
pwr_tUInt32 EmergBreakSelect pwr_dAlignW; pwr_tUInt32 EmergBreakSelect pwr_dAlignW;
pwr_tRedundancyStateEnum RedundancyState pwr_dAlignW; pwr_tRedundancyStateEnum RedundancyState pwr_dAlignW;
pwr_tString80 OrigName pwr_dAlignW;
}; };
#define pwr_mAppl_PLC 1 /* This is the PLC program */ #define pwr_mAppl_PLC 1 /* This is the PLC program */
......
...@@ -1501,6 +1501,7 @@ pwr_tBoolean ini_BuildNode(pwr_tStatus* status, ini_sContext* cp) ...@@ -1501,6 +1501,7 @@ pwr_tBoolean ini_BuildNode(pwr_tStatus* status, ini_sContext* cp)
create_active_io(); create_active_io();
strncpy(cp->np->OrigName, cp->origname, sizeof(cp->np->OrigName));
return ODD(*sts); return ODD(*sts);
} }
......
...@@ -51,7 +51,7 @@ SObject pwrb:Class ...@@ -51,7 +51,7 @@ SObject pwrb:Class
! @b See also ! @b See also
! @classlink SevHist pwrb_sevhist.html ! @classlink SevHist pwrb_sevhist.html
! @classlink SevHistMonitor pwrb_sevhistmonitor.html ! @classlink SevHistMonitor pwrb_sevhistmonitor.html
! @classlink SevHistServer pwrb_sevhistserver.html ! @classlink SevServer pwrb_sevserver.html
!*/ !*/
Object SevHistThread $ClassDef 107 Object SevHistThread $ClassDef 107
Body SysBody Body SysBody
...@@ -73,6 +73,7 @@ SObject pwrb:Class ...@@ -73,6 +73,7 @@ SObject pwrb:Class
!/** !/**
! The name of the node where the data is stored. ! The name of the node where the data is stored.
! The SevHistServer has to be started on this node. ! The SevHistServer has to be started on this node.
! 'localnode' denotes the server on the local node.
!*/ !*/
Object ServerNode $Attribute 2 Object ServerNode $Attribute 2
Body SysBody Body SysBody
......
...@@ -296,6 +296,16 @@ SObject pwrs:Class ...@@ -296,6 +296,16 @@ SObject pwrs:Class
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
EndBody EndBody
EndObject EndObject
!/**
! Original node name if alias name is used.
!*/
Object OrigName $Attribute 27
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject EndObject
Object Template $Node Object Template $Node
Body SysBody Body SysBody
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment