It was Xmas time! Every website was flooding with offers and deals. I felt this was the best time to buy a tablet for myself. But many of these online stores had shipping times of 2 or more days.
That’s when I came across Amazon website, which highlighted a ‘Same Day Delivery!’ offer. I didn’t think for a moment before placing my order. Fast product delivery is what drove me to Amazon for my purchase.
See how our WHMCS oVirt plugin helps you!
No customer is ready to wait for long to get their order delivered. Similarly, in the hosting industry, customers want their service to be ‘delivered’ instantly. An automated provisioning system enables a hosting company to make this possible.
In a recent post, we discussed how we helped a VPS provider build a competitive VPS hosting service using oVirt. Today, we’ll discuss how we used oVirt API and custom python scripts to automate provisioning of new VPS orders.
[ You don’t have to waste your time on provisioning. Our oVirt plugins help to automate the entire process and give you an upper hand in business. ]
Creating customer portal using oVirt API
The oVirt engine admin web interface provides system administrators with a GUI to easily create and edit VPS. But performing tasks ranging from VPS creation to resource management with a GUI can be tedious.
Everytime a VPS had to be provisioned, the customers had to contact the provider, who performed these tasks. To enable VPS owners to create, scale up and manage their VPS instances, we designed a customer portal.
We also integrated it with the billing software so that the users were provided with a single-entry management interface. Using the portal, users could quickly create VPS instances for the plans they ordered.
We automated various provisioning tasks such as storage and network configuration, starting and stopping these instances, user management, etc in this software. The portal featured custom python scripts that directly interacted with the oVirt-engine using the API.
Scripts for automation
The oVirt API is the Application programming interface for the oVirt engine. Our scripts connected to the API and performed actions on it using its functions. Here are a few snippets from some of the scripts we configured for the customer portal.
1. Script to List VPS instances
When a user connected to his portal, this script connected to the API with his authentication and displayed the list of VPS instances under his account. The function ‘api.vms.list()’ was executed to perform this task. A sample output of the script is shown here.
[root@ovirt1 ~]# python list_vm.py VPS-Gold-35 VPS-Gold-67 VPS-Win2k12-03
The portal also listed the plan and resource limits for each VPS, for the user to get the account summary in a glance.
2. Script to create a new VPS
When a user clicked on the option to create a new VPS, the plans allotted to him were listed in the portal. User could choose the plan for which the new instance had to be created. Our custom script checked the billing details and created the VPS based on that plan’s template.
The API functions called in this script were:
- api.vms.add() to create the VPS with the name, plan template, memory specifications as parameters.
- api.vms.get(VM_NAME).nics.add to add the network interface for the VPS.
- api.vms.get(VM_NAME).disks.add to add the storage disk to the VPS
This snippet shows successful creation of a VPS in a plan called ‘VPS-Silver’.
[root@ovirt1 ~]# python create_vm.py VM 'VPS-Silver-06' successfully created in 'VPS-Silver' package NIC added to VM VM successfully added to Host 'oVirt-Node-01'
Once the VPS was created, it was displayed in the user’s account in the portal.
[root@ovirt1 ~]# python list_vm.py VPS-Gold-35 VPS-Gold-67 VPS-Silver-06 VPS-Win2k12-03
[ Running a cloud hosting infrastructure doesn’t have to be hard, or costly, if you have the right support to assist you. Get 24/7 world class oVirt specialists and find peace of mind. ]
3. Scripts to start and stop the VPS
User was provided with the option to ‘Start’ and ‘Stop’ his VPS instances in the portal. The API functions used were:
- api.vms.get(VM_NAME).start() to start the VPS.
- api.vms.get(VM_NAME).stop() to stop it.
A snippet from the ‘Start’ script is shown here.
[root@ovirt1 ~]# python start_vm.py Starting VM 'VPS-02-01' VM 'VPS-02-01' successfully started
4. Additional features for the VPS instances
Along with these basic features, users were also given options to ‘Scale’ up their VPS instances to add more resources such as storage, IP address, memory etc.
The ‘Backups’ feature gave options to configure automatic VPS backups on a daily, weekly and monthly manner. ‘Reports’ tab gave summary reports of the VPS performance and resource usage over a period of time.
Fast provisioning is a core feature in any VPS hosting solution. Here we’ve covered how we automated VPS provisioning in an oVirt cloud system using our custom python scripts for oVirt API.
Bobcares helps VPS providers, data centers and web hosts deliver industry standard services through custom configuration and preventive maintenance of server virtualization systems. Click here to know more about the plugin..
0 Comments