In the previous version of CloudForms Management Engine, replication failed with duplicate key present in the `host_storages` table on master.
This was happening because a migration was adding a primary key to the host_storages table and in the process altering existing rows to have a key within the range defined by the current database region. This caused existing rows in the host_storages table to be assigned primary keys in the master database region which resulted in rows with ids from multiple regions (master and remote regions). Replication determines whether a row exists on the master side by comparing primary keys. Thereby, the primary key did not match for a row where it should. This caused replication to attempt to reinsert the row which failed because of a unique index on two other columns in host_storages.
This patch adds migration to fix host_storages replication issue. This removes the entries in the host_storages table on the target region and resets the replication triggers on the source regions which has now resolved the issue.