Openstack – Delete Cinder Stuck Volume

Recently, I was using Devstack/Ocata version of OpenStack and was trying to  attach/detach volumes to an instance. Every once in a while, volumes would go to an   ‘in-use’ state even after the instance was destroyed.

In fact, even in other releases, I have seen cinder volumes stuck in in-use or error state and sometimes not being able to delete those.

If the volume is in ‘in-use’ status, you first have to change to an available status though before you can issue a delete:

cinder reset-state –state available $VOLUME_ID

cinder delete $VOLUME_ID

If ‘cinder delete’ doesn’t work and you have admin privileges, you can try force-delete.

cinder force-delete $VOLUME_ID

But may be that will fix it. May be it will not. If the volume is still stuck, try going to the database and setting the status of the volume to a detached state:

update volume_attachment setattach_status="detached"where id="<attachment_id>";
update volumes setattach_status="detached"where id="<volume_id>";
Once I did that, I was able to delete or force-delete any stuck volumes. 🙂
Advertisements

Best way to install Openstack – Ocata ( Devstack) Quick Tips

Here we are going to see how to install devstack with some tricks to resolve unknown errors in devstack and local.conf file with stable branch version

Pre-requisites

  • Ubuntu 16.04 ( 14.04 is having compatibility issues with devstack requirements)
  • 8 GB RAM (minimum)

 

Steps:

  1. Clone devstack

git clone https://git.openstack.org/openstack-dev/devstack -b stable/ocata

2. Set permissions

sudo chown -R <username> devstack

sudo chmod 770 devstack

3. cd devstack, create local.conf file and enter details as below

[[local|localrc]]
ADMIN_PASSWORD=admin
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

DEFAULT_VOLUME_GROUP_NAME=stack-volumes-default
PIP_UPGRADE=True
RECLONE=False
DEFAULT_INSTANCE_TYPE=m1.tiny

HOST_IP=<Localhost IP>

#Enable SENLIN
enable_plugin senlin https://git.openstack.org/openstack/senlin
Enable senlin-dashboard
enable_plugin senlin-dashboard https://git.openstack.org/openstack/senlin-dashboard

#Enable HEAT
enable_plugin heat https://git.openstack.org/openstack/heat stable/ocata

#Enable Aodh and ceilometer
CEILOMETER_BACKEND=mongodb
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer stable/ocata
enable_plugin aodh https://git.openstack.org/openstack/aodh stable/ocata

# Enable Gnocchi
enable_plugin gnocchi https://github.com/gnocchixyz/gnocchi stable/4.0
enable_service gnocchi-grafana,gnocchi-api,gnocchi-metricd

 

#Enable LBAAS V2
enable_plugin neutron-lbaas https://github.com/openstack/neutron-lbaas stable/ocata
NEUTRON_LBAAS_SERVICE_PROVIDERV2=”LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default”
enable_service q-lbaasv2

#Enable LBAAS V2 Dashboard
enable_plugin neutron-lbaas-dashboard https://git.openstack.org/openstack/neutron-lbaas-dashboard stable/ocata

#Enable Ocatavia LBAAS v2 Driver
enable_plugin octavia https://git.openstack.org/openstack/octavia stable/ocata
ENABLED_SERVICES+=,octavia,o-cw,o-hk,o-hm,o-api

# Enable Logging

LOGFILE=/opt/stack/logs/stack.sh.log
LOGDAYS=2
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs

4. Create file dev_set.sh and add entry as below

 

                     #!/bin/bash
git config –global url.”https://&#8221;.insteadOf git://
export no_proxy=127.0.0.1, <localhost IP>

save and run source dev_set.sh

 

Note: no_proxy will avoid keystone authentication with localhost IP, few might come across this issue.

 

Common Devstack unknown Errors and tricks to solve

  1. For keystone credentials, run dev_set.sh as mentioned above
  2. For “Could not satisfy constraints for ‘horizon’: installation from path or url cannot be constrained to a version” try “git reset –hard /opt/stack/requirements”, it occurs if do second+ ./stack.sh, easy way.
  3. While Enabling Gnocchi with stable version make sure “uuidgen” is installed else do apt-get install uuid-runtime
  4. To connect to screen, run screen -ls , you can see screen number, now to connect enter screen -r <screen number> and restart services if any changes needed
  5. For Error “[ERROR] /home/pandy/devstack/stackrc:747 Could not determine host ip address. See local.conf for suggestions on setting HOST_IP” open stackrc file and add HOST_IP=<localhost_IP> manually and run. it’s sounds crazy, but works.

Now do stack.sh and enjoy devstack installation, Pooh !!