atrocitytheme opened a new pull request, #5216:
URL: https://github.com/apache/cloudstack/pull/5216

   ### Description/Report
   
   This PR adds a Clone VM feature at the API level (as part of GSoC project 
#4818), which enables the creation of a fully-cloned virtual machine with ROOT 
/ DATA disks, and the same system configuration as the original VM. (Currently 
Supported for KVM hypervisor only)
   
   Steps involved: 
   1. Creation of temporary snapshots (during the clone VM operation) for both 
ROOT
   2. Creation of template from the ROOT disk snapshot
   3. Create a new VM from the template created in step 2
   4. Automatic assignment of new network resources for the new Cloned VM
   5. Creation of temporary snapshots for data disk
   6. Create data disk Volume from the snapshots created in step 5
   7. Newly created DATA disk created in step 6 is attached to the new VM
   8. Cleanup of temporary resources (snapshots) and error handling of the 
clone VM process
   
   Note: The template created in step 2 cannot be cleaned up as the newly 
created clone VM uses this template
   
   Feature included: 
   - A new CloneVmCmd API interface to use this feature
   - A clone button in the compute instance page supporting the related 
functionalities
   
   ### Documentation
   - Documentation PR: 
https://github.com/apache/cloudstack-documentation/pull/236
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] 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
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   ![Clone 
Scene](https://github.com/atrocitytheme/atrocitytheme.github.io/blob/7428f0e73c980669a46202da124daca3bf958975/cloudstack.png?raw=true)
   
   ### 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. -->
   This has been manually tested with a mbx KVM setup on a local machine and 
mbx kvm setup on GCP
   
   - This feature has been tested on a local Linux system with KVM support 
(5.3.0-64-generic Ubuntu) and Google Cloud instance (4.9.0-15-amd64 Debian)
   - Try with cloudmonkey if the management server is running with default 
configurations.
   ```
   cloneVirtualMachine virtualmachineid=<target_vm_id>
   ```
   will start the cloning process, it'll create a new cloned VM and start it 
(with all copied data available), network Ip will be assigned to DB instantly 
and the actual VM will get this IP after a while
   - When secondary system VM agents are not available, the cloning process 
will fail and clean the previously cloned resources
   - It'll copy all the data disk content from the target VM no matter whether 
the data disks are mounted in the VM system or the VM is running
   - Temporary resources created (snapshots) during the process will not remain 
whether the clone succeeds or not
   - New smoke test has been added in test_vm_life_cycle.py with class 
TestCloneVM, which tests the clone of a VM with data disk attached.
   - New unit test has been added as validateCloneCondition in the 
UserVmManagerImpl class
   - Manual test of Clone: in the VM page, there's a clone VM button, click it 
and it'll clone a new VM if with the correct hypervisor setup. 
   ### GCP environment setup
   - Create a GCP instance with nested virtualization enabled, for detailed 
requirements see: 
https://cloud.google.com/compute/docs/instances/nested-virtualization/overview
   - After creating the instance, deploy a KVM host using mbx: 
https://github.com/shapeblue/mbx (centos7)
   - Before deploying and configuring the cloudstack agent, enable the system 
nested kvm by: 
   ```
   cat /sys/module/kvm_intel/parameters/nested
   // if return N
   sudo modprobe -r kvm_intel
   sudo modprobe kvm_intel nested=1 
   ```
   <!-- 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: [email protected]

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

Reply via email to