TWSD-1308 - Virtual and real services should not delete if these are attached to any policies.

Review Request #1342 — Created Jan. 29, 2026 and submitted

shuinvy
APV10
rel_apv_10_7
TWSD-1308
kevin.poh, mingji, peteryeh

Forbidden deleting Real Service or Virtual Service if it bind any policy or Real Service Group

The Jira ticket is:
https://arraynetworks.atlassian.net/browse/TWSD-1308

The scenario is:
1. If a RS bind any Real Service Group, then it cannot be deleted
2. If a RS bind any Policy(Static Policy), then it cannot be deleted
3. If a RS doesn't bind any Real Service Group or Policy, it can be deleted
4. If a VS bind any Policy, then it cannot be deleted.
5. If a VS doesn't bind any Policy, then it can be deleted.

I have checked both CLI and WebUI,
you can see attachment for reference.

For WebUI changes,
the deletion API of RS is delete_rs_custom, it doesn't handle case if CLI return error message,
so I fix it.

For CLI changes,
I wrote some function in slb_rs_group_kern.c to check:
1. Is a RS bind any Static Policy(It is relationship between a VS and RS, so we should find VS to check the static policy member)
2. Is a VS bind any policy. I found there is structure with the information: slb_vs_t, so I use it and check it by different type of policy.
3. Is a RS bind any Real Service Group: We can get real_id by its name from slb_real_name_to_id, then check slb_mem for Real Service Group member.
Then I checked RS in no_slb_real_kern whether it is bind Real Service Group or Static Policy and show error message if so.
I also added new error code in proxy_errs.h
To use the function in slb_rs_group_kern.c, I added it to the header file: slb_kern.h,
Then check VS in the function no_slb_virtual_generic_kern of slb_vs_policy_kern.c file.
If the VS bind to any policy,
it will stop continue and show error message.


peteryeh
  1. Ship It!
  2. 
      
mingji
  1. Ship It!
  2. 
      
kevin.poh
  1. Ship It!
  2. 
      
shuinvy
Review request changed

Status: Closed (submitted)

Loading...