[sdk]: Block storage service update volume status from reserved to available
Hello there, Hope everything is going well. I would like to know if there is any method that could update the volume status or reset its state. While we creating volumes use the block storage service or creating vms with volumes use the compute service, sometimes we got volumes stuck in creating/deleteing/attaching/reserved state. And we couldn't remove them or reset their state without an admin account even we own the project. The way we create volumes and boot vms is like the following: # create the volume cv = cinder.create_volume(name=bv_name, size=size, image_id=imageobj.id, volume_type=volume_type, is_bootable=True) # format mapping data bdm = [{'uuid': cv.id, 'source_type': 'volume', 'destination_type': 'volume', 'delete_on_termination': True, 'boot_index': 0}] # create the vm nova.create_server(name=hostname, image_id=imageobj.id, flavor_id=flavorl.id, key_name=key_name, block_device_mapping=bdm, user_data=format_userdata, networks=netid, security_groups=sec_groups) In the normal situation, everything works. But in the case of any network issue, the volume might stuck in the process of creating, deleting, or attaching. And if the volume got created successfully, when it tries to create the vm, the volume will be reserved for it, but if anything wrong happen when creating the vm or get timed out, the volume will be in the reserved stage forever. We would like to know if we could update the state or delete them without the admin account? We tried the command line tools 'openstack volume set --state available <volume_id>' and 'cinder reset-state --state available <volume_id>', but both got: Policy doesn't allow volume_extension:volume_admin_actions:reset_status to be performed. (HTTP 403) (Request-ID: req-b50236c3-5662-4cc0-8602-19e79e80219d) ERROR: Unable to reset the state for the specified entity(s). We are using the chameleon openstack cloud but we are not the admin user there, so wondering if there is any method that we could update the volume in our own project? Thanks and have a great day! Catherine
Hello there,
Hope everything is going well.
I would like to know if there is any method that could update the volume status or reset its state. While we creating volumes use the block storage service or creating vms with volumes use the compute service, sometimes we got volumes stuck in creating/deleteing/attaching/reserved state. And we couldn't remove them or reset their state without an admin account even we own the project. The way we create volumes and boot vms is like the following:
# create the volume cv = cinder.create_volume(name=bv_name, size=size, image_id=imageobj.id, volume_type=volume_type, is_bootable=True) # format mapping data bdm = [{'uuid': cv.id, 'source_type': 'volume', 'destination_type': 'volume', 'delete_on_termination': True, 'boot_index': 0}] # create the vm nova.create_server(name=hostname, image_id=imageobj.id, flavor_id=flavorl.id, key_name=key_name, block_device_mapping=bdm, user_data=format_userdata, networks=netid, security_groups=sec_groups)
In the normal situation, everything works. But in the case of any network issue, the volume might stuck in the process of creating, deleting, or attaching. And if the volume got created successfully, when it tries to create the vm, the volume will be reserved for it, but if anything wrong happen when creating the vm or get timed out, the volume will be in the reserved stage forever. We would like to know if we could update the state or delete them without the admin account?
We tried the command line tools 'openstack volume set --state available <volume_id>' and 'cinder reset-state --state available <volume_id>', but both got: Policy doesn't allow volume_extension:volume_admin_actions:reset_status to be performed. (HTTP 403) (Request-ID: req-b50236c3-5662-4cc0-8602-19e79e80219d) ERROR: Unable to reset the state for the specified entity(s).
For the specific case where a volume is stuck in reserved state and the above code uses cinder's new attachments API, you can use* ``cinder --os-volume-api-version 3.27 attachment-list`` *to list all attachments for volumes and if there exists attachment(s) for your volume, you can delete
Hi, On Wed, Sep 8, 2021 at 1:02 AM dmeng <dmeng@uvic.ca> wrote: them via the command *``cinder --os-volume-api-version 3.27 attachment-delete <attachment-id>``*
We are using the chameleon openstack cloud but we are not the admin user there, so wondering if there is any method that we could update the volume in our own project?
Thanks and have a great day! Catherine
Thanks and regards Rajat Dhasmana
On 08-09-21 10:35:48, Rajat Dhasmana wrote:
Hi,
On Wed, Sep 8, 2021 at 1:02 AM dmeng <dmeng@uvic.ca> wrote:
Hello there,
Hope everything is going well.
I would like to know if there is any method that could update the volume status or reset its state. While we creating volumes use the block storage service or creating vms with volumes use the compute service, sometimes we got volumes stuck in creating/deleteing/attaching/reserved state. And we couldn't remove them or reset their state without an admin account even we own the project. The way we create volumes and boot vms is like the following:
# create the volume cv = cinder.create_volume(name=bv_name, size=size, image_id=imageobj.id, volume_type=volume_type, is_bootable=True) # format mapping data bdm = [{'uuid': cv.id, 'source_type': 'volume', 'destination_type': 'volume', 'delete_on_termination': True, 'boot_index': 0}] # create the vm nova.create_server(name=hostname, image_id=imageobj.id, flavor_id=flavorl.id, key_name=key_name, block_device_mapping=bdm, user_data=format_userdata, networks=netid, security_groups=sec_groups)
In the normal situation, everything works. But in the case of any network issue, the volume might stuck in the process of creating, deleting, or attaching. And if the volume got created successfully, when it tries to create the vm, the volume will be reserved for it, but if anything wrong happen when creating the vm or get timed out, the volume will be in the reserved stage forever. We would like to know if we could update the state or delete them without the admin account?
You need to delete the ERROR'd out instance, this will delete the volume attachment in Cinder moving the volume to available again. Nova does this to ensure another instance doesn't take this volume as the user might request that the instance is rebuilt to workaround whatever issue they encountered during the initial build.
We tried the command line tools 'openstack volume set --state available <volume_id>' and 'cinder reset-state --state available <volume_id>', but both got: Policy doesn't allow volume_extension:volume_admin_actions:reset_status to be performed. (HTTP 403) (Request-ID: req-b50236c3-5662-4cc0-8602-19e79e80219d) ERROR: Unable to reset the state for the specified entity(s).
For the specific case where a volume is stuck in reserved state and the above code uses cinder's new attachments API, you can use* ``cinder --os-volume-api-version 3.27 attachment-list`` *to list all attachments for volumes and if there exists attachment(s) for your volume, you can delete them via the command *``cinder --os-volume-api-version 3.27 attachment-delete <attachment-id>``*
As above we retain the volume attachment on build failures so either rebuild the instance or delete it to free up the volume again. Cheers, -- Lee Yarwood A5D1 9385 88CB 7E5F BE64 6618 BCA6 6E33 F672 2D76
participants (3)
-
dmeng
-
Lee Yarwood
-
Rajat Dhasmana