<div dir="ltr"><div dir="ltr">Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 8, 2021 at 1:02 AM dmeng <<a href="mailto:dmeng@uvic.ca">dmeng@uvic.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hello there,</p>
<p>Hope everything is going well.</p>
<p>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:</p>
<pre># create the volume
cv = cinder.create_volume(name=bv_name, size=size, image_id=<a href="http://imageobj.id" target="_blank">imageobj.id</a>, volume_type=volume_type, is_bootable=True) 
# format mapping data
bdm = [{'uuid': <a href="http://cv.id" target="_blank">cv.id</a>, 'source_type': 'volume', 'destination_type': 'volume', 'delete_on_termination': True, 'boot_index': 0}]
# create the vm
nova.create_server(name=hostname, image_id=<a href="http://imageobj.id" target="_blank">imageobj.id</a>, flavor_id=<a href="http://flavorl.id" target="_blank">flavorl.id</a>, key_name=key_name, block_device_mapping=bdm, user_data=format_userdata, networks=netid, security_groups=sec_groups)<br><br></pre>
<pre>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?<br><br>We tried the command line tools 'openstack volume set --state available <volume_id>' and 'cinder reset-state --state available <volume_id>', but both got:<br>Policy doesn't allow volume_extension:volume_admin_actions:reset_status to be performed. (HTTP 403) (Request-ID: req-b50236c3-5662-4cc0-8602-19e79e80219d)<br>ERROR: Unable to reset the state for the specified entity(s).<br><br></pre></div></blockquote><div>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<b> ``cinder --os-volume-api-version 3.27 attachment-list`` </b>to list all attachments for volumes and if there exists attachment(s) for your volume, you can delete them via the command  <b>``cinder --os-volume-api-version 3.27 attachment-delete <attachment-id>``</b></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif"><pre>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?<br><br>Thanks and have a great day!<br>Catherine</pre></div></blockquote><div><br></div><div>Thanks and regards</div><div>Rajat Dhasmana </div></div></div>