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

Đang mở Phù hợp với người mới
#14,013 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, shell
Lĩnh vực
backend, infrastructure

Hướng nghiên cứu

Bắt đầu tại LibvirtRestoreBackupCommandWrapper và kiểm tra cách mountOptions được truyền vào Script.executeCommand; so sánh với cách xử lý shell trong nasbackup.sh. Tái hiện quá trình khôi phục bằng một tùy chọn repository có khoảng trắng ở cuối, sau đó xác minh rằng quá trình khôi phục thành công và hành vi hiện có của lệnh mount vẫn được giữ nguyên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

component:backup
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 <redacted> 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

Ngôn ngữ chính
Java
Star
3.1k
Fork
1.4k
Merge trung bình
7 ngày 5 giờ
Pull request đã merge (30 ngày)
28

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/cloudstack

Tất cả issue của apache/cloudstack

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.