← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1498480] [NEW] LVM.__init__() checks for VG existence before setting up LVM_SYSTEM_DIR

 

Public bug reported:

Running Kilo Stable version of OpenStack

While testing on a small OpenStack configuration using LVM as a backend
I have configured the /etc/lvm/lvm.conf on my hosts to reject all
devices except those on which the operating system is installed.

On the host where cinder-volume & cinder-backup are running I created a
/etc/cinder/lvm.conf which rejects all devices except those backing the
cinder-volumes LVM VG. I.e. there is no overlap between the set of
devices accepted by /etc/lvm/lvm.conf and /etc/cinder/lvm.conf.

When I try to start cinder-volume I get errors trying to initalise the
LVM backend because the specified backing LVM VG is not found.

Looking in the logs I noticed that even though /etc/cinder/lvm.conf
exists and was specified via the lvm_conf_file option, there is a 'vgs'
command being run without LVM_SYSTEM_DIR specified in it's environment.

This lead me to the 'cinder/brick/local_dev/lvm.py' file where I noticed
that, in the middle of the LVM.__init__(), there is a self._vg_exists()
check, but the LVM.LVM_CMD_PREFIX isn't updated to include
LVM_SYSTEM_DIR until the end of the LVM.__init__() routine, as follows:

        if lvm_conf and os.path.isfile(lvm_conf):
            LVM.LVM_CMD_PREFIX = ['env',
                                  'LC_ALL=C',
                                  'LVM_SYSTEM_DIR=/etc/cinder']

Moving these 4 lines of code to before the create_vg check near the
beginning of LVM.__init__() resolved the problem and allows me to start
cinder-volume.

I notice that this code appears the same on the cinder/master branch, so
I will propose a review for this against that branch later today.

** Affects: cinder
     Importance: Undecided
     Assignee: Fergal Mc Carthy (fergal-mccarthy)
         Status: New

** Project changed: nova => cinder

** Changed in: cinder
     Assignee: (unassigned) => Fergal Mc Carthy (fergal-mccarthy)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1498480

Title:
  LVM.__init__() checks for VG existence before setting up
  LVM_SYSTEM_DIR

Status in Cinder:
  New

Bug description:
  Running Kilo Stable version of OpenStack

  While testing on a small OpenStack configuration using LVM as a
  backend I have configured the /etc/lvm/lvm.conf on my hosts to reject
  all devices except those on which the operating system is installed.

  On the host where cinder-volume & cinder-backup are running I created
  a /etc/cinder/lvm.conf which rejects all devices except those backing
  the cinder-volumes LVM VG. I.e. there is no overlap between the set of
  devices accepted by /etc/lvm/lvm.conf and /etc/cinder/lvm.conf.

  When I try to start cinder-volume I get errors trying to initalise the
  LVM backend because the specified backing LVM VG is not found.

  Looking in the logs I noticed that even though /etc/cinder/lvm.conf
  exists and was specified via the lvm_conf_file option, there is a
  'vgs' command being run without LVM_SYSTEM_DIR specified in it's
  environment.

  This lead me to the 'cinder/brick/local_dev/lvm.py' file where I
  noticed that, in the middle of the LVM.__init__(), there is a
  self._vg_exists() check, but the LVM.LVM_CMD_PREFIX isn't updated to
  include LVM_SYSTEM_DIR until the end of the LVM.__init__() routine, as
  follows:

          if lvm_conf and os.path.isfile(lvm_conf):
              LVM.LVM_CMD_PREFIX = ['env',
                                    'LC_ALL=C',
                                    'LVM_SYSTEM_DIR=/etc/cinder']

  Moving these 4 lines of code to before the create_vg check near the
  beginning of LVM.__init__() resolved the problem and allows me to
  start cinder-volume.

  I notice that this code appears the same on the cinder/master branch,
  so I will propose a review for this against that branch later today.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1498480/+subscriptions