How to unlock RHV entities which are in a locked state.
Environment
- Red Hat Enterprise Virtualization (RHEV) 3.1.5 and later
- Red Hat Virtualization (RHV) 4.x
Issue
- The RHEV-M web portal reports that a VM/disk/snapshot/template is in Locked state, and it is stuck in that state.
- A pending/aborted Disk migration/move operation is locking a virtual disk. Can you please help me unlock this entity.
- Cannot remove or delete old disks or templates, they are in locked status.
Resolution
-
Restart
ovirt-engineservice to unlock entities:# service ovirt-engine restart or # systemctl restart ovirt-engine
Note: The RHV manager portal will not be available during service restart.
- If issue persists, Red Hat Enterprise Virtualization provides shell scripts that can be used to perform different tasks against the database.
Keep in mind that any usage of these scripts must be consulted with Red Hat Support. Improper usage of these tools may cause significant issues and unexpected behavior in the environment
- The script used for unlocking an entity is called
unlock_entity.sh. Use it as follows, but consult section for your specific RHV version as there may be slight differences between the versions.-
It is expected that the working directory is changed to the home directory of the script and the db password is also properly set. Please make sure the you change the script home directory before using the script and set the password with the following commands:
# cd /usr/share/ovirt-engine/setup/dbutils # source /etc/ovirt-engine/engine.conf.d/10-setup-database.conf # export PGPASSWORD=$ENGINE_DB_PASSWORD -
You can obtain help by running the following command
# ./unlock_entity.sh -h -
The script
unlock_entity.shcan also be used to query the database and report any locked entities using (option -q).Sample query command
# ./unlock_entity.sh -u <DB_USER_NAME> -t <ENTITY_TYPE> -qExample:
# ./unlock_entity.sh -u engine -t disk -q 6b324a40-6699-454c-8033-6e4070823e92 | 2a3fd3a2-f627-467b-bda0-06dc01e1c982Help for RHV 4.x
Usage: ./unlock_entity.sh [options] [ENTITIES] -h - This help text. -v - Turn on verbosity (WARNING: lots of output) -l LOGFILE - The logfile for capturing output (def. ) -t TYPE - The object type {all | vm | template | disk | snapshot | illegal_images} If "all" is used then no ENTITIES are expected. -r - Recursive, unlocks all disks under the selected vm/template. -q - Query db and display a list of the locked entites. -c - Show column names. ENTITIES - The list of object names in case of vm/template, UUIDs in case of a disk
-
For RHEV 3.1, 3.2:
- The parameter
-iis required to specify the entity that needs to be unlocked. - There is also not need to set the password to the database.
- The script home directory is located in
/usr/share/ovirt-engine/dbscripts-
Example
# ./unlock_entity.sh -u postgres -t vm -i RHEL-VM -r
-
For RHEV 3.3 and later
- The parameter
-iwas removed. The entity ID or the VM name goes as the last parameter on the command line. Also the password has to be set as mentioned earlier. - The script home directory is located in
/usr/share/ovirt-engine/dbscripts-
Example
# source /etc/ovirt-engine/engine.conf.d/10-setup-database.conf # export PGPASSWORD=$ENGINE_DB_PASSWORD # cd /usr/share/ovirt-engine/setup/dbutils # ./unlock_entity.sh -u engine -t vm -r RHEL-VM Note:- "-u engine" option is not present in RHV 4.2,4.3 and 4.4 so simply use the below query # ./unlock_entity.sh -t vm -r RHEL-VM
-
For RHEV 3.6, RHV 4.0, and RHV 4.1:
- The script home directory changed to
/usr/share/ovirt-engine/setup/dbutils
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.