Defer updating role and vrrp_priority for failover

During failover process, the new amphorae db info will be populated by
the old one, including 'role' and 'vrrp_priority', which both will be
updated again after plug_network. What's more, 'role' will be an
appropriate flag for failover monitoring tool to decide whether or not
the failover process is almost finished.

Change-Id: I9602b92b36ef265f8ae7c9171170cd86353b2944
This commit is contained in:
Lingxian Kong 2016-04-14 13:31:00 +12:00
parent a0fd4c23ac
commit 747d45f66b
2 changed files with 3 additions and 6 deletions

View File

@ -379,14 +379,13 @@ class UpdateAmpFailoverDetails(BaseDatabaseTask):
:param loadbalancer_id: The load balancer ID to lookup
:param mps_data: The load balancer ID to lookup
"""
# role and vrrp_priority will be updated later.
self.repos.amphora.update(db_apis.get_session(), amphora.id,
vrrp_ip=amp_data.vrrp_ip,
ha_ip=amp_data.ha_ip,
vrrp_port_id=amp_data.vrrp_port_id,
ha_port_id=amp_data.ha_port_id,
role=amp_data.role,
vrrp_id=amp_data.vrrp_id,
vrrp_priority=amp_data.vrrp_priority)
vrrp_id=amp_data.vrrp_id)
class AssociateFailoverAmphoraWithLBID(BaseDatabaseTask):

View File

@ -494,9 +494,7 @@ class TestDatabaseTasks(base.TestCase):
ha_ip=HA_IP,
vrrp_port_id=VRRP_PORT_ID,
ha_port_id=HA_PORT_ID,
role=AMP_ROLE,
vrrp_id=VRRP_ID,
vrrp_priority=VRRP_PRIORITY)
vrrp_id=VRRP_ID)
@mock.patch('octavia.db.repositories.AmphoraRepository.associate')
def test_associate_failover_amphora_with_lb_id(