From 69bd88119f5dc990452c79699915b3dd86dad242 Mon Sep 17 00:00:00 2001 From: Thomas Parrott Date: Fri, 9 Aug 2024 08:36:41 +0100 Subject: [PATCH] lxd/storage/backend/lxd: Pass full snapshot name when validating import in CreateInstanceFromBackup Fixes #13879 Signed-off-by: Thomas Parrott --- lxd/storage/backend_lxd.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go index b0f6ab56b1cc..3150c55864dc 100644 --- a/lxd/storage/backend_lxd.go +++ b/lxd/storage/backend_lxd.go @@ -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 }