Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
The container registry cleanup task is now completed and the registry can be used normally.
Open sidebar
dcdb
dcdb
Commits
0d3ebfb8
Commit
0d3ebfb8
authored
Sep 27, 2019
by
Michael Ott
Browse files
Override IPMISensorGroup::nextReadingTime() to account for xcc pecularities
parent
26383821
Changes
4
Hide whitespace changes
Inline
Side-by-side
dcdbpusher/sensors/ipmi/IPMIConfigurator.cpp
View file @
0d3ebfb8
...
...
@@ -43,6 +43,19 @@ IPMIConfigurator::IPMIConfigurator() {
IPMIConfigurator
::~
IPMIConfigurator
()
{}
bool
IPMIConfigurator
::
readConfig
(
std
::
string
cfgPath
)
{
if
(
ConfiguratorTemplate
<
IPMISensorBase
,
IPMISensorGroup
,
IPMIHost
>::
readConfig
(
cfgPath
))
{
for
(
auto
&
g
:
_sensorGroups
)
{
if
(
!
g
->
checkConfig
())
{
return
false
;
}
}
return
true
;
}
else
{
return
false
;
}
}
void
IPMIConfigurator
::
sensorBase
(
IPMISensorBase
&
s
,
CFG_VAL
config
)
{
ADD
{
ATTRIBUTE
(
"cmd"
,
setRawCmd
);
...
...
dcdbpusher/sensors/ipmi/IPMIConfigurator.h
View file @
0d3ebfb8
...
...
@@ -48,6 +48,7 @@ class IPMIConfigurator: public ConfiguratorTemplate<IPMISensorBase, IPMISensorGr
public:
IPMIConfigurator
();
virtual
~
IPMIConfigurator
();
bool
readConfig
(
std
::
string
cfgPath
)
override
;
protected:
/* Overwritten from ConfiguratorTemplate */
...
...
dcdbpusher/sensors/ipmi/IPMISensorGroup.cpp
View file @
0d3ebfb8
...
...
@@ -147,3 +147,32 @@ void IPMISensorGroup::read() {
}
}
}
uint64_t
IPMISensorGroup
::
nextReadingTime
()
{
if
((
_sensors
.
size
()
==
1
)
&&
(
_sensors
.
front
()
->
getType
()
==
IPMISensorBase
::
sensorType
::
xcc
))
{
reading_t
r
=
_sensors
.
front
()
->
getLatestValue
();
uint64_t
now
=
getTimestamp
();
if
(
r
.
timestamp
<
now
-
S_TO_NS
(
35
))
{
// There was no reading yet or it is too old, so schedule next in 30s
return
now
+
S_TO_NS
(
30
);
}
else
{
// The first reading of the next 30s block is 10ms after the last reading in the current block.
// A block becomes available 30s after its first reading, adding 2s grace period
return
r
.
timestamp
+
MS_TO_NS
(
32010
);
}
}
return
SensorGroupInterface
::
nextReadingTime
();
}
bool
IPMISensorGroup
::
checkConfig
()
{
if
(
_sensors
.
size
()
>
1
)
{
for
(
const
auto
&
s
:
_sensors
)
{
if
(
s
->
getType
()
==
IPMISensorBase
::
sensorType
::
xcc
)
{
LOG
(
error
)
<<
_groupName
<<
" contains an XCC sensor among others, this is not possible"
;
return
false
;
}
}
}
return
true
;
}
dcdbpusher/sensors/ipmi/IPMISensorGroup.h
View file @
0d3ebfb8
...
...
@@ -43,6 +43,8 @@ public:
IPMISensorGroup
(
const
IPMISensorGroup
&
other
);
virtual
~
IPMISensorGroup
();
IPMISensorGroup
&
operator
=
(
const
IPMISensorGroup
&
other
);
uint64_t
nextReadingTime
();
bool
checkConfig
();
private:
void
read
()
final
override
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment