-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix issue where security group selection is shown regardless of zone settings in EditVM #10224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue where security group selection is shown regardless of zone settings in EditVM #10224
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
|
@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #10224 +/- ##
============================================
- Coverage 16.13% 16.13% -0.01%
+ Complexity 12967 12966 -1
============================================
Files 5639 5639
Lines 494264 494263 -1
Branches 59899 59898 -1
============================================
- Hits 79760 79759 -1
+ Misses 405684 405683 -1
- Partials 8820 8821 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
UI build: ✔️ |
rohityadavcloud
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, didn't test it though
|
thanks for pointing this one out @rohityadavcloud . |
|
checked as #10849 looks ok |
Description
In CloudStack, the security group selection box is displayed when editing a VM, regardless of whether the zone supports security groups or not. This causes the
securitygroupidsparameter to be sent with the request even if no security group is selected. If the zone is of typeNetworkType.Advancedand does not support security groups, this triggers aNullPointerExceptionin theUserVmManagerImpl.updateVirtualMachinemethod when callingisSecurityGroupSupportedInNetwork.Upon investigation, it was found that the
listZonesAPI call, which is used to fetch the zone details, incorrectly useszoneidinstead ofidfor the zone identifier. This prevents the correct zone information from being retrieved. Additionally, since thelistZonesAPI does not properly filter zones, it fetches all zones and always takes the first one in the list (index 0) to determine whether security groups are enabled. Consequently, if that first zone supports security groups, the security group selection box is displayed in the UI—even if the zone actually used by the VM does not support them.Moreover, the logic for checking whether the security group selection box is empty is not strict enough, which causes the
securitygroupidsparameter to be included in the request even when the selection box is empty.Proposed Solution
listZonesAPI by usingidinstead ofzoneid.listZonesAPI call to ensure that only the relevant zone is considered when checking for security group support.securitygroupidsparameter to the request.Modified Files
EditVM.vuePR Changes
zoneidinlistZonescalls to properly retrieve the VM’s zone details.securitygroupidsfrom being included if no security group is actually selected.NullPointerExceptionwhen editing VMs inNetworkType.Advancedzones that do not support security groups.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
How Has This Been Tested?
Local Dev Environment
securitygroupidsis sent to the backend.NullPointerExceptionis thrown even ifsecuritygroupidsisnullor empty.UI Validation
EditVM.vueproperly filters the correct zone fromlistZones.securitygroupids.How did you try to break this feature and the system with this change?
securitygroupids, verifying that no NPE occurs.