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
This commit is contained in:
parent
0512bb4cd7
commit
7e43a88910
cinder
@ -32,9 +32,10 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
|
||||
super(TestBlockDeviceDriver, self).setUp()
|
||||
self.configuration = mox.MockAnything()
|
||||
self.configuration.available_devices = ['/dev/loop1', '/dev/loop2']
|
||||
self.configuration.host = 'localhost'
|
||||
self.host = 'localhost'
|
||||
self.configuration.iscsi_port = 3260
|
||||
self.drv = BlockDeviceDriver(configuration=self.configuration)
|
||||
self.drv = BlockDeviceDriver(configuration=self.configuration,
|
||||
host='localhost')
|
||||
|
||||
def test_initialize_connection(self):
|
||||
TEST_VOLUME1 = {'host': 'localhost1',
|
||||
@ -181,8 +182,7 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
|
||||
self.mox.StubOutWithMock(api, 'volume_get_all_by_host')
|
||||
self.mox.StubOutWithMock(context, 'get_admin_context')
|
||||
context.get_admin_context()
|
||||
api.volume_get_all_by_host(None,
|
||||
self.configuration.host) \
|
||||
api.volume_get_all_by_host(None, self.host) \
|
||||
.AndReturn([TEST_VOLUME1, TEST_VOLUME2])
|
||||
self.mox.StubOutWithMock(self.drv, 'local_path')
|
||||
path1 = self.drv.local_path(TEST_VOLUME1).AndReturn('/dev/loop1')
|
||||
|
@ -180,7 +180,7 @@ class BlockDeviceDriver(driver.ISCSIDriver):
|
||||
|
||||
def _get_used_devices(self):
|
||||
lst = api.volume_get_all_by_host(context.get_admin_context(),
|
||||
self.configuration.host)
|
||||
self.host)
|
||||
used_devices = set()
|
||||
for volume in lst:
|
||||
local_path = self.local_path(volume)
|
||||
|
Loading…
x
Reference in New Issue
Block a user