This is happening because a migration (https://github.com/ManageIQ/manageiq/blob/master/db/migrate/20150921204114_add_vmware_ro_datastores_to_hosts_storages.rb) is 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 causes existing rows in the host_storages table to be assigned primary keys in the master database region which will result 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. In this case the primary key will not match for a row where it should. This causes replication to attempt to reinsert the row which fails because of a unique index on two other columns in host_storages.
Added link to migration article
New commit detected on ManageIQ/manageiq/master:
Author: Nick Carboni <email@example.com>
AuthorDate: Tue Dec 8 16:06:55 2015 -0500
Commit: Nick Carboni <firstname.lastname@example.org>
CommitDate: Wed Dec 9 08:52:56 2015 -0500
Add migration to fix host_storages replication issue
After we run the migration added in commit 04f2fa211b8ebeb0557ca3712af846c9b556869f
the table host_storages will be assigned a primary key column and existing
rows will be given a value within the current region's range.
This causes an issue when run on a replication target as the id should
match the one on the replication source region not the target one.
This fix removes the entries in the host_storages table on the target
region and resets the replication triggers on the source regions.
...0956_fix_host_storage_replication_on_upgrade.rb | 49 ++++++++++++++++++++++
...fix_host_storage_replication_on_upgrade_spec.rb | 47 +++++++++++++++++++++
2 files changed, 96 insertions(+)
create mode 100644 db/migrate/20151208150956_fix_host_storage_replication_on_upgrade.rb
create mode 100644 spec/migrations/20151208150956_fix_host_storage_replication_on_upgrade_spec.rb
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.