GutoVeronezi opened a new pull request #5297:
URL: https://github.com/apache/cloudstack/pull/5297


   ### Description
   
   This PR solves issue #5124.
   
   The main focus of it is to change how volume snapshots are taken in KVM. 
However, this proposal of changing `take snapshot` workflow in KVM impacts 
others snapshot workflows as well. The impacted workflows we mapped are:
   - Take volume snapshot with running vm
   - Take volume snapshot with stopped vm
   - Recurring volume snapshot
   - Create volume from snapshot
   - Create template from snapshot
   - Migrate volumes
   - Migrate virtual machine with volumes
   - Revert volume snapshot
   - Delete volume snapshot
   
   Issue #5124 has more details and flowcharts of all the mapped workflows.
   
   The focus of this PR is to refactor KVM snapshot, others hypervisors 
workflows should not be affected.
   
   ### 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)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [x] Major
   - [ ] Minor
   
   ### How Has This Been Tested?
   I added unit tests to several methods and tests were executed as follows:
   
   - Created VM `Test1`;
   - Opened VM `Test1`'s console;
   - Ran command `echo gold > testfile`;
   - Ran command `cat testfile`: `gold`;
   - Took volume snapshot: `gold`;
   - Ran command `echo silver > testfile`;
   - Ran command `cat testfile`: `silver`;
   - Configured recurring snapshot - hourly - ASAP;
   - Waited for scheduled snapshot; (I will call this one as `silver` to 
simplify things);
   - Removed recurring snapshot configuration;
   - Destroyed VM `Test1`;
   - Created template with snapshot `silver`: `template silver`;
   - Created VM `Test2` with template `template silver`;
   - Opened VM `Test2`'s console;
   - Ran command `cat testfile`: `silver`;
   - Destroyed VM `Test2`;
   - Created volume with snapshot `gold`: `volume gold`;
   - Created VM `Test3` with ubuntu 20.04 ISO;
   - Stopped VM `Test3`;
   - Detached root volume;
   - Attached `volume gold` to VM `Test3` as root;
   - Ran command `cat testfile`: `gold`;
   - Ran command `echo copper > testfile`;
   - Ran command `cat testfile`: `copper`;
   - Stopped VM `Test3`;
   - Took volume snapshot: `copper`;
   - Ran VM 'Test3';
   - Ran command `echo platinum > testfile`;
   - Ran command `cat testfile`: `platinum`;
   - Took volume snapshot: `platinum`;
   - Called api `migrateVirtualMachineWithVolume` for VM `Test3`;
   - Stopped VM `Test3`;
   - Migrated volume;
   - Reverted volume to snapshot `copper`;
   - Started VM `Test3`;
   - Ran command `cat testfile`: `copper`;
   - Stopped VM `Test3`;
   - Reverted volume to snapshot `platinum`;
   - Started VM `Test3`;
   - Ran command `cat testfile`: `platinum`;
   - Stopped and delete VM `Test3;
   - Deleted all snapshots;
   
   I followed these steps with `snapshot.backup.to.secondary` as `true` and 
`false`. The only difference is that when it is `false`, ACS will not allow 
users to migrate VMs that have snapshots taken in the primary storage to a new 
primary storage.


-- 
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: [email protected]

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


Reply via email to