Installing and configuring Cinder: connection to loopback device is ephemeral

Bug #1078353 reported by Marco CONSONNI
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack-manuals
Fix Released
Medium
Anne Gentle

Bug Description

@ http://docs.openstack.org/trunk/openstack-compute/install/apt/content/osfolubuntu-cinder.html

A problem I found when I reboot the node.

The association between the loop-back device and the backing file (see command sudo losetup /dev/loop2 cinder-volumes) 'disappears' when you reboot the node.

This results in errors in cinder-volume daemon that crashes with a nasty traceback:

2012-11-13 13:49:17 1680 TRACE cinder self.manager.init_host()
2012-11-13 13:49:17 1680 TRACE cinder File "/usr/lib/python2.7/dist-packages/cinder/volume/manager.py", line 95, in init_host
2012-11-13 13:49:17 1680 TRACE cinder self.driver.check_for_setup_error()
2012-11-13 13:49:17 1680 TRACE cinder File "/usr/lib/python2.7/dist-packages/cinder/volume/driver.py", line 115, in check_for_setup_error
2012-11-13 13:49:17 1680 TRACE cinder raise exception.VolumeBackendAPIException(data=exception_message)
2012-11-13 13:49:17 1680 TRACE cinder VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: volume group cinder-volumes doesn't exist

In order to prevent this problem, I found a solution as follows:

1) create a script file named "/etc/init.d/cinder-setup-backing-file" (you need to be root for doing this, therefore use some command as "sudo vi /etc/init.d/cinder-setup-backing-file")

2) In the file, write the following code:
 # This script associates the backing file created for implementing cinder's volume group to /dev/loop2
 losetup /dev/loop2 /var/lib/cinder/cinder-backing-file
 exit 0

3) Make the file executable with command:

sudo chmod 755 /etc/init.d/cinder-setup-backing-file

4) create a link to the just created file so that it is executed when the node reboots:

sudo ln -s /etc/init.d/cinder-setup-backing-file /etc/rc2.d/S10cinder-setup-backing-file

I suggest to report this or similar instructions as notes in the document.
====

Note: it's fundamental that the name of the backing file in the script you create is fully qualified (directory and filename). In the example above I used /var/lib/cinder/cinder-backing-file; any name is fine provided that it identifies the file you create with dd command.

Revision history for this message
Tom Fifield (fifieldt) wrote :

Hi Marco,

Perhaps this bug should be fixed in Cinder too?

Revision history for this message
Marco CONSONNI (marco-consonni) wrote :

Hi Tom,

if you mean that there's a bug in Cinder code, my answer is "no, the code's fine".

The problem is in how the manual makes the settings of volume group "cinder-volumes".
Cinder needs a volume group named "cinder-volumes" and the manual describes one way for creating it. There are many ways for doing that and the manual describes a way that's very good for demonstration purposes (instructions between sentence "Create a 2GB test loopfile." and sentence "Restart the services.")
It's up to the person who installs and configure to provide "cinder-volumes" volume group, so cinder software is "innocent", in this case.

The problem with the cider-volumes volume group described here is that when you reboot the node (the physical machine), some settings you made disappear. The result is that cinder stops working after a reboot.

To make a long story short, my suggestion is to add a note before the sentence "Restart the services" saying something like this:

==========

Warning: The association between the loop-back device and the backing file (see command sudo losetup /dev/loop2 cinder-volumes) 'disappears' when you reboot the node.

In order to prevent that, you should create a script file named "/etc/init.d/cinder-setup-backing-file" (you need to be root for doing this, therefore use some command like "sudo vi /etc/init.d/cinder-setup-backing-file")",

Add the code

losetup /dev/loop2<fullPathOfBackingFile>
exit 0

(please don't forget to use the full name of the backing file you created with command "dd" and to terminate the script with "exit 0")

Make the file executable with command:

sudo chmod 755 /etc/init.d/cinder-setup-backing-file

Create a link to the just created file so that it is executed when the node reboots:

sudo ln -s /etc/init.d/cinder-setup-backing-file /etc/rc2.d/S10cinder-setup-backing-file

============

Hope it helps

Revision history for this message
Tom Fifield (fifieldt) wrote :

Thanks Marco!

Changed in openstack-manuals:
status: New → Triaged
importance: Undecided → Medium
koolhead17 (koolhead17)
Changed in openstack-manuals:
assignee: nobody → koolhead17 (koolhead17)
Anne Gentle (annegentle)
Changed in openstack-manuals:
assignee: koolhead17 (koolhead17) → Anne Gentle (annegentle)
Changed in openstack-manuals:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-manuals (master)

Reviewed: https://review.openstack.org/23625
Committed: http://github.com/openstack/openstack-manuals/commit/6712435ff8b9b856d24740ee95b54ea0afd871e0
Submitter: Jenkins
Branch: master

commit 6712435ff8b9b856d24740ee95b54ea0afd871e0
Author: annegentle <email address hidden>
Date: Tue Mar 5 16:23:08 2013 -0600

    Removes nova-volumes/nova-volume surgically, replace with Block
    Storage.

    Not sure about lgm vs tgts, etc, in the configuration sections. It
    seems ok to leave both as examples but needs review.

    Fix bug 1007528
    Fix bug 1074200
    Fix bug 1078353
    Fix bug 1153869

    Patchset addresses reviewer's comments.

    Patchset fixes new bug, init should be ini and troubleshooting.

    Patchset addresses question about networking.

    Change-Id: Ib6f325ba11c5cff01364ef787c52cdc57ee8f70f

Changed in openstack-manuals:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.