diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py index 16d4c321..2955335c 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_lb_resources.py @@ -959,6 +959,22 @@ class TestPolicyLBVirtualServer(test_resources.NsxPolicyLibTestCase): tenant=TEST_TENANT) self.assert_called_with_def(update_call, expected_def) + def test_non_partial_update(self): + obj_id = '111' + vs_name = 'name-name' + with self.mock_get(obj_id, vs_name, max_concurrent_connections=80), \ + self.mock_create_update() as update_call: + self.resourceApi.update(obj_id, + max_concurrent_connections=None, + tenant=TEST_TENANT, + allow_partial_updates=False) + expected_def = lb_defs.LBVirtualServerDef( + virtual_server_id=obj_id, name=vs_name, + max_concurrent_connections=None, + tenant=TEST_TENANT) + update_call.assert_called_with(mock.ANY, partial_updates=False) + self.assert_called_with_def(update_call, expected_def) + def test_add_lb_rule(self): vs_obj_id = '111' vs_name = 'name-name' diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index 21d0ef91..b97aa87a 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -142,10 +142,10 @@ class NsxPolicyResourceBase(object): return resource_def - def _update(self, **kwargs): + def _update(self, allow_partial_updates=True, **kwargs): """Helper for update function - ignore attrs without explicit value""" - - if self.policy_api.partial_updates_supported(): + if (allow_partial_updates and + self.policy_api.partial_updates_supported()): policy_def = self._init_def(**kwargs) partial_updates = True else: diff --git a/vmware_nsxlib/v3/policy/lb_resources.py b/vmware_nsxlib/v3/policy/lb_resources.py index d8953c3b..325ccb95 100644 --- a/vmware_nsxlib/v3/policy/lb_resources.py +++ b/vmware_nsxlib/v3/policy/lb_resources.py @@ -754,7 +754,8 @@ class NsxPolicyLoadBalancerVirtualServerAPI(NsxPolicyResourceBase): max_concurrent_connections=IGNORE, access_list_control=IGNORE, tags=IGNORE, - tenant=constants.POLICY_INFRA_TENANT): + tenant=constants.POLICY_INFRA_TENANT, + allow_partial_updates=True): @utils.retry_upon_exception( nsxlib_exc.StaleRevision, @@ -777,7 +778,8 @@ class NsxPolicyLoadBalancerVirtualServerAPI(NsxPolicyResourceBase): waf_profile_binding=waf_profile_binding, max_concurrent_connections=max_concurrent_connections, access_list_control=access_list_control, - tags=tags) + tags=tags, + allow_partial_updates=allow_partial_updates) _update()