Fix up failover_host exceptions to preserve states
UnableToFailOver and InvalidReplicationTarget do not save the state of replication_status currently. This patch adds host.save() in order to write the change to the db. In addition, the manager should honor the current replication state of the host when InvalidReplicationTarget is raised instead of forcing it into 'enabled' state. Change-Id: I01af6d70539e518936c74e425c3fad60f4b94581
This commit is contained in:
parent
b31088f0a6
commit
2dbd05452c
|
@ -3297,11 +3297,18 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||
LOG.exception(_LE("Failed to perform replication failover"))
|
||||
service.replication_status = (
|
||||
fields.ReplicationStatus.FAILOVER_ERROR)
|
||||
service.save()
|
||||
exception_encountered = True
|
||||
except exception.InvalidReplicationTarget:
|
||||
LOG.exception(_LE("Invalid replication target specified "
|
||||
"for failover"))
|
||||
service.replication_status = fields.ReplicationStatus.ENABLED
|
||||
# Preserve the replication_status
|
||||
if secondary_backend_id == "default":
|
||||
service.replication_status = (
|
||||
fields.ReplicationStatus.FAILED_OVER)
|
||||
else:
|
||||
service.replication_status = fields.ReplicationStatus.ENABLED
|
||||
service.save()
|
||||
exception_encountered = True
|
||||
except exception.VolumeDriverException:
|
||||
# NOTE(jdg): Drivers need to be aware if they fail during
|
||||
|
|
Loading…
Reference in New Issue