abh1sar opened a new pull request, #8875: URL: https://github.com/apache/cloudstack/pull/8875
### Description This PR adds the functionality to change the scope of the Primary storage from zone to cluster scope and vice versa. Feature is supported for Hypervisors : KVM and VMware (Simulator will also work) Protocol : NFS and Ceph, and Storage Provider : Default Primary The option for scope change is provided as a new action button to root admin once a Primary storage has been disabled. A new api changeStoragePoolScope handles the execution after doing all relevant checks. It makes DB changes and also connects to the hypervisor hosts to add or remove the storage pool as required. It adds the storage pool to the applicable hosts when the scope is changing from Cluster to Zone. And it removes the storage pool from the hosts when the scope is changing from Zone to Cluster. Management server or the Cloudstack agents don’t need to be restarted for this. Scope change from Zone to Cluster cannot be done if there are volumes associated with running-VMs belonging to other clusters. Api will throw an error in this case. <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [x] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [x] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ![Screenshot from 2024-04-02 02-45-12](https://github.com/apache/cloudstack/assets/63767682/cbfd74b9-2903-46fe-8d6d-393441198f37) ![Screenshot from 2024-04-02 02-45-36](https://github.com/apache/cloudstack/assets/63767682/8ff46892-39bc-4a09-b71a-bb047a632a45) ![Screenshot from 2024-04-02 02-46-30](https://github.com/apache/cloudstack/assets/63767682/dc71b306-dd1e-49e6-a039-a4d817566df0) ### How Has This Been Tested? #### KVM + NFS #### ##### Cluster to Zone ##### 1. Verified that Scope is changing correctly. Hosts in other clusters have the storage pool mounted. 2. New instance on other clusters are able to use the storage pool 3. Offline a host in Cluster C2. Change the scope from C1 to Zone. Online the host and verify that the storage pool gets mounted on the host. ##### Zone to Cluster ##### 1. Verified that Scope is changing correctly. Hosts in other clusters don't have the storage pool mounted. 2. Offline a host in Cluster C2. Change the scope from Zone to Cluster C1. Online the host and verify that the storage pool gets gets removed from the host. 3. Deploy a VM in Cluster C2 having a volume in the Zone wide storage pool. Change scope from Zone to C1 fails as we have a volume from C2 in the storage pool. 4. Repeat of # 2 but the VM is in stopped state. This time scope change from Zone to C1 succeeds. Restart of the VM succeeds in C1 as the storage pool is now present in C1. #### VMware + NFS #### Tested basic functionality. <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> #### How did you try to break this feature and the system with this change? <!-- see how your change affects other areas of the code, etc. --> <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org