How to clean the metadata of redeployed Hosts in a Hosted Engine setup

Solution Verified - Updated -


  • Red Hat Virtualization 3.x, 4.x


I have re-deployed a Host without cleaning first the metadata and now i can see multiple entries for this Host in:

# hosted-engine --vm-status


1. Stop the High Availability Agent on the Host, which was re-deployed without cleaning first the metadata:

     # systemctl stop ovirt-ha-agent

2. Clean its metadata

     # hosted-engine --clean-metadata --host-id=$old_ID --force-clean

3. Start again the ha-agent

     # systemctl start ovirt-ha-agent

4. Verify on this and the rest of hosts of the Hosted Engine environment with:

       # hosted-engine --vm-status

5. Repeat for every Host with the same "issue".

For example, you have Host 5 with two IDs in "hosted-engine --vm-status" output

Hostname : Host05
Host ID : 9

Hostname : Host05
Host ID : 8

and the current ID is 9. You can verify it on Host05 at /etc/ovirt-hosted-engine/hosted-engine.conf

Follow the above procedure and in the second step run:

# hosted-engine --clean-metadata --host-id=8 --force-clean

Note: RHV 4.x solution: How to undeploy Hosted Engine hosts via command line?

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.


Wondering, if putting the host in local maintenance (or global maintenace in general) would not be beneficial.

Currently RHEV 3.5 hosted engine doesn't have this function enabled on it to clean up metadata for the host as it gives you an invalid option error. Hence the host requires to be upgraded to 3.6 and then issued the command .

hosted-engine --clean-metadata --host-id=2 --force-clean Invalid option '--clean-metadata'

Correct. For 3.5 please follow this solution:

Can this also be applied to remove a stale host with ID=1?