Hi, this is the second chapter of engineering OvzCP.
One of OvzCP’s goal is that it should be “hosting” control panel so it must have billing system while allow me to use for free.
First, I think that the user should be billed monthly with the amount they use, but seems that if user reduce the amount at the last day of month, they will be billed less than normal. I think about this for about 2 days and got the idea: game-like credit system.
I just commited this feature in. It took me about an hour to make it. Each VM will consume credit depending on memory and disk space setup in each cron run. If a user reached zero credit all VM that’s running will be stopped. Also, when a user have less than 100 credit he can’t start any more VM.
That solution seems to be great, but some user think it make they hard to calculate time left until credit runs out. I remedy this by value one real-world currency to many credit that equal to the amount of minutes in a month so if VM’s billing said they need 200 credit to run this VM per minute, they will pay 200 in real world.
(Note: Credit per real world currency rate can be adjusted in the configuration. The only number that’s hard coded here is 100 credit requirement to start VM)
With this feature online, I now run OvzCP as one of system’s daemon now. Of course, my credit is 1 trillion (1×1012) and it will be depleted in about 350199 days.