apache / apache/cloudstack

Nas backup restore fails if the backup repository mount options have a trailing space

オープン 初心者向け
#14,013 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
component:backup
主要言語
Java
スター
3.1k
フォーク
1.4k
平均マージ
6日 19時間
マージ済み PR(30日)
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 のシェル処理と比較します。末尾に空白を含むリポジトリオプションを使ってリストアを再現し、その後、リストアが成功することと、既存の mount コマンドの動作が変わらないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, shell
領域
backend, infrastructure
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
76/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。