Merge "Ignore load_balancer graph in task results to avoid break write data in jobboard DB"
This commit is contained in:
@@ -728,7 +728,11 @@ class GetAmphoraNetworkConfigs(BaseNetworkTask):
|
||||
db_lb, amphora=db_amp)
|
||||
provider_dict = {}
|
||||
for amp_id, amp_conf in db_configs.items():
|
||||
provider_dict[amp_id] = amp_conf.to_dict(recurse=True)
|
||||
# Do not serialize loadbalancer class. It's unused later and
|
||||
# could be ignored for storing in results of task in persistence DB
|
||||
provider_dict[amp_id] = amp_conf.to_dict(
|
||||
recurse=True, calling_classes=[data_models.LoadBalancer]
|
||||
)
|
||||
return provider_dict
|
||||
|
||||
|
||||
@@ -746,7 +750,11 @@ class GetAmphoraNetworkConfigsByID(BaseNetworkTask):
|
||||
amphora=amphora)
|
||||
provider_dict = {}
|
||||
for amp_id, amp_conf in db_configs.items():
|
||||
provider_dict[amp_id] = amp_conf.to_dict(recurse=True)
|
||||
# Do not serialize loadbalancer class. It's unused later and
|
||||
# could be ignored for storing in results of task in persistence DB
|
||||
provider_dict[amp_id] = amp_conf.to_dict(
|
||||
recurse=True, calling_classes=[data_models.LoadBalancer]
|
||||
)
|
||||
return provider_dict
|
||||
|
||||
|
||||
@@ -762,7 +770,11 @@ class GetAmphoraeNetworkConfigs(BaseNetworkTask):
|
||||
db_configs = self.network_driver.get_network_configs(db_lb)
|
||||
provider_dict = {}
|
||||
for amp_id, amp_conf in db_configs.items():
|
||||
provider_dict[amp_id] = amp_conf.to_dict(recurse=True)
|
||||
# Do not serialize loadbalancer class. It's unused later and
|
||||
# could be ignored for storing in results of task in persistence DB
|
||||
provider_dict[amp_id] = amp_conf.to_dict(
|
||||
recurse=True, calling_classes=[data_models.LoadBalancer]
|
||||
)
|
||||
return provider_dict
|
||||
|
||||
|
||||
|
||||
@@ -1349,6 +1349,10 @@ class TestNetworkTasks(base.TestCase):
|
||||
AMP_ID = uuidutils.generate_uuid()
|
||||
mock_driver = mock.MagicMock()
|
||||
mock_get_net_driver.return_value = mock_driver
|
||||
amphora_config_mock = mock.MagicMock()
|
||||
mock_driver.get_network_configs.return_value = {
|
||||
"amphora_uuid1": amphora_config_mock
|
||||
}
|
||||
mock_amp_get.return_value = 'mock amphora'
|
||||
mock_lb_get.return_value = 'mock load balancer'
|
||||
|
||||
@@ -1360,6 +1364,9 @@ class TestNetworkTasks(base.TestCase):
|
||||
'mock load balancer', amphora='mock amphora')
|
||||
mock_amp_get.assert_called_once_with(mock_get_session(), id=AMP_ID)
|
||||
mock_lb_get.assert_called_once_with(mock_get_session(), id=LB_ID)
|
||||
amphora_config_mock.to_dict.assert_called_once_with(
|
||||
recurse=True, calling_classes=[o_data_models.LoadBalancer]
|
||||
)
|
||||
|
||||
@mock.patch('octavia.db.repositories.LoadBalancerRepository.get')
|
||||
@mock.patch('octavia.db.api.get_session', return_value=_session_mock)
|
||||
@@ -1368,10 +1375,17 @@ class TestNetworkTasks(base.TestCase):
|
||||
mock_driver = mock.MagicMock()
|
||||
mock_lb_get.return_value = LB
|
||||
mock_get_net_driver.return_value = mock_driver
|
||||
amphora_config_mock = mock.MagicMock()
|
||||
mock_driver.get_network_configs.return_value = {
|
||||
"amphora_uuid1": amphora_config_mock
|
||||
}
|
||||
lb = o_data_models.LoadBalancer()
|
||||
net_task = network_tasks.GetAmphoraeNetworkConfigs()
|
||||
net_task.execute(self.load_balancer_mock)
|
||||
mock_driver.get_network_configs.assert_called_once_with(lb)
|
||||
amphora_config_mock.to_dict.assert_called_once_with(
|
||||
recurse=True, calling_classes=[o_data_models.LoadBalancer]
|
||||
)
|
||||
|
||||
def test_retrieve_portids_on_amphora_except_lb_network(
|
||||
self, mock_get_net_driver):
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Ignore serialization loadbalancer class in GetAmphoraNetworkConfigs tasks.
|
||||
It allows to avoid storing full graph in jobboard details. It fixes cases
|
||||
with enabled jobboard for huge LBs with ~2000+ resources in graph.
|
||||
Reference in New Issue
Block a user