A processing module which uses a pool of servers in BILLmanager allows creating virtual machines and adding them into the pool automatically.

Add to pool  - you select a user (an account-pool) who will be the owner of a virtual machine. The account-pool will be given a 100% discount on services. The account must be assigned to the client group with permissions to "Allow suspension/activation of services" and "Ignore number of services per account".  Navigate to "Clients" → "Client groups" → "Edit".

Automatic operations


The following operations are performed automatically if the server pool is used:

  1. The system calculates VPS sales statistics.
  2. Adds servers into the pool.  
  3. Deletes the old servers.  

The operations are started by cron:

*/3 * * * *	/usr/local/mgr5/sbin/mgrctl -m billmgr itempool.process.cron
CODE

Statistics depends on VMmanager version:

  • VMmanager KVM  - the number of servers created during the statistics collection period. It is calculated individually for every combination of a tariff plan and operating system. 

Example: a service provider sells VPS based on the tariff plan "VPS for everyone" associated with the processing module "VPS handler" which is integrated with VMmanager KVM. We have created a pool of servers for this processing module: "Calculate statistics for " - "3",  "Ordered servers (0 < VDS <= 3)" -  "2",  "Ordered servers  (3 < VDS <= 6)" -  "4". 

For the last 3 days, the service providers sold 1 VPS on Ubuntu 16.04 and 5 VPS on CentOS 7. Therefore, 2 VPS Ubuntu 16.04 and 4 VPS CentOS 7 will be added into the pool. 

  • VMmanager OVZ  - the number of servers created during the statistics collection period is calculated for every operating system. When servers are added into the pool, the tariff plan is created automatically. The system will use the tariff with the smallest sorting priority (with the largest priority).

Example: a service provider sells VPS based on the tariff plan "VPS for everyone" and "Popular VPS". Sorting values for tariff plans:  "VPS for everyone"  - "1",  "Popular VPS" - "2". The tariff plans are connected to the processing module "VPS handler" which is integrated with VMmanager OVZ. We have created a pool of servers for this processing module: "Calculate statistics for " - "3",  "Ordered servers (0 < VDS <= 3)" -  "2", "Ordered servers (3 < VDS <= 6)" -  "4". 

For the last 3 days, the service providers sold 1 VPS on Ubuntu 16.04 and 5 VPS on CentOS 7 ("VPS for everyone")  3 VPS CentOS 7 ("Popular VPS"). Therefore, 4 VPS CentOS 7 ("VPS for everyone") will be added into the pool.

Note

You cannot create/delete several servers at the same time through one processing module.

Allocating a server from the pool


After a client orders a server, the system will start processing his order. It selects from the pool a server with the configuration that meets the client's needs. If the virtual machine cannot be allocated to the client, the system will select another server with the same configuration, etc. If no servers can be allocated to the client, or there are no virtual machines with the required configuration in the pool, a new virtual server will be created. 

The system performs the following steps:

  1. Copies parameters -  the password and the main IP address of service in the pool to the services that the client has ordered.  
  2. Deletes the information about the service in the pool from the database.
  3. Changes the server hostname. In VMmanager the domain name of the virtual machine is changed into the name that the client specified during the order. 
  4. For VMmanager KVM it starts the script to change the 'hostname' parameter. This step is made if the server runs a Unix-based operating system. 
  5. Starts the recipe if any. 

After disabling the "Use pool" option for the processing module, the system will continue allocating servers from the pool until it has enough servers, or old servers are deleted automatically.