func validateSnapshot()

in pkg/nfs/controllerserver.go [851:866]


func validateSnapshot(snapInternalVolPath string, snap *nfsSnapshot) error {
	return filepath.WalkDir(snapInternalVolPath, func(path string, d fs.DirEntry, err error) error {
		if path == snapInternalVolPath {
			// skip root
			return nil
		}
		if err != nil {
			return err
		}
		if d.Name() != snap.archiveName() {
			// there should be just one archive in the snapshot path and archive name should match
			return status.Errorf(codes.AlreadyExists, "snapshot with the same name but different source volume ID already exists: found %q, desired %q", d.Name(), snap.archiveName())
		}
		return nil
	})
}