During the development of my Cloud Motion with vSphere Replication automation script for Hybrid Cloud Extension (HCX), I extensively used the HCX vSphere UI for testing and debugging purposes.
Under the Migration view, you can see all active and completed migrations, including any failed migration attempts. In my particular environment, there had been a few hundred migrations and with my additional testing, that added quite a few more. Although you can filter by name or sort by the type of operation, it was still not very convenient for me while developing the script. I wanted a quick way to view the details after calling the HCX APIs and by the time I jumped to the UI, I would have missed a few of those updates.
In speaking with one of the HCX Engineers, I found out that you could simply drop all migration history from the internal database (this would remove all the history for past migrations including failures). In general, I do not see this being something customers would have a need for in Production, as you would want to keep all the history for auditing or debugging purposes. This is probably more for demo or testing purposes and below are the instructions on how to clear all migrations from your HCX Manager.
Disclaimer: This is not officially supported by VMware, please use at your own risk
Step 1 - SSH to the on-prem HCX Manager using 'admin' account and the credentials.
Step 2 - Connect to the HCX Mongo DB by running the following command:
mongo hybridity
Step 3 - Next, run the following command which will drop all migration history from database:
db.VmMigrations.remove({})
Step 4 - Lastly, you can run the following command to exit from the Mongo DB:
q
At this point, you can now refresh the HCX Migration tab in the vSphere UI to confirm all migrations have been successfully removed.
You can also confirm the operation was succesful by running the following command connected to the Mongo DB:
db.VmMigrations.find()
Thanks for the comment!