Skip to content

Commit

Permalink
lxd/storage/backend/lxd: Pass full snapshot name when validating impo…
Browse files Browse the repository at this point in the history
…rt in CreateInstanceFromBackup

Fixes #13879

Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Aug 9, 2024
1 parent 9ba8942 commit 69bd881
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lxd/storage/backend_lxd.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,16 @@ func (b *lxdBackend) CreateInstanceFromBackup(srcBackup backup.Info, srcData io.
}

for _, snapName := range srcBackup.Snapshots {
err = instance.ValidName(snapName, true)
snapInstName := fmt.Sprintf("%s%s%s", srcBackup.Name, shared.SnapshotDelimiter, snapName)
err = instance.ValidName(snapInstName, true)
if err != nil {
return nil, nil, err
}
}

for _, snap := range srcBackup.Config.Snapshots {
err = instance.ValidName(snap.Name, true)
snapInstName := fmt.Sprintf("%s%s%s", srcBackup.Name, shared.SnapshotDelimiter, snap.Name)
err = instance.ValidName(snapInstName, true)
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 69bd881

Please sign in to comment.