diff --git a/cinder/tests/test_block_device.py b/cinder/tests/test_block_device.py index 7def672fdc6..077ece39dd3 100644 --- a/cinder/tests/test_block_device.py +++ b/cinder/tests/test_block_device.py @@ -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') diff --git a/cinder/volume/drivers/block_device.py b/cinder/volume/drivers/block_device.py index e2ce8ef2da0..1e92322699d 100644 --- a/cinder/volume/drivers/block_device.py +++ b/cinder/volume/drivers/block_device.py @@ -177,7 +177,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)