On diskless SN, the nodes file of goconserver is missing when
reinstalling. This patch add a column in nodehm table to help
recover the console information on service node.
```
[root@c910f03c09k04 ~]# makegocons -q
NODE SERVER STATE
c910f03c09k05 c910f03c09k04.pok.stglabs.ibm.com error
node-7912ac1-06vag36 c910f03c09k04.pok.stglabs.ibm.com error
NODE SERVER STATE
c910f03c09k04 c910f03c09k03.pok.stglabs.ibm.com connected
[root@c910f03c09k04 ~]# rm /var/lib/goconserver/*
rm: remove regular file ‘/var/lib/goconserver/nodes.json’? y
rm: remove regular file ‘/var/lib/goconserver/nodes.json.bak’? y
[root@c910f03c09k04 ~]# service xcatd restart
Restarting xcatd (via systemctl): [ OK ]
[root@c910f03c09k04 ~]# makegocons -q
NODE SERVER STATE
c910f03c09k05 c910f03c09k04.pok.stglabs.ibm.com error
node-7912ac1-06vag36 c910f03c09k04.pok.stglabs.ibm.com error
NODE SERVER STATE
c910f03c09k04 c910f03c09k03.pok.stglabs.ibm.com connected
```
- for diskful, it will be set when leaving 'booting' stage
- for diskless, it will be set when leaving 'netbooting' stage
- for diskful reboot, it will set when (site.runpostscript=1)
- modify the document accordingly
- also modify GlobalDef.pm, but it won't have impact as the status will not be in nodeset operation.
This commit add descritpion for `dbtracelevel` entry in site table
to help the user find the detail solution if the log is lost due
to the issue from rsyslog side.
partial-issue: #3910
a2idx: Turns an ASCII character into an index (a=1, b=2, etc)
a2zidx: Turns an ASCII character into a 0-index (a=0, b=1, etc)
dim2idx: Turns dimensions (eg row, column, rack-unit) into an index
skip: Return an index where some items are 'skipped'
ipadd: Add a value to an IP address
This patch add trace log for the db access. Currently support
5 log levels:
- 0: disable the trace log for db.
- 1: trace the calls of database subroutines.
- 2: trace the event to build the cache for the table
- 3: trace the event with cache hit
- 4: trace the SQL statement
implement-feature: #3612
Output example from xcat/cluster.log:
···
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end","elapsed":"0.00176s"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"start"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"value\" = ? AND \"comments\" = ? AND \"disable\" = ? AND \"key\" = ?","table":"site","method":"xCAT::Table::setAttribs"},"type":"start_sql"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end_sql","elapsed":"0.00043s"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"INSERT INTO site (\"value\",\"comments\",\"key\",\"disable\") VALUES (?,?,?,?)","table":"site","method":"xCAT::Table::setAttribs"},"type":"start_sql"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"INSERT INTO site (\"value\",\"comments\",\"key\",\"disable\") VALUES (?,?,?,?)","table":"site","method":"xCAT::Table::setAttribs"},"type":"end_sql","elapsed":"0.00043s"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end","elapsed":"0.00171s"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"start"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"key\" = ? and (\"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO'))","table":"site","method":"xCAT::Table::getAttribs"},"type":"start_sql"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"end_sql","elapsed":"0.00061s"}
Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"end","elapsed":"0.00125s"}
Aug 9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAllAttribs"},"type":"start"}
Aug 9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO')","table":"site","method":"xCAT::Table::getAllAttribs"},"type":"start_sql"}
Aug 9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO')","table":"site","method":"xCAT::Table::getAllAttribs"},"type":"end_sql","elapsed":"0.00080s"}
···
2, handle 'disjoint' in preprocess method, to make sure that no request will be sent to SN which does not manage the nodes.
3, refine 'stat' to make sure it could query unmanaged nodes on-demand.