Not able create snapshot through zfs snapshot STORAGE_NAME/containers/CONTAINERS_NAME@snapshot-SNAPSHOT-NAME due to invalid argument = in its name

cannot create snapshot ‘sdb1t/containers/test@snapshot-2020-03-18=03-07’: invalid character ‘=’ in name

try to rename it but getting the same error invalid character

I need it to delete the container but i am stuck here.
thank you for help in advance

Oh, that’s an interesting one.

@tomp looks like we need to put a ZFS-specific restriction in place when creating volume snapshots.

@Madhvi_Chauhan the error is about creating the snapshot though, so not sure how that affects deleting the container. Can you give us more details on exactly what you’re trying to do? Is it a case where the snapshot doesn’t exist on ZFS but LXD thinks it does?

If so, can you show lxd sql global "SELECT * FROM instances_snapshots;" and lxd sql global "SELECT * FROM storage_volumes_snapshots;"

I am trying to delete the lxd container but there is a snapshot containg = in it’s name.
When I run lxc list
It shows the snapshot but when I tried to delete it shows dataset issue
So I decide to create the snapshot through zfs but then it gives error of can’t create due to invalid argument.
Which I mentioned above.
Name of snapshot is 2020-03-18=03-07

Ok, the output of those commands I asked should let us figure out how to get rid of the snapshot.

lxc info test
Name: test
Location: none
Remote: unix://
Architecture: x86_64
Created: 2020/03/11 08:33 UTC
Status: Stopped
Type: container
Profiles: default
2020-03-18=03-07 (taken at 2020/03/18 09:37 UTC) (stateless)
lxc delete test/2020-03-18=03-07

Error: Failed to run: zfs get -H -p -r -o value clones sdb/containers/test@snapshot-2020-03-18=03-07: cannot open ‘sdb/containers/test@snapshot-2020-03-18=03-07’: invalid character ‘=’ in name

So the issue here is that although the snapshot creation has failed, the database record remains and is not reverted, I’ll look at fixing this now (have re-created locally).

In the meantime this can be fixed with the below commands (this assumes you only have 1 snapshot called 2020-03-18=03-07 on a single container):

lxd sql global 'delete from storage_volumes_snapshots where name="2020-03-18=03-07"'
lxc delete test/2020-03-18=03-07

This PR should prevent the issue happening in the future:

Thank you so much this resolve my issue