Preparing the Windows migration worker template
To migrate Windows virtual machines, prepare a Windows migration worker template. During migration, the system creates a temporary worker VM from this template. After migration is complete, the temporary worker VM is deleted.
Windows migrations require both Linux and Windows worker templates: disk cloning uses a Linux worker, and OS morphing uses a Windows worker. In Virtuozzo Infrastructure, Linux worker templates are already available, so you only need to prepare the Windows template.
The Windows migration worker template must use Windows Server 2022 with English as the system language.
To prepare the Windows migration worker template
- Prepare a compute image with an official Windows Server 2022 ISO, as described in Uploading images for virtual machines.
- Create a Windows Server 2022 VM to use as the migration worker template, as described in Creating virtual machines. Create the boot volume with a size of exactly 15 GB, and ensure that the VM is connected to a network with Internet access.
- Install Windows Server 2022 in the VM. If you are installing Windows Server, select an edition with the Desktop Experience option.
-
Download Cloudbase-Init from https://cloudbase.it/cloudbase-init/#download, and then install it by following the procedure from the Installation section at https://cloudbase.it/cloudbase-init/.
During the installation, do the following:
- Specify the default user name Administrator. The migration service relies on this user, so the Administrator account must exist and must not be disabled in the template.
- Set a password for the Administrator account. You will need to set the same password for the migration service after uploading the temporary Windows worker image.
- When closing the Cloudbase-Init setup wizard, do not run Sysprep.
-
To prevent the temporary Windows migration worker from rebooting during OS morphing, update both Cloudbase-Init configuration files in C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\.
Set the following parameters in both configuration files:
check_latest_version=false allow_reboot=false stop_service_on_exit=false plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin,cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,cloudbaseinit.plugins.common.userdata.UserDataPlugin,cloudbaseinit.plugins.windows.winrmlistener.ConfigWinRMListenerPlugin,cloudbaseinit.plugins.windows.winrmcertificateauth.ConfigWinRMCertificateAuthPlugin,cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin
-
Allow ICMPv4 echo requests in Windows Firewall. Start Windows PowerShell as administrator and run:
> New-NetFirewallRule -DisplayName "Allow ICMPv4 Echo Request" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -Action Allow -Profile Any
-
Configure WinRM over HTTPS, as described in Microsoft documentation. The VM must have a valid local computer certificate for Server Authentication. The certificate must match the VM hostname and must not be expired, revoked, or self-signed.
Start Windows PowerShell as administrator and run:
> winrm quickconfig -transport:https > New-NetFirewallRule -DisplayName "Allow WinRM HTTPS" -Direction Inbound -Protocol TCP -LocalPort 5986 -Action Allow -Profile Any > winrm enumerate winrm/config/listener
-
Obtain the VM ID and hosting node. On a cluster node, run:
# vinfra service compute server list
-
Download and save the guest tools ISO and Cloudbase-Init ZIP inside the VM. Log in to the node that hosts the VM and run:
# virsh x-exec <VM_ID> -- powershell -NoProfile -Command "\$WebClient = New-Object System.Net.WebClient; \$WebClient.DownloadFile('https://repo.virtuozzo.com/vz-platform/guest-tools/vz-guest-tools-win.iso', 'C:\vz-guest-tools-win.iso'); Write-Host 'Downloaded vz-guest-tools-win.iso'" # virsh x-exec <VM_ID> -- powershell -NoProfile -Command "\$WebClient = New-Object System.Net.WebClient; \$WebClient.DownloadFile('https://www.cloudbase.it/downloads/CloudbaseInitSetup_x64.zip', 'C:\cloudbaseinit.zip'); Write-Host 'Downloaded cloudbaseinit.zip'"The files are only downloaded and saved to disk. Do not unpack or install them.
- Mount C:\vz-guest-tools-win.iso inside the VM and copy all files from the ISO to C:\vztools.
-
Install Windows ADK Deployment Tools to provide the legacy DISM tool required by the migration worker:
> Invoke-WebRequest -Uri "https://download.microsoft.com/download/d5be3ad2-c9b2-4034-b02d-5e6a3a0b9780/adk/adksetup.exe" -OutFile "C:\adksetup.exe" > C:\adksetup.exe /quiet /features OptionId.DeploymentTools > & 'C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\dism.exe'
-
Shut down the VM. Then obtain the VM boot volume ID from the volumes field and upload this volume to an image with the predefined name vporter-minion-windows:
# vinfra service compute server show <VM_ID> # vinfra service compute volume upload-to-image --name vporter-minion-windows <volume_id>
-
Set the same password for the temporary Windows worker that you specified for the Administrator account in step 4b:
# vinfra service compute maas set --minion-windows-password <password>
The migration service uses this image name to create the temporary Windows migration worker during migration.