slapgrid: Fix connectionless instance processing
Fix two bugs in instance processing without connection to master (see !515 (merged))
-
Connection loss may result in
slap.exception.ConnectionError
being raised during instance processing in addition toRequestException
: this case needs to be taken into account to correctly fallback to offline processing. -
When upgrading from a version of slapos.core that does not support processing instances without a connection to master to one that does, the following edgecase could occur:
- some partition is stopped and processed with old version
- slapos.core is upgraded
- connection to master is lost
- offline processing wrongly starts the services of stopped partition
This was because the new version removes the supervisord file for a partition when the partition is stopped (in online mode) so that the offline mode can just start all the existing supervisord files. But since the partitions was never processed in online mode with the new version, this file was never removed.
To fix this, we use the (now no longer used )
.requested_state
file of the previous version to determine the state of the partition in offline mode, then we remove both the.requested_state
file and the supervisord file, fixing the discrepancy.