when using multiple backend with block device driver, host option does't match db records

Bug #1332909 reported by Yaguang Tang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Yaguang Tang
Icehouse
Fix Released
Undecided
Unassigned

Bug Description

cinder master configured to use multiple backend

add
enabled_backends = 'driver1, driver2'

[driver1]
volume_driver=cinder.volume.drivers.block_device.BlockDeviceDriver
available_devices = '/dev/loop4,/dev/loop5'
volume_backend_name = sata

[driver2]
volume_driver=cinder.volume.drivers.block_device.BlockDeviceDriver
available_devices = '/dev/loop6'
volume_backend_name = ssd

 to cinder.conf

when debuging , self.configuration.host is None if you haven't defined host under a volume backend, even you have specified host under a volume backend. it doesn't match the db records, volumes stores in db is the format of host@backend_name, so no volumes return from db query.

cinder/volume/drivers/block_device.py

    def _get_used_devices(self):
        lst = api.volume_get_all_by_host(context.get_admin_context(),
                                         self.configuration.host)

the value for host is expected to be hostname@driver1 or hostname@driver2
when replace self.configuration.host with self.host, it works as expected.

so I believe the bug affects master.

Yaguang Tang (heut2008)
Changed in cinder:
assignee: nobody → Yaguang Tang (heut2008)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/101794

Changed in cinder:
status: New → In Progress
Revision history for this message
Huang Zhiteng (zhiteng-huang) wrote : Re: option "host" couldn't be find when using multiple backend

File "/opt/stack/cinder/cinder/volume/drivers/block_device.py", line 180, in _get_used_devices
    CONF.configuration.host)

This line looks suspicious. It is self.configuration.host in the driver from day 1. Can you verify it's possible to reproduce this bug on master branch?

Changed in cinder:
status: In Progress → Incomplete
Revision history for this message
Yaguang Tang (heut2008) wrote :

@Huang Zhiteng,

I can't reproduce it in master, but the bug exists in stable/icehouse, exception info updated.

description: updated
Revision history for this message
Huang Zhiteng (zhiteng-huang) wrote :

@Yaguang,

This change (https://review.openstack.org/#/c/95022/) may fix the bug in master branch as a side effect. You can verify and propose it to stable branch if this is the case.

Yaguang Tang (heut2008)
description: updated
Changed in cinder:
status: Incomplete → New
Changed in cinder:
status: New → In Progress
Revision history for this message
Edward Hope-Morley (hopem) wrote :

I've backported the fix from LP 1322366:

https://review.openstack.org/#/c/103549/

I think that *should* sufficient to fix the problem described here. I was not actually able to reproduce this issue on master (probably have my conf slightly different) but the above patch would definitely be useful in I nevertheless.

@yaguang make sure your oslo.config installed in devstack is actually the one from stable/icehouse as it is possible to hit dep issues when switching between devstack versions.

Yaguang Tang (heut2008)
description: updated
summary: - option "host" couldn't be find when using multiple backend
+ when using multiple backend with block device driver, host option does't
+ match db records
Yaguang Tang (heut2008)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/101794
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=7e43a8891018d52bd69298f11b684841b00e2523
Submitter: Jenkins
Branch: master

commit 7e43a8891018d52bd69298f11b684841b00e2523
Author: Yaguang Tang <email address hidden>
Date: Mon Jun 23 11:59:44 2014 +0800

    Fix host option isn't set when using multiple backend

    When using multiple volume backend, and volume driver is
    cinder.volume.drivers.block_device.BlockDeviceDriver, host
    option isn't set so a call to get volumes of a host returns none,
    This patch changes to use self.host instead of self.configuration.host

    Change-Id: Ide34ed29adad14b778b1a7388e9dc313241fa243
    Closes-Bug: 1332909

Changed in cinder:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/104746

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/icehouse)

Reviewed: https://review.openstack.org/104746
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=d12c513af2da07c47ffda8b4c0415cae3808f791
Submitter: Jenkins
Branch: stable/icehouse

commit d12c513af2da07c47ffda8b4c0415cae3808f791
Author: Yaguang Tang <email address hidden>
Date: Mon Jun 23 11:59:44 2014 +0800

    Fix host option isn't set when using multiple backend

    When using multiple volume backend, and volume driver is
    cinder.volume.drivers.block_device.BlockDeviceDriver, host
    option isn't set so a call to get volumes of a host returns none,
    This patch changes to use self.host instead of self.configuration.host

    Change-Id: Ide34ed29adad14b778b1a7388e9dc313241fa243
    Closes-Bug: 1332909
    (cherry picked from commit 7e43a8891018d52bd69298f11b684841b00e2523)

tags: added: in-stable-icehouse
Changed in cinder:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-2 → 2014.2
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.