The Hyper-V processing module manages Microsoft Hyper-V virtual machines (VMs) through the WinRM protocol in the BILLmanager platform.
Module features:
- support for Linux and Windows operating systems, Hyper-V generations 1 and 2;
- VM lifecycle management:
- creation with automatic resource rollback on error;
- deletion;
- pause and forced pause;
- resume;
- reboot with final state confirmation;
- CPU, RAM, and VHDX disk size configuration from tariff resources, while preserving the original measurement precision (bytes, KiB, MiB, GiB).
- network configuration:
- getting an IPv4 address via DHCP through the Hyper-V KVP mechanism;
- passing the fully qualified domain name (FQDN) of the service to the initial setup file of the OS template;
- manual tasks for adding and deleting additional IP addresses;
- syncing the OS template list.
- VMs with operating systems specified in the tariff (
ostempl).
Requirements for the Hyper-V node
- Windows Server OS with the Hyper-V role and the PowerShell module;
- the WinRM remote management service enabled and configured to accept connections from the BILLmanager server;
- a virtual switch accessible from BILLmanager;
- free disk space for OS template and VM directories;
- a service account with local Administrator, Hyper-V Administrators, and Remote Management Users rights;
- prepared VHDX templates according to the guide for preparing templates.
Network behavior
The processing module gets the main IPv4 address through DHCP. BILLmanager reads this address from the Hyper-V node and stores it in the database. Adding and deleting additional IP addresses works only through manual tasks. The module creates a task in BILLmanager when the addip or delip commands are run. The platform administrator must complete this task manually after configuring or removing the address inside the VM.
The processing module determines VM readiness through the Hyper-V KVP (key-value pair) mechanism. Inside the guest operating system, start the following services:
- for Linux OS: hv_kvp_daemon;
- for Windows OS: Hyper-V Data Exchange (vmickvpexchange).
After receiving the readiness marker (the BILLmanager service record Provisioning=vm_<id>, which the guest OS creates through KVP after setup is complete), the processing module:
- removes the service initial setup ISO image (seed.iso or unattend.iso).
- records the DHCP IP address in BILLmanager (without reservation on the DHCP server).
- changes the service status to "Active".
Hyper-V-side configuration
Before configuring the integration on the Hyper-V side:
- Create a service account.
- Configure the WinRM service.
- Prepare the file system.
Service account
Create a service account. Run the PowerShell commands as an administrator.
$password = Read-Host 'Password' -AsSecureString
New-LocalUser -Name 'billmgr-hyperv' -Password $password `
-Description 'BILLmanager Hyper-V processing module'
$account = "$env:COMPUTERNAME\billmgr-hyperv"
$groupSids = @(
'S-1-5-32-544', # Administrators
'S-1-5-32-578', # Hyper-V Administrators
'S-1-5-32-580' # Remote Management Users
)
foreach ($sid in $groupSids) {
$group = Get-LocalGroup -SID $sid
Add-LocalGroupMember -Group $group -Member $account -ErrorAction SilentlyContinue
}WinRM service
Do the following to configure remote management:
- Enable the WinRM remote management service.
- Ensure security:
- Use a listener with a certificate over HTTPS.
- In the firewall settings, allow access only from the BILLmanager server.
- Specify in the
winrm_hostparameter the certificate domain name, and in thewinrm_portparameter — port5986. - Use port
5985for an unsecured connection and disable theuse_sslparameter. -
Enable the
cert_validationparameter so that the system checks:- certificate authenticity (signatures of all certification authorities);
- certificate validity period;
- matching of the
winrm_hostdomain name with the name in the certificate.
- Install a trusted root or intermediate certification authority on the BILLmanager server.
- By default, the system disables verification for compatibility. If you leave verification disabled, restrict access to WinRM to a trusted network or firewall rules.
Directories
Prepare the file system:
- Make sure there is enough free disk space to copy the VHDX file of each machine.
- Create root directories for OS templates and VMs:
New-Item -ItemType Directory -Path 'D:\Templates' -Force New-Item -ItemType Directory -Path 'D:\VM' -Force - Grant the service account read access to the templates directory (
templates_dir) and full access to the VM directory (vms_dir).
BILLmanager-side settings
The integration is configured while creating the processing module in BILLmanager.
To create a processing module, go to Integration → Processing modules → click Add:
- Product type — select "VPS".
- Processing module — select "Hyper-V".
- Integration settings Specify integration data:
- In the Processing module settings block:
- Use SSL (WinRM HTTPS) — enable the option if the processing module uses a secure connection. If the option is enabled, specify whether to Verify WinRM HTTPS certificate. Certificate verification confirms host authenticity. A valid certificate must be installed on the Hyper-V host.
- IP address of the Hyper-V host — the domain or public address of the Hyper-V server.
- WinRM service port — the port for connecting the processing module to the Hyper-V node (it must be open on the Hyper-V node). Specify the value depending on the connection type:
5985— for an unsecured connection;5986— for a secure connection (HTTPS).
- Username — the name of a local or domain Windows account with administrator rights on the Hyper-V host.
- Password.
- VM templates directory — path on the Hyper-V host. For example,
C:\Templates. - VM directory — path on the Hyper-V host. For example,
C:\VMs.
- In the Network settings block:
- Hyper-V virtual switch — select the previously configured Hyper-V virtual switch. If the required switch is not shown in the list, click Refresh list.
- In the Processing module settings block:
- Processing module parameters. Configure internal (within BILLmanager) processing module parameters:
-
Data center — the name of the data center in BILLmanager to which the processing module will be connected;
The data center must not have an External data center id. - Name — the name of the processing module as shown in the BILLmanager interface;
- Department — the department to which tasks from the processing module will be assigned;
- Sorting — the processing module priority. If several processing modules are connected to the tariff, the one with the lowest priority is selected first when the service is created.
-
Changing processing module settings
To change the processing module settings, in the main menu go to Integration → Processing modules → select the processing module → click View → click Edit. See the article Managing service processing modules.
VM creation algorithm
- The BILLmanager platform selects the processing module, tariff resources, and the
ostempltemplate. - The processing module reads the
<templates_dir>\<ostempl>\template.json.More details - The platform selects a reserved IP address for the future DHCP address.
- The processing module copies the VHDX disk to
<vms_dir>\vm_<item>\disk.vhdxand resizes it to the exact size from the tariff.More details - The processing module creates the VM and sets the CPU, memory, and virtual switch.
- The processing module reads the selected template's bootstrap_file, substitutes service values, and creates the initial setup disk (seed.iso or unattend.iso); More details
- The platform starts the VM, checks the DHCP address and the guest OS readiness marker through Hyper-V.
- The processing module detaches and removes the initial setup disk.
- The platform records the IP address in BILLmanager and calls the
postopenprocedure.
More details
If an error occurs before the operation is completed, the processing module removes the created machine, the VHDX disk, the initial setup disk, and the unassigned IP reservation.
En
Es