9.2. Creating a Virtual Machine Pool

You can create a virtual machine pool containing multiple virtual machines based on a common template. See Templates in the Virtual Machine Management Guide for information about sealing a virtual machine and creating a template.

Sysprep File Configuration Options for Windows Virtual Machines

Several sysprep file configuration options are available, depending on your requirements.

If your pool does not need to join a domain, you can use the default sysprep file, located in /usr/share/ovirt-engine/conf/sysprep/.

If your pool needs to join a domain, you can create a custom sysprep for each Windows operating system:

  1. Copy the relevant sections for each operating system from /usr/share/ovirt-engine/conf/osinfo-defaults.properties to a new file and save as 99-defaults.properties.
  2. In 99-defaults.properties, specify the Windows product activation key and the path of your new custom sysprep file:

    os.operating_system.productKey.value=Windows_product_activation_key
    ...
    os.operating_system.sysprepPath.value = ${ENGINE_USR}/conf/sysprep/sysprep.operating_system
  3. Create a new sysprep file, specifying the domain, domain password, and domain administrator:

        <Credentials>
            <Domain>AD_Domain</Domain>
            <Password>Domain_Password</Password>
            <Username>Domain_Administrator</Username>
        </Credentials>

If you need to configure different sysprep settings for different pools of Windows virtual machines, you can create a custom sysprep file in the Administration Portal (see Creating a Virtual Machine Pool below). See Using Sysprep to Automate the Configuration of Virtual Machines in the Virtual Machine Guide for more information.

Creating a Virtual Machine Pool

  1. Click ComputePools.
  2. Click New.
  3. Select a Cluster from the drop-down list.
  4. Select a Template and version from the drop-down menu. A template provides standard settings for all the virtual machines in the pool.
  5. Select an Operating System from the drop-down list.
  6. Use the Optimized for drop-down list to optimize virtual machines for Desktop or Server.

    Note

    High Performance optimization is not recommended for pools because a high performance virtual machine is pinned to a single host and concrete resources. A pool containing multiple virtual machines with such a configuration would not run well.

  7. Enter a Name and, optionally, a Description and Comment.

    The Name of the pool is applied to each virtual machine in the pool, with a numeric suffix. You can customize the numbering of the virtual machines with ? as a placeholder.

    Example 9.1. Pool Name and Virtual Machine Numbering Examples

    • Pool: MyPool

      Virtual machines: MyPool-1, MyPool-2, …​ MyPool-10

    • Pool: MyPool-???

      Virtual machines: MyPool-001, MyPool-002, …​ MyPool-010

  8. Enter the Number of VMs for the pool.
  9. Enter the number of virtual machines to be prestarted in the Prestarted field.
  10. Select the Maximum number of VMs per user that a single user is allowed to run in a session. The minimum is 1.
  11. Select the Delete Protection check box to enable delete protection.
  12. If you are creating a pool of non-Windows virtual machines or if you are using the default sysprep, skip this step. If you are creating a custom sysprep file for a pool of Windows virtual machines:

    1. Click the Show Advanced Options button.
    2. Click the Initial Run tab and select the Use Cloud-Init/Sysprep check box.
    3. Click the Authentication arrow and enter the User Name and Password or select Use already configured password.

      Note

      This User Name is the name of the local administrator. You can change its value from its default value (user) here in the Authentication section or in a custom sysprep file.

    4. Click the Custom Script arrow and paste the contents of the default sysprep file, located in /usr/share/ovirt-engine/conf/sysprep/, into the text box.
    5. You can modify the following values of the sysprep file:

      • Key. If you do not want to use the pre-defined Windows activation product key, replace <![CDATA[$ProductKey$]]> with a valid product key:

            <ProductKey>
                <Key><![CDATA[$ProductKey$]]></Key>
            </ProductKey>

        Example 9.2. Windows Product Key Example

        <ProductKey>
            <Key>0000-000-000-000</Key>
        </ProductKey>
      • Domain that the Windows virtual machines will join, the domain’s Password, and the domain administrator’s Username:

            <Credentials>
                <Domain>AD_Domain</Domain>
                <Password>Domain_Password</Password>
                <Username>Domain_Administrator</Username>
            </Credentials>

        Example 9.3. Domain Credentials Example

        <Credentials>
            <Domain>addomain.local</Domain>
            <Password>12345678</Password>
            <Username>Sarah_Smith</Username>
        </Credentials>
        Note

        The Domain, Password, and Username are required to join the domain. The Key is for activation. You do not necessarily need both.

        The domain and credentials cannot be modified in the Initial Run tab.

      • FullName of the local administrator:

            <UserData>
            …​
                <FullName>Local_Administrator</FullName>
            …​
            </UserData>
      • DisplayName and Name of the local administrator:

            <LocalAccounts>
                <LocalAccount wcm:action="add">
                    <Password>
                        <Value><![CDATA[$AdminPassword$]]></Value>
                        <PlainText>true</PlainText>
                    </Password>
                    <DisplayName>Local_Administrator</DisplayName>
                    <Group>administrators</Group>
                    <Name>Local_Administrator</Name>
                </LocalAccount>
            </LocalAccounts>

        The remaining variables in the sysprep file can be filled in on the Initial Run tab.

  13. Optional. Set a Pool Type:

    1. Click the Type tab and select a Pool Type:

      • Manual - The administrator is responsible for explicitly returning the virtual machine to the pool.
      • Automatic - The virtual machine is automatically returned to the virtual machine pool.
    2. Select the Stateful Pool check box to ensure that virtual machines are started in a stateful mode. This ensures that changes made by a previous user will persist on a virtual machine.
    3. Click OK.
  14. Optional. Override the SPICE proxy:

    1. In the Console tab, select the Override SPICE Proxy check box.
    2. In the Overridden SPICE proxy address text field, specify the address of a SPICE proxy to override the global SPICE proxy.
    3. Click OK.
  15. For a pool of Windows virtual machines, click ComputeVirtual Machines, select each virtual machine from the pool, and click RunRun Once.

    Note

    If the virtual machine does not start and Info [windeploy.exe] Found no unattend file appears in %WINDIR%\panther\UnattendGC\setupact.log, add the UnattendFile key to the registry of the Windows virtual machine that was used to create the template for the pool:

    1. Check that the Windows virtual machine has an attached floppy device with the unattend file, for example, A:\Unattend.xml.
    2. Click Start, click Run, type regedit in the Open text box, and click OK.
    3. In the left pane, go to HKEY_LOCAL_MACHINESYSTEMSetup.
    4. Right-click the right pane and select NewString Value.
    5. Enter UnattendFile as the key name.
    6. Double-click the new key and enter the unattend file name and path, for example, A:\Unattend.xml, as the key’s value.
    7. Save the registry, seal the Windows virtual machine, and create a new template. See Templates in the Virtual Machine Management Guide for details.

You have created and configured a virtual machine pool with the specified number of identical virtual machines. You can view these virtual machines in ComputeVirtual Machines, or by clicking the name of a pool to open its details view; a virtual machine in a pool is distinguished from independent virtual machines by its icon.