Unable to delete snapshot if its name contains a plus sign '+'

After naming a snapshot “test+sign”, its removal is painful.
Here is the issue

lxc snapshot ct3 test+sign #OK

lxc delete ct3/test+sign # FAILED
Error: Failed to fetch snapshot "test sign" of instance "ct3" in project "default": No such object

It seems the plus sign gets ‘expanded’ and replaced by a blank character just before processing.

nasty workaround

  • lxd sql global ‘delete from storage_volumes_snapshots where name=“test+sign”’
  • lxd sql global ‘delete from instances_snapshots where name=“test+sign”’
  • then, … deleting the subvolume with BTRFS (or similar command for ZFS)
    • btrfs subvolume delete /POOL1/containers-snapshots/ct3/test+sign

That shouldn’t be too hard to fix. I believe we already had to deal with a few similar cases in the past.

Ah, actually, looks like we’re going to have to outright ban + in snapshot names as such snapshots are rejected by at least ZFS…

1 Like