RodrigoDLopez opened a new pull request #4194:
URL: https://github.com/apache/cloudstack/pull/4194


   ## Description
   <!--- Describe your changes in detail -->
   
   On this PR [#2636]((https://github.com/apache/cloudstack/pull/2636)), 
@rafaelweingartner proposed a consistent validation mechanism to select a 
storage pool to deploy a volume when a virtual machine is deployed or when a 
new data disk is allocated.
   The following table presents the scenarios when the storage_pool supports or 
not a new data disk.
   
   | #  | Disk offering tags    | Storage tags  | Does the storage support the 
disk offering?   |
   |---| ---                                    | ---                   | ---   
                                                                                
|
   | 1  | A,B                                   | A                             
| NO                                                                            
        |
   | 2  | A,B,C                                 | A,B,C,D,X             | YES   
                                                                                
|
   | 3  | A,B,C                                 | X,Y,Z                 | NO    
                                                                                
|
   | 4  | null                                  | A,S,D                 | YES   
                                                                                
|
   | 5  | A                                             | null                  
| NO                                                                            
        |
   | 6  | null                                  | null                  | YES   
                                                                                
|
   
   
   With that in mind, this PR enables `updateDiskOfferingCmd` to edit storage 
pool tags for `diskoffering`. Thus, providing greater control to ADMINS decide 
where disks will be allocated.
   
   <!-- 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: # -->
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the 
boxes that apply: -->
   - [ ] 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)
   
   ## Screenshots (if appropriate):
   ![Screenshot from 2020-06-30 
14-51-39](https://user-images.githubusercontent.com/19981369/86246469-694c3a00-bb81-11ea-9c62-484fa2e56704.png)
   
   ## How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   <!-- see how your change affects other areas of the code, etc. -->
   
   To test the PR i created 2 storage pools.
   Storage Pools:
   - spool01            with tag hdd
   - spool02            with tag hdd2
   
   And create one disk Offering:
   - Test               without tag
   
   #### Test 01
   - Create a volume using Test diskoffering
   - Attach the volume to an instance
   - Update the disk's diskoffering to another one that has a tag that does not 
have a corresponding Storage pool
   - Detach the volume
   - try to migrate the disk
   
   **Expected:** we expect an exception since no storage tags match with the 
diskoffering tag
   **Result:** 
   ```
   Migration target pool [null, tags:null] has no matching tags for volume 
[small, uuid:ce026b50-8b04-44d6-bb66-3d324b64ca7d, tags:fake]
   ```
   
   #### Test 02
   - Using the same volume from Test 01
   - Update the disk's diskoffering tag to hdd2
   - try to migrate the disk to spool02
   
   **Expected:** Migrate the volume to spool02 storage.
   **Result:** all good, as expected
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to