Detaching volumes from an instance

As Cinder volumes can only be attached to one host at a time, you need to detach it from one instance before attaching it to another. To detach a volume, we use another Nova client option called volume-detach.

Getting ready

To begin with, ensure you are logged in to the Ubuntu host that has access to Nova client tools. If using the Vagrant environment that accompanies the book, you can access these tools from the controller node:

vagrant ssh controller

This recipe assumes you have created an openrc file. To create an openrc file on each node where you need it, open a text file named openrc, and add the following contents:

export OS_TENANT_NAME=cookbook export OS_USERNAME=admin export OS_PASSWORD=openstack export ...

Get OpenStack: Building a Cloud Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.