4.20. template


The template resource type groups all virtual machine templates in a Red Hat Virtualization environment. Only --vm-id|name and --name are required parameters. If the optional parameters are not specified, the template will inherit the settings from the virtual machine used to make the template.
Table 4.50. Template parameters
Name Type Description Required User Creatable User Updatable
--vm-id|name
string
A reference to the virtual machine used as the basis for the template.
Yes
Yes
No
--name
string
The name of the virtual machine template.
Yes
Yes
Yes
--memory
long
The amount of memory for the virtual machine template in bytes.
No
Yes
Yes
--cpu-topology-cores
int
The number of CPU cores available to the virtual machine template.
No
Yes
Yes
--high_availability-enabled
Boolean
Set to true to enable high availability for the virtual machine template.
No
Yes
Yes
--os-cmdline
string
A kernel command line parameter string to be used with the defined kernel. This option supports booting a Linux kernel directly rather than through the BIOS bootloader.
No
Yes
Yes
--origin
string
The virtual machine template's origin. Specify rhev, vmware, or xen.
No
Yes
Yes
--high_availability-priority
int
Sets the priority value (i.e. boot order) of each virtual machine template's high availability.
No
Yes
Yes
--timezone
string
The Sysprep timezone setting for a Windows virtual machine template. Specify formats such as GMT+00:00.
No
Yes
Yes
--domain-name
string
The domain name of the virtual machine template.
No
Yes
Yes
--type
string
Defines the virtual machine type. Specify either desktop or server.
No
Yes
Yes
--stateless
boolean
Set to true if the resulting virtual machines are stateless. A stateless virtual machine contains a snapshot of its disk image taken at boot and removed at shutdown. This means state changes do not persist after a reboot.
No
Yes
Yes
--delete_protected
boolean
Set to true to make it impossible to delete a virtual machine created from this template.
No
Yes
Yes
--sso-methods-method
collection
Defines the single sign-on method used. For example, --sso-methods-method method.id=GUEST_AGENT.
No
Yes
Yes
--rng_device-rate-bytes
int
Specifies how many bytes are permitted to be consumed per period.
No
Yes
Yes
--rng_device-rate-period
int
Specifies the duration of a period in milliseconds. If specified, --rng_device-rate-bytes must be specified as well.
No
Yes
Yes
--rng_device-source
string
The source of the random number generator. Specify either random or hwrng.
No
Yes
Yes
--console-enabled
boolean
Set to true to enable the VirtIO console device feature.
No
Yes
Yes
--placement_policy-affinity
string
The migration affinity for each virtual machine created from the template. Specify migratable, user_migratable, or pinned.
No
Yes
Yes
--description
string
A description for the virtual machine template.
No
Yes
Yes
--comment
string
A comment for the virtual machine template.
No
Yes
Yes
--custom_properties-custom_property
collection
A set of user-defined environment variables passed as parameters to custom scripts.
No
Yes
Yes
--os-type
string
The operating system type for the virtual machine template.
No
Yes
Yes
--os-boot
collection
The boot device for the virtual machine template. Specify cdrom, hd, or network. For example, --os-boot boot.dev=hd.
No
Yes
Yes
--cpu-topology-sockets
int
The number of CPU sockets available to the virtual machine template.
No
Yes
Yes
--cpu_shares
int
The level of CPU resources a virtual machine can demand relative to other virtual machines. For example, 512 for low priority virtual machines, 1024 for medium priority virtual machines, and 2048 for high priority virtual machines.
No
Yes
Yes
--cpu-architecture
string
Defines the CPU architecture. Specify x86_64, ppc64, or undefined.
No
Yes
Yes
--os-kernel
string
A path to a kernel image the resulting virtual machines are configured to boot. This option supports booting a Linux kernel directly rather than through the BIOS bootloader.
No
Yes
Yes
--display-type
string
Defines the display type. Specify either spice or vnc.
No
Yes
Yes
--display-monitors
int
Defines the number of displays available.
No
Yes
Yes
--display-single_qxl_pci
boolean
Set to true to drive multiple monitors using a single virtual PCI device.
No
Yes
Yes
--display-allow_override
boolean
Set to true to allow override of the template console settings.
No
Yes
Yes
--display-smartcard_enabled
boolean
Set to true to enable the Smart card feature for virtual machines.
No
Yes
Yes
--display-file_transfer_enabled
boolean
Set to true to enable SPICE file transfer.
No
Yes
Yes
--display-copy_paste_enabled
boolean
Set to true to enable SPICE clipboard copy and paste.
No
Yes
Yes
--display-keyboard_layout
string
Defines the keyboard layout for the virtual machine. This option is only available when using the VNC protocol. Specify formats such as en-US.
No
Yes
Yes
--os-initRd
string
A path to an initrd image to be used with a specified kernel. This option supports booting a Linux kernel directly rather than through the BIOS bootloader.
No
Yes
Yes
--usb-enabled
Boolean
Set to true to enable USB support on the virtual machine. This option is only available for virtual machines using the SPICE protocol.
No
Yes
Yes
--usb-type
string
Defines the USB type if USB support is enabled. Specify either Legacy or Native.

Important

The Legacy USB option has been deprecated and will be removed in Red Hat Virtualization 4.1.
No
Yes
Yes
--tunnel_migration
boolean
Set to true to enable data transport over a libvirt daemon. A tunneled transport uses a stronger encryption algorithm but increases the data load during transport.
No
Yes
Yes
--migration_downtime
int
Defines the maximum number of milliseconds that the virtual machine can be down during live migration.
No
Yes
Yes
--virtio_scsi-enabled
boolean
Set to true to allow attaching a VirtIO console device to the virtual machine.
No
Yes
Yes
--soundcard_enabled:
boolean
Set to true to enable sound cards.
No
Yes
Yes
--vm-disks-disk
collection
References to disks attached to the template.
No
Yes
No
--id
string
The ID of the virtual machine template.
No
Yes
Yes
--permissions-clone
boolean
Set to true to copy the permissions of the source virtual machine to the template.
No
Yes
Yes
--version-version_name
string
Used with the --version-base_template-id parameter. Defines the name for the sub template.
No
Yes
Yes
--version-base_template-id
string
Defines the template ID to be used as the root template. Used if you want to create this template as a sub template of a root template.
No
Yes
Yes
--cpu-cpu_tune-vcpu_pin
collection
Defines which virtual CPUs of a virtual machine to pin to the physical CPUs of a host.
No
Yes
Yes
--serial_number-policy
string
Defines the serial number policy for the virtual machine template. Specify host, vm, or custom. If custom is used, also define the serial number value using --serial_number-value.
No
Yes
Yes
--serial_number-value
string
Defines the serial number for the virtual machine template.
No
Yes
Yes
--bios-boot_menu-enabled
boolean
Set to true to enable boot menu.
No
Yes
Yes
--cluster-id
string
Defines the cluster to use by specifying the cluster ID.
No
Yes
Yes
--cluster-name
string
Defines the cluster to use by specifying the cluster name.
No
Yes
Yes
--cpu_profile-id
string
Defines the CPU profile to use. Use the list cpuprofiles command to retrieve a full list of CPU profile IDs.
No
Yes
Yes
--expect
'201-created'
Request becomes asynchronous until the expected HTTP header is returned. Useful for long-running tasks that would otherwise return as successful before the task is completed.
No
Yes
Yes
--correlation_id
string
A tagging identifier of an action for cross-system logging. If the client does not define the identifier, one will be generated.
No
Yes
Yes
The --sso-methods-method parameter is a collection that uses the sub-parameters in the following table.
Table 4.51. --sso-methods-method parameters
Name Type Description
method.id
string
The single sign-on method used: GUEST_AGENT.
The --custom_properties-custom_property parameter is a collection that uses the sub-parameters in the following table.
Table 4.52. --custom_properties-custom_property parameters
Name Type Description
custom_property.name
string
The custom property name.
custom_property.value
string
The custom property value.
The --os-boot parameter is a collection that uses the sub-parameters in the following table.
Table 4.53. --os-boot parameters
Name Type Description
boot.dev
string
The boot device for the virtual machine template. Specify cdrom, hd, or network.
The --vm-disks-disk parameter is a collection that uses the sub-parameters in the following table.
Table 4.54. --vm-disks-disk parameters
Name Type Description
disk.id
string
A reference to a virtual disk.
storage_domains.storage_domain
collection
Defines a set of sub-parameters for the disk's storage domain.
The --cpu-cpu_tune-vcpu_pin parameter is a collection that uses the sub-parameters in the following table.
Table 4.55. --cpu-cpu_tune-vcpu_pin parameters
Name Type Description
vcpu_pin.vcpu
int
The virtual CPU to assign.
vcpu_pin.cpu_set
string
The physical CPUs on the host.

Example 4.41. Creating a new template

[RHEVM shell (connected)]# add template --name MyTemplate1 --vm-name MyVM1

Example 4.42. Updating a template

[RHEVM shell (connected)]# update template MyTemplate1 --memory 1073741824

Example 4.43. Deleting a template

[RHEVM shell (connected)]# remove template MyTemplate1
The following table lists actions for a virtual machine template resource.
Table 4.56. Virtual machine template actions
Action Description
export Export a template to an export storage domain.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.