11.3. Template Tasks
11.3.1. Creating a Template
Summary
Create a template from an existing virtual machine to use as a blueprint for creating additional virtual machines.
Important
Before you create a template, you must seal the source virtual machine to ensure all system-specific details are removed from the virtual machine. This is necessary to prevent the same details from appearing on multiple virtual machines created based on the same template.
Procedure 11.8. Creating a Template
- Click the Virtual Machines tab.
- Select the source virtual machine.
- Ensure the virtual machine is powered down and has a status of
Down. - Click .
- Enter a Name, Description, and Comment for the template.
- Select the cluster with which to associate the template from the Cluster list. By default, this is the same as that of the source virtual machine.
- Optionally, select a CPU profile for the template from the CPU Profile list.
- Optionally, select the Create as a Sub Template version check box, select a Root Template, and enter a Sub Version Name to create the new template as a sub template of an existing template.
- In the Disks Allocation section, enter an alias for the disk in the Alias text field, and select the storage domain on which to store the disk from the Target list. By default, these are the same as those of the source virtual machine.
- Select the Allow all users to access this Template check box to make the template public.
- Select the Copy VM permissions check box to copy the permissions of the source virtual machine to the template.
- Click .
Result
The virtual machine displays a status of Image Locked while the template is being created. The process of creating a template may take up to an hour depending on the size of the virtual machine disk and the capabilities of your storage hardware. When complete, the template is added to the Templates tab. You can now create new virtual machines based on the template.
Note
When a template is made, the virtual machine is copied so that both the existing virtual machine and its template are usable after template creation.
11.3.2. Explanation of Settings and Controls in the New Template Window
The following table details the settings for the New Template window.
Table 11.1. New Template and Edit Template Settings
|
Field
|
Description/Action
|
|---|---|
|
Name
|
The name of the template. This is the name by which the template is listed in the Templates tab in the Administration Portal and is accessed via the REST API. This text field has a 40-character limit and must be a unique name with any combination of uppercase and lowercase letters, numbers, hyphens, and underscores.
|
|
Description
|
A description of the template. This field is recommended but not mandatory.
|
|
Comment
|
A field for adding plain text, human-readable comments regarding the template.
|
|
Cluster
|
The cluster with which the template is associated. This is the same as the original virtual machines by default. You can select any cluster in the data center.
|
| CPU Profile | The CPU profile assigned to the template. CPU profiles define the maximum amount of processing capability a virtual machine can access on the host on which it runs, expressed as a percent of the total processing capability available to that host. CPU profiles are defined on the cluster level based on quality of service entries created for data centers. |
|
Create as a Sub Template version
|
Specifies whether the template is created as a new version of an existing template. Select this check box to access the settings for configuring this option.
|
|
Disks Allocation
|
Alias - An alias for the virtual machine disk used by the template. By default, the alias is set to the same value as that of the source virtual machine.
Virtual Size - The total amount of disk space that a virtual machine based on the template can use. This value cannot be edited, and is provided for reference only. This value corresponds with the size, in GB, that was specified when the disk was created or edited.
Target - The storage domain on which the virtual disk used by the template is stored. By default, the storage domain is set to the same value as that of the source virtual machine. You can select any storage domain in the cluster.
|
|
Allow all users to access this Template
|
Specifies whether a template is public or private. A public template can be accessed by all users, whereas a private template can only be accessed by users with the TemplateAdmin or SuperUser roles.
|
|
Copy VM permissions
|
Copies explicit permissions that have been set on the source virtual machine to the template.
|
11.3.3. Editing a Template
Summary
Once a template has been created, its properties can be edited. Because a template is a copy of a virtual machine, the options available when editing a template are identical to those in the Edit Virtual Machine window.
Procedure 11.9. Editing a Template
- Use the Templates resource tab, tree mode, or the search function to find and select the template in the results list.
- Click to open the Edit Template window.
- Change the necessary properties and click .
Result
The properties of the template are updated. The Edit Template window does not close if a property field is invalid.
11.3.4. Deleting a Template
Summary
Delete a template from your Red Hat Enterprise Virtualization environment.
Warning
If you have used a template to create a virtual machine, make sure that you do not delete the template as the virtual machine needs it to continue running.
Procedure 11.10. Deleting a Template
- Use the resource tabs, tree mode, or the search function to find and select the template in the results list.
- Click to open the Remove Template(s) window.
- Click to remove the template.
Result
You have removed the template.
11.3.5. Exporting Templates
11.3.5.1. Migrating Templates to the Export Domain
Summary
Export templates into the export domain to move them to another data domain, either in the same Red Hat Enterprise Virtualization environment, or another one.
Procedure 11.11. Exporting Individual Templates to the Export Domain
- Use the Templates resource tab, tree mode, or the search function to find and select the template in the results list.
- Click to open the Export Template window.
Note
Select the Force Override check box to replace any earlier version of the template on the export domain. - Click to begin exporting the template; this may take up to an hour, depending on the virtual machine disk image size and your storage hardware.
- Repeat these steps until the export domain contains all the templates to migrate before you start the import process.Use the Storage resource tab, tree mode, or the search function to find and select the export domain in the results list and click the Template Import tab in the details pane to view all exported templates in the export domain.
Result
The templates have been exported to the export domain.
11.3.5.2. Copying a Template's Virtual Hard Disk
Summary
If you are moving a virtual machine that was created from a template with the thin provisioning storage allocation option selected, the template's disks must be copied to the same storage domain as that of the virtual machine disk.
Procedure 11.12. Copying a Virtual Hard Disk
- Select the Disks tab.
- Select the template disk or disks to copy.
- Click the Copy button to display the Copy Disk window.
- Use the drop-down menu or menus to select the Target data domain.
Result
A copy of the template's virtual hard disk has been created, either on the same, or a different, storage domain. If you were copying a template disk in preparation for moving a virtual hard disk, you can now move the virtual hard disk.
11.3.6. Importing Templates
11.3.6.1. Importing a Template into a Data Center
Summary
Import templates from a newly attached export domain.
Procedure 11.13. Importing a Template into a Data Center
- Use the resource tabs, tree mode, or the search function to find and select the newly attached export domain in the results list.
- Select the Template Import tab of the details pane to display the templates that migrated across with the export domain.
- Select a template and click to open the Import Template(s) window.
- Select the templates to import.
- Use the drop-down menus to select the Destination Cluster and Storage domain. Alter the Suffix if applicable.Alternatively, clear the Clone All Templates check box.
- Click to import templates and open a notification window. Click to close the notification window.
Result
The template is imported into the destination data center. This can take up to an hour, depending on your storage hardware. You can view the import progress in the Events tab.
Once the importing process is complete, the templates will be visible in the Templates resource tab. The templates can create new virtual machines, or run existing imported virtual machines based on that template.
11.3.6.2. Importing a Virtual Disk Image from an OpenStack Image Service as a Template
Summary
Virtual disk images managed by an OpenStack Image Service can be imported into the Red Hat Enterprise Virtualization Manager if that OpenStack Image Service has been added to the Manager as an external provider.
- Click the Storage resource tab and select the OpenStack Image Service domain from the results list.
- Select the image to import in the Images tab of the details pane.
- Click to open the Import Image(s) window.
- From the Data Center drop-down menu, select the data center into which the virtual disk image will be imported.
- From the Domain Name drop-down menu, select the storage domain in which the virtual disk image will be stored.
- Optionally, select a quota from the Quota drop-down menu to apply a quota to the virtual disk image.
- Select the Import as Template check box.
- From the Cluster drop-down menu, select the cluster in which the virtual disk image will be made available as a template.
- Click to import the virtual disk image.
Result
The image is imported as a template and is displayed in the results list of the Templates resource tab. You can now create virtual machines based on the template.

