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

   ### Description
   
   This PR fixes #11257.
   
   - Libvirt backs up the volumes in the order of their `deviceId`.
   - However, during restore, volumes are processed based on their `id` in the 
`volumes` table.
   - If data volume has a lower `id` in the `volumes` table than the root 
volume, restore mistakenly assumes the data disk to be the root disk.
   - Restore fails silently, without any error
   
   
   Another minor issue exists with Volume attach and detach operations on 
Instances that have an associated backup offering:
   - Attach and Detach operations use different logic when handling Instances 
with backup offerings.
   - **Detach fails** if the Instance was associated with a backup offering but 
has no backups yet.
   - In contrast, **Attach succeeds** under the same conditions.
   
   ### Changes done ###
   
   1. Sorting the volumes list by deviceId before restore and also before 
saving the backedVolumes in the backup table.
   2. Return proper error from LibvirtRestorebackupCommand in case of any error 
instead of failing silently.
   3. Using consistent logic in Attach and Detach Volume.
   
   <!-- 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)
   - [x] 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)
   - [ ] build/CI
   - [ ] test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   #### Bug Severity
   
   - [x] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   1. Verified with the test case mentioned in the Issue. Restore passed with 
the correct data.
   2. Repeated the test case mentioned in the Issue with just the fix for 
returning proper error from restore. Restore failed with an error.
   3. Tested backup and restore with stopped and running Instances
   4. Tested attach and detach volume on Instance having backup offering but no 
backups.
   5. Tested attach and detach volume on Instance having backups.
   
   <!-- 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

Reply via email to