Why my Xray upgrade to 2.x fails to backup RabbitMQ?

When performing an upgrade of Xray from 1.x.x to 2.x.x of Xray, of Docker installation, sometimes the upgrade can fail with the following error:

ERROR: Failed to backup Rabbitmq definitions during upgrade process!!!
ERROR: Upgrade failed

Why it happens?
Xray upgrade process was changed between version 1.12.1 to 2.0.0, this is in order to support the HA capability.
During the upgrade process the RabbitMQ data folder is migrated from being under the container id to a virtual domain name.
Sometimes, the rabbit.definition.json fails to be created, this file contains definitions of all broker objects (queues, exchanges, bindings, users, virtual hosts, permissions and parameters).
The file is usually located in the $XRAY_GLOBAL_MOUNT_ROOT/rabbitmq/mnesia.

How to resolve this issue?
1. Go to your xray mount directory, which is normally at ~/.jfrog/xray/rabbitmq/mnesia
2. Run curl http://guest:guest@<FQDN>:15672/api/definitions -o rabbit.definitions.json
3. Make sure the file was created.
4. Make sure all Xray Docker containers are stopped.
5. Run Xray upgrade again.