#50509 Issue 50488 - Create a monitor for disk space usage
Closed by spichugi. Opened by spichugi.
spichugi/389-ds-base disk-space-mon  into  master

Download 50509.patch

Description: Create a new monitor object: cn=disk space,cn=monitor.
It contains 'dsDisk' multi-valued attribute which has a format:

dsdisk: partition="/" size="42006183936" used="35768864768" available="6237319
 168" use%="85"
dsdisk: partition="/tmp" size="1023303680" used="950198272" available="7310540
 8" use%="92"

Add MonitorDiskSpace(DSLdapObject) to monitor.py.
Add a test to check the basic functionality.
Remove unused code and its statfs.h dependency.

https://pagure.io/389-ds-base/issue/50488

Authors: spichugi, mreynolds

Reviewed by: ?

rebased onto a290a83187a2b807df9d39941ff7bf0e3068fb53

Compiler warning:

```
../389-ds-base/ldap/servers/slapd/daemon.c: In function ‘disk_get_info’:
../389-ds-base/ldap/servers/slapd/daemon.c:342:1: warning: control reaches end of non-void function [-Wreturn-type]
342 | }
| ^
````

It's because disk_get_info() is expected to return a int32_t, but nothing is returned.

The rest looks good to me

The patch looks good. You have my ack
If disk_get_info can not get meaningful values for a specific partition you may log a warning message.
This also prevents division if total_space==0

1 new commit added

  • Fix the return code for disk_get_info function

Nice catch! Thank you!

Ready for review.
If nothing will come up, I'll merge it soon because I have the acks. :)

After removing this the define from slap.h is not used anywhere, so should be removed too I guess.

After removing this the define from slap.h is not used anywhere, so should be removed too I guess.

Pagure is pretty bad with links and comments... Which piece of code exactly do you mean?
it's written - on line 13 of ldap/servers/slapd/monitor.c - and it is an empty line (there is some stuff before it but I am not sure if you meant it)

Sorry, I've apparently commented on outdated code and Pagure didn't care, sigh. I mean the SLAPD_MONITOR_DN define in slap.h, it is not used now any more.

rebased onto c77825521aa7e4aea0776c73ee7f0792466c7514

Removed it for now.
But maybe in the future, we can replace "cn=monitor" strings in the code with this definition.

Pull-Request has been merged by spichugi

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3565

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata