When creating a trove instance with any datastore the instance starts in BUILD then goes to a fake ACTIVE state. After the fake ACTIVE state it goes back to BUILD then finally the real ACTIVE state. This is happening because the datastore service is first started and sends a heartbeat which causes the instance to go into a fake ACTIVE state then the prepare method on the trove guest sets the status back to BUILD and stops the datastore service. When prepare finishes it sets the status back to the final and real ACTIVE state.
Fix: Adding an optional param force to set_status
def set_status(self, status, force=False) that is going to be set to True for end_install_or_restart which is called at the end of prepare for all datastores either directly or through app.complete_install_or_restart().
I do not think the fix will work for all datastores. The problem here is that the guest and heartbeats are running before prepare has completed. The heartbeats check the status of the database process, which can be misleading during prepare. We need a way to block the heartbeat until prepare has finished and set the status to active.