Nas backup restore fails if the backup repository mount options have a trailing space
- 主要語言
- Java
- 星號
- 3.1k
- 分支
- 1.4k
- 平均合併
- 6 天 19 小時
- 30 天內合併 PR
- 32
描述
### problem
Backup works because mount options are processed inside the shell script `nasbackup.sh` where trailing spaces are not a problem.
But restore (`LibvirtRestoreBackupCommandWrapper`) builds and runs mount in Java
```
if (StringUtils.isNotBlank(mountOptions)) {
mountCmd.add("-o");
mountCmd.add(mountOptions);
}
Script.executeCommand(mountCmd.toArray(new String[0]));
```
Script.executeCommand(String...) builds a ProcessBuilder argument list
mount receives the literal -o "vers=4.1 ". libmount splits options only on commas, so the trailing blank stays glued to the last option, and mount.nfs/the kernel rejects it as a malformed or unknown option ("an incorrect mount option was specified").
`WARN utils.script.Script (logid:435302bd) Process [445800] for command [sudo /usr/bin/mount -t nfs encountered the error: [mount.nfs: an incorrect mount option was specified for /usr/share/cloudstack-agent/tmp/csbackup...`
### versions
ACS 4.22.1
### The steps to reproduce the bug
1. Create a backup repository - specify mount options (`vers=4.1 `) with a trailing space
2. Create backup
3. Restore backup - it fails
...
### What to do about it?
Trim trailing whitespaces before using the mount options
貢獻指南
研究方向
從 LibvirtRestoreBackupCommandWrapper 開始,檢查 mountOptions 如何傳遞給 Script.executeCommand;將其與 nasbackup.sh 中的 shell 處理進行比較。使用帶有尾端空白的儲存庫選項重現還原流程,然後確認還原成功,並驗證現有的 mount 命令行為維持不變。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java, shell
- 領域
- backend, infrastructure
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 活躍
- 描述清晰度
- 描述清楚
- 新手友好度
- 76/100