Fix repository mount failure during restore due to path format handling#12778
Fix repository mount failure during restore due to path format handling#12778harikrishna-patnala wants to merge 2 commits intoapache:4.22from
Conversation
Restore could fail when the backup repository address was specified in formats such as \\server\share. The restore logic built a raw shell command which caused backslashes to be interpreted as escape characters, resulting in an invalid mount path. Execute the mount command using Script.executePipedCommands() so the repository path is passed as an argument instead of being embedded in a shell command string.
|
@blueorangutan package |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12778 +/- ##
=========================================
Coverage 17.61% 17.61%
+ Complexity 15666 15665 -1
=========================================
Files 5917 5917
Lines 531400 531415 +15
Branches 64970 64971 +1
=========================================
+ Hits 93602 93606 +4
- Misses 427244 427254 +10
- Partials 10554 10555 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
did you mean that the issue is because executePipedCommands and runSimpleBashScriptForExitValue work differently ? @harikrishna-patnala |
Yes @weizhouapache I did not tested them separately but based on the issue reported, backup operation was successful with the repository address having back slashes (\). So I followed the same execution method in restore operation as well. |
.../main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
Show resolved
Hide resolved
| @ResourceWrapper(handles = RestoreBackupCommand.class) | ||
| public class LibvirtRestoreBackupCommandWrapper extends CommandWrapper<RestoreBackupCommand, Answer, LibvirtComputingResource> { | ||
| private static final String BACKUP_TEMP_FILE_PREFIX = "csbackup"; | ||
| private static final String MOUNT_COMMAND = "sudo mount -t %s %s %s"; |
There was a problem hiding this comment.
any issues using this pattern? should consider for umount cmd as well?
There was a problem hiding this comment.
This is unused so removed it. Unmount command is straight forward which unmounts the backup directory.
|
@blueorangutan package |
|
@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17064 |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-15592) |
Description
This PR addresses an issue mentioned here #12669
Here we are addressing the mount operation to be same as it does during backup
https://github.com/shapeblue/cloudstack/blob/b7a11cb203aeb9458460e3ce06090172b3a814d1/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtTakeBackupCommandWrapper.java#L71-L84
Types of changes
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?