The ProcFsStat type uses values which need to be scaled by
it, so it makes sense to have this be public.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
See the following kernel code snippet from
kernel/sched/cputime.c's account_guest_time():
/* Add guest time to cpustat. */
if (task_nice(p) > 0) {
cpustat[CPUTIME_NICE] += cputime;
cpustat[CPUTIME_GUEST_NICE] += cputime;
} else {
cpustat[CPUTIME_USER] += cputime;
cpustat[CPUTIME_GUEST] += cputime;
}
So the old sum was wrong as some time frames were counted
double in the `total` value.
The data will likely still deviate from PVE, but we should
check by how much, as this version does seem more accurate.
We can still fix it to just use the same math as pve if it
seems off.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
we also have to fallback to the id_schema of the section_config when
we parse it, not only on write
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
converts a parsed section config to an Vector of typed items
this way we can simply get a list of users from the user config
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
if set in the SectionConfigPlugin, we set the given
field to the section_id for each entry
this way we can have e.g. the userid in the Struct and ObjectSchema,
without having to write it twice to the config but we are still getting
it when parsing the config
when a plugin does not specify an id_property, then the id_schema of
the SectionConfig will be used as fallback
also adds a test for this with multiple plugins
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
using a handlebars instance in ApiConfig, to cache the templates
as long as possible, this is currently ok, as the index template
can only change when the whole package changes
if we split this in the future, we have to trigger a reload of
the daemon on gui package upgrade (so that the template gets reloaded)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>