Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 64. Configuring a virtual domain as a resource
You can configure a virtual domain that is managed by the libvirt
virtualization framework as a cluster resource with the pcs resource create
command, specifying VirtualDomain
as the resource type.
When configuring a virtual domain as a resource, take the following considerations into account:
- A virtual domain should be stopped before you configure it as a cluster resource.
- Once a virtual domain is a cluster resource, it should not be started, stopped, or migrated except through the cluster tools.
- Do not configure a virtual domain that you have configured as a cluster resource to start when its host boots.
- All nodes allowed to run a virtual domain must have access to the necessary configuration files and storage devices for that virtual domain.
If you want the cluster to manage services within the virtual domain itself, you can configure the virtual domain as a guest node.
64.1. Virtual domain resource options
The following table describes the resource options you can configure for a VirtualDomain
resource.
Field | Default | Description |
---|---|---|
|
(required) Absolute path to the | |
| System dependent |
Hypervisor URI to connect to. You can determine the system’s default URI by running the |
|
|
Always forcefully shut down ("destroy") the domain on stop. The default behavior is to resort to a forceful shutdown only after a graceful shutdown attempt has failed. You should set this to |
| System dependent |
Transport used to connect to the remote hypervisor while migrating. If this parameter is omitted, the resource will use |
| Use a dedicated migration network. The migration URI is composed by adding this parameter’s value to the end of the node name. If the node name is a fully qualified domain name (FQDN), insert the suffix immediately prior to the first period (.) in the FQDN. Ensure that this composed host name is locally resolvable and the associated IP address is reachable through the favored network. | |
|
To additionally monitor services within the virtual domain, add this parameter with a list of scripts to monitor. Note: When monitor scripts are used, the | |
|
|
If set to |
|
|
If set it true, the agent will detect the number of |
| random highport |
This port will be used in the |
|
Path to the snapshot directory where the virtual machine image will be stored. When this parameter is set, the virtual machine’s RAM state will be saved to a file in the snapshot directory when stopped. If on start a state file is present for the domain, the domain will be restored to the same state it was in right before it stopped last. This option is incompatible with the |
In addition to the VirtualDomain
resource options, you can configure the allow-migrate
metadata option to allow live migration of the resource to another node. When this option is set to true
, the resource can be migrated without loss of state. When this option is set to false
, which is the default state, the virtual domain will be shut down on the first node and then restarted on the second node when it is moved from one node to the other.
64.2. Creating the virtual domain resource
The following procedure creates a VirtualDomain
resource in a cluster for a virtual machine you have previously created.
Procedure
To create the
VirtualDomain
resource agent for the management of the virtual machine, Pacemaker requires the virtual machine’sxml
configuration file to be dumped to a file on disk. For example, if you created a virtual machine namedguest1
, dump thexml
file to a file somewhere on one of the cluster nodes that will be allowed to run the guest. You can use a file name of your choosing; this example uses/etc/pacemaker/guest1.xml
.# virsh dumpxml guest1 > /etc/pacemaker/guest1.xml
-
Copy the virtual machine’s
xml
configuration file to all of the other cluster nodes that will be allowed to run the guest, in the same location on each node. - Ensure that all of the nodes allowed to run the virtual domain have access to the necessary storage devices for that virtual domain.
- Separately test that the virtual domain can start and stop on each node that will run the virtual domain.
- If it is running, shut down the guest node. Pacemaker will start the node when it is configured in the cluster. The virtual machine should not be configured to start automatically when the host boots.
Configure the
VirtualDomain
resource with thepcs resource create
command. For example, the following command configures aVirtualDomain
resource namedVM
. Since theallow-migrate
option is set totrue
apcs resource move VM nodeX
command would be done as a live migration.In this example
migration_transport
is set tossh
. Note that for SSH migration to work properly, keyless logging must work between nodes.# pcs resource create VM VirtualDomain config=/etc/pacemaker/guest1.xml migration_transport=ssh meta allow-migrate=true