mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
@@ -58,8 +58,8 @@ type SDiskBackup struct {
|
||||
DiskSizeMb int `nullable:"false" list:"user" create:"optional"`
|
||||
DiskType string `width:"32" charset:"ascii" nullable:"true" list:"user" create:"optional"`
|
||||
// 操作系统类型
|
||||
OsType string `width:"32" charset:"ascii" nullable:"true" list:"user" create:"optional"`
|
||||
DiskConfig *SBackupDiskConfig `ignore:"true"`
|
||||
OsType string `width:"32" charset:"ascii" nullable:"true" list:"user" create:"optional"`
|
||||
DiskConfig *SBackupDiskConfig
|
||||
}
|
||||
|
||||
var DiskBackupManager *SDiskBackupManager
|
||||
|
||||
@@ -102,6 +102,13 @@ func (s *SLocalStorage) SyncStorageSize() error {
|
||||
}
|
||||
func (s *SLocalStorage) CreateDiskFromBackup(ctx context.Context, disk IDisk, input *SDiskCreateByDiskinfo) error {
|
||||
info := input.DiskInfo
|
||||
backupDir := s.GetBackupDir()
|
||||
if !fileutils2.Exists(backupDir) {
|
||||
output, err := procutils.NewCommand("mkdir", "-p", backupDir).Output()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "mkdir %s failed: %s", backupDir, output)
|
||||
}
|
||||
}
|
||||
backupPath := path.Join(s.GetBackupDir(), info.Backup.BackupId)
|
||||
if !fileutils2.Exists(backupPath) {
|
||||
_, err := s.storageBackupRecovery(ctx, &SStorageBackup{
|
||||
|
||||
Reference in New Issue
Block a user