cPanel & WHM Version 92 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Quota API

TerranUp16 shared this idea 4 years ago
Open Discussion

As a server administrator I would like cPanel to adjust its handling of quotas, and add API calls around cPanel's management of system quotas, allowing a developer or system administrator to integrate with additional filesystem types without losing functionality that is crucial to cPanel.


=================================

At present, cPanel only supports EXT3/4 and XFS. This appears to be primarily due to those filesystems being compatible with Quota.pm, as cPanel has pushed fixes for issues specific to filesystems like BTRFS where components would not install or compile correctly due to the filesystem.

I suggest that cPanel adjust how it handles its quota system so that while Quota.pm remains the default and supported method of simply and quickly enabling filesystem quotas, that an API be supported such that developers can set a flag for cPanel to understand that Quota.pm is NOT being used and that relevant information will come from another source.

For example, a developer could write a script/service that uses the cPanel API to fetch quota information for cPanel accounts. It could set those accounts' home directories up on subvolumes and configure qgroups for those accounts' home directories. It could then query BTRFS to get updated qgroup data and submit that via the API to cPanel so that cPanel can update its quota data to reflect this.

This can already be mimicked by nuking cPanel's provided scripts that rely on Quota.pm, enabling "Cache disk quota information" in Tweak Settings, and ensuring that /var/cpanel/repquota.datastore always has an mtime that is less than 15 minutes ago (as the developer in this case simply populates /var/cpanel/repquota.datastore with the desired data). There is a little more to this to get cPanel and some other facets to show the correct information as well, but it's very doable, it is just quite a bit of extra work to stay on top of changes from version to version.

As well, the Quota API could go the other way as well. The API could allow developers to register hooks that receive standardized input, so when cPanel wants to update filesystem quotas, if it's flag is set to use the API rather than Quota.pm, it can send the information it needs the filesystem to update to the registered hooks via the API.

This would significantly benefit cPanel by allowing service providers to use cPanel in situations where XFS and/or EXT3/4 are not suitable, which would increase the number of licenses cPanel could sell. It would also benefit cPanel by taking another step to disentangle cPanel from requiring compatibility with CentOS, so that cPanel could move towards being able to support other Linux distributions should it desire to.