diff --git a/pkg/compute/models/backup.go b/pkg/compute/models/backup.go index 72b7be79f1..e2c3185f0b 100644 --- a/pkg/compute/models/backup.go +++ b/pkg/compute/models/backup.go @@ -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 diff --git a/pkg/hostman/storageman/storage_local.go b/pkg/hostman/storageman/storage_local.go index 16025a3a02..1c42ba7b4e 100644 --- a/pkg/hostman/storageman/storage_local.go +++ b/pkg/hostman/storageman/storage_local.go @@ -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{