7.2.4. Create a Windows VM from an uploaded image
You can create a Windows virtual machine (VM) by uploading a Windows image to a persistent volume claim (PVC) and then cloning the PVC when you create a VM by using the OpenShift Container Platform web console.
You must install VirtIO drivers on Windows VMs. Download VirtIO drivers only from official Red Hat sources.
Prerequisites
- You created a Windows installation DVD or USB with the Windows Media Creation Tool. See Create Windows 10 installation media in the Microsoft documentation.
-
You created an
autounattend.xmlanswer file. See Answer files (unattend.xml) in the Microsoft documentation.
Procedure
Upload the Windows image as a new PVC:
-
Navigate to Storage
PersistentVolumeClaims in the web console. -
Click Create PersistentVolumeClaim
With Data upload form. - Browse to the Windows image and select it.
Enter the PVC name, select the storage class and size and then click Upload.
The Windows image is uploaded to a PVC.
-
Navigate to Storage
Configure a new VM by cloning the uploaded PVC:
-
Navigate to Virtualization
Catalog. - Select a Windows template tile and click Customize VirtualMachine.
- Select Clone (clone PVC) from the Disk source list.
- Select the PVC project, the Windows image PVC, and the disk size.
-
Navigate to Virtualization
Apply the answer file to the VM:
- Click Customize VirtualMachine parameters.
- On the Sysprep section of the Scripts tab, click Edit.
-
Browse to the
autounattend.xmlanswer file and click Save.
Set the run strategy of the VM:
- Clear Start this VirtualMachine after creation so that the VM does not start immediately.
- Click Create VirtualMachine.
-
On the YAML tab, replace
running:falsewithrunStrategy: RerunOnFailureand click Save.
Click the Options menu
and select Control Start. The VM boots from the
sysprepdisk containing theautounattend.xmlanswer file.
7.2.4.1. Generalize a Windows VM image 링크 복사링크가 클립보드에 복사되었습니다!
You can generalize a Windows operating system image to remove all system-specific configuration data before you use the image to create a new virtual machine (VM).
Before generalizing the VM, you must ensure the sysprep tool cannot detect an answer file after the unattended Windows installation.
Prerequisites
- A running Windows VM with the QEMU guest agent installed.
Procedure
-
In the OpenShift Container Platform console, click Virtualization
VirtualMachines. - Select a Windows VM to open the VirtualMachine details page.
-
Click Configuration
Disks. -
Click the Options menu
beside the sysprepdisk and select Detach. - Click Detach.
-
Rename
C:\Windows\Panther\unattend.xmlto avoid detection by thesyspreptool. Start the
sysprepprogram by running the following command:%WINDIR%\System32\Sysprep\sysprep.exe /generalize /shutdown /oobe /mode:vm-
After the
syspreptool completes, the Windows VM shuts down. The disk image of the VM is now available to use as an installation image for Windows VMs.
Result
You can now specialize the VM.