Hi Hemant,

Thanks for reporting this issue on the bug tracker https://bugs.launchpad.net/cinder/+bug/1998083

I did a quick search and no problems with shelving operations have been reported for at least the last two years.I'll bring this bug to the cinder bug meeting this week.

Thanks
Sofia

On Fri, Nov 25, 2022 at 1:15 PM Hemant Sonawane <hemant.sonawane@itera.io> wrote:
Hi Rajat,
It's not about deleting attachments entries but the normal operations from horizon or via cli does not work because of that. So it really needs to be fixed to perform resize, shelve unshelve operations. 

Here are the detailed attachment entries you can see for the shelved instance.


+--------------------------------------+--------------------------------------+--------------------------+--------------------------------------+---------------+-----------------------------------------·

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+             ·

| id                                   | volume_id                            | attached_host            | instance_uuid                        | attach_status | connector                               ·

                                                                                                                                                                                            |             ·

+--------------------------------------+--------------------------------------+--------------------------+--------------------------------------+---------------+-----------------------------------------·

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+             ·

| 8daddacc-8fc8-4d2b-a738-d05deb20049f | 67ea3a39-78b8-4d04-a280-166acdc90b8a | nfv1compute43.nfv1.o2.cz | 9266a2d7-9721-4994-a6b5-6b3290862dc6 | attached      | {"platform": "x86_64", "os_type": "linux·

", "ip": "10.42.168.87", "host": "nfv1compute43.nfv1.o2.cz", "multipath": false, "do_local_attach": false, "system uuid": "65917e4f-c8c4-a2af-ec11-fe353e13f4dd", "mountpoint": "/dev/vda"} |             ·

| d3278543-4920-42b7-b217-0858e986fcce | 67ea3a39-78b8-4d04-a280-166acdc90b8a | NULL                     | 9266a2d7-9721-4994-a6b5-6b3290862dc6 | reserved      | NULL                                    ·

                                                                                                                                                                                            |             ·

+--------------------------------------+--------------------------------------+--------------------------+--------------------------------------+---------------+-----------------------------------------·

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+             ·

2 rows in set (0.00 sec)    


for e.g if I would like to unshelve this instance it wont work as it has a duplicate entry in cinder db for the attachment. So i have to delete it manually from db or via cli 

root@master01:/home/hemant# cinder --os-volume-api-version 3.27 attachment-list --all | grep 67ea3a39-78b8-4d04-a280-166acdc90b8a                                                                         ·

| 8daddacc-8fc8-4d2b-a738-d05deb20049f | 67ea3a39-78b8-4d04-a280-166acdc90b8a | attached | 9266a2d7-9721-4994-a6b5-6b3290862dc6 |                                                                         ·

| d3278543-4920-42b7-b217-0858e986fcce | 67ea3a39-78b8-4d04-a280-166acdc90b8a | reserved | 9266a2d7-9721-4994-a6b5-6b3290862dc6 |

cinder --os-volume-api-version 3.27 attachment-delete 8daddacc-8fc8-4d2b-a738-d05deb20049f

this is the only choice I have if I would like to unshelve vm. But this is not a good approach for production envs. I hope you understand me. Please feel free to ask me anything if you don't understand. 



On Fri, 25 Nov 2022 at 13:20, Rajat Dhasmana <rdhasman@redhat.com> wrote:
Hi Hemant,

If your final goal is to delete the attachment entries in the cinder DB, we have attachment APIs to perform these tasks. The command useful for you is attachment list[1] and attachment delete[2].
Make sure you pass the right microversion i.e. 3.27 to be able to execute these operations.

Eg:
cinder --os-volume-api-version 3.27 attachment-list


On Fri, Nov 25, 2022 at 5:44 PM Hemant Sonawane <hemant.sonawane@itera.io> wrote:
Hello  
I am using wallaby release openstack and having  issues with cinder volumes as once I try to delete, resize or unshelve the shelved vms the volume_attachement entries do not get deleted in cinder db and therefore the above mentioned operations fail every time. I have to delete these volume_attachement entries manually then it works. Is there any way to fix this issue ?

nova-compute logs:

cinderclient.exceptions.ClientException: Unable to update attachment.(Invalid volume: duplicate connectors detected on volume

Help will be really appreciated Thanks !
--
Thanks and Regards,

Hemant Sonawane



--
Thanks and Regards,

Hemant Sonawane



--

Sofía Enriquez

she/her

Software Engineer

Red Hat PnT

IRC: @enriquetaso