[lxc-users] Cannot remove a volume that has snapshots

gunnar.wagner gunnar.wagner at netcologne.de
Sat May 9 18:31:45 UTC 2020


> I was unfortunate to choose my containers name such that LXD thinks one is a snapshot of the
> other.
hm. Not sure whether this is the explanation. The volume of a snapshot 
of test04 would be named *test04/second* and not *test04-second*. (at 
least it is that scheme I get with 'lxc storage volume list pool2'(and 
also is the naming scheme you use to delete snapshots)

So, if that naming has some sort of relevance as you suspect It smells 
more like a bug then a feature

> And what interesting is that you can only use a hyphen as a separator, not
> an underscore.
can't confirm that neither. My snapshots all have names like 
'pre-some_string' and have never seen any problem with that.



On 5/8/20 7:38 PM, Kees Bakker wrote:
> Ah, I found out what is causing this. I was unfortunate to choose
> my containers name such that LXD thinks one is a snapshot of the
> other.
>
> Simple test
>
> root at rapper:~# lxc init images:ubuntu/bionic/amd64 -p pool2 test04-second
> Creating test04-second
> root at rapper:~# lxc init images:ubuntu/bionic/amd64 -p pool2 test04
> Creating test04
> root at rapper:~# lxc delete test04
> Error: Error deleting storage volume: Cannot remove a volume that has snapshots
>
> Also renaming (moving) doesn't work for this one.
>
> root at rapper:~# lxc move test04 test04-first
> Error: Rename instance: Failed to run: lvrename /dev/rapper-vg2/containers_test04---second /dev/rapper-vg2/containers_test04--first---second: Existing logical volume "containers_test04---second" not found in volume group "rapper-vg2"
>
> And what interesting is that you can only use a hyphen as a separator, not
> an underscore.
>
> root at rapper:~# lxc init images:ubuntu/bionic/amd64 -p pool2 test04_first
> Creating test04_first
> Error: Failed instance creation: Invalid instance name: Name can only contain alphanumeric and hyphen characters
>
> Now I have to find a trick to mislead LXD so that the containers
> can be deleted.
> -- Kees
>
> On 07-05-2020 09:03, Kees Bakker wrote:
>> Hi,
>>
>> When I want to delete a container I'm getting this error
>>
>> root at ijssel:~# lxc delete jenkins
>> Error: Error deleting storage volume: Cannot remove a volume that has snapshots
>>
>> However, it has no snapshots.
>>
>> root at ijssel:~# lxc info jenkins
>> Name: jenkins
>> Location: ijssel
>> Remote: unix://
>> Architecture: x86_64
>> Created: 2020/04/24 09:01 UTC
>> Status: Stopped
>> Type: container
>> Profiles: default
>>
>> This is on Ubuntu 20.04 with lxd 4.0.1 (14954) from snap.
>> The storage is lvm.
>>
>> There is a little bit of history that is of interest.
>> I had a container, "jenkins-template", with a snapshot.
>> Then I did a "lxc copy" of that snapshot to a new container,
>> called "jenkins", the one that I'm trying to delete now.
>> In the meantime I have already deleted the snapshot of "jenkins-template",
>> because I thought that would help.
>> Now, there are no snapshots at all on the system. Still, the
>> delete gives me that error.
>>
>> root at ijssel:~# lxc list
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> |         NAME         |  STATE  |         IPV4         | IPV6 |   TYPE    | SNAPSHOTS | LOCATION |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | jenkins              | STOPPED |                      |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | jenkins-master1      | RUNNING | 172.16.16.28 (eth0)  |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | jenkins-sirti        | RUNNING | 172.16.16.104 (eth0) |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | jenkins-slave001     | RUNNING | 10.189.232.51 (eth0) |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | jenkins-template     | STOPPED |                      |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | jenkins-template-old | STOPPED |                      |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>> | mindmap              | RUNNING | 172.16.16.166 (eth0) |      | CONTAINER | 0         | ijssel   |
>> +----------------------+---------+----------------------+------+-----------+-----------+----------+
>>
>> root at ijssel:~# lvs
>>    LV                                                                      VG    Attr       LSize   Pool        Origin Data%  Meta%  Move Log Cpy%Sync Convert
>>    LXDThinPool                                                             local twi-aotz--  <3,41t                    3,83   3,34
>>    containers_jenkins                                                      local Vwi-a-tz--  <9,32g LXDThinPool        15,04
>>    containers_jenkins--master1                                             local Vwi-aotz-- <18,63g LXDThinPool        9,57
>>    containers_jenkins--sirti                                               local Vwi-aotz-- 465,66g LXDThinPool        26,40
>>    containers_jenkins--slave001                                            local Vwi-aotz--  <9,32g LXDThinPool        9,91
>>    containers_jenkins--template                                            local Vwi-a-tz--  <9,32g LXDThinPool        12,58
>>    containers_jenkins--template--old                                       local Vwi-a-tz--  <9,32g LXDThinPool        28,78
>>    containers_mindmap                                                      local Vwi-aotz-- <18,63g LXDThinPool        14,75
>>    images_8e0308c73fb2a54a048916915a3437208cfa6fd9fb7e176ad75557f49b8eb522 local Vwi-a-tz--  <9,32g LXDThinPool        6,80
>>    images_8e0f49176d7fc999becd40194a92231551c3d5109bd9327c443592443ba5e841 local Vwi-a-tz--  <9,32g LXDThinPool        6,84
>>    home                                                                    vg0   -wi-ao----  50,00g
>>    root                                                                    vg0   -wi-ao---- 100,00g
>>
>>
>> How can I delete the container "jenkins"?
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users

-- 
Gunnar Wagner | Yongfeng Village Group 12 #5, Pujiang Town, Minhang 
District, 201112 Shanghai, P.R. CHINA
mob +86.159.0094.1702 | skype: professorgunrad | wechat: 15900941702
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20200509/bfb2ccd5/attachment.htm>


More information about the lxc-users mailing list