Fixed handling duplicate block devices specified in config
Change-Id: I5c96c49d47b762fecc16c8700ef6ed65bcd39bf5 closes-bug: 1582317
This commit is contained in:
parent
c8f84bc607
commit
b268ef82fa
@ -258,6 +258,7 @@ def determine_block_devices():
|
||||
else:
|
||||
bdevs = block_device.split(' ')
|
||||
|
||||
bdevs = list(set(bdevs))
|
||||
# attempt to ensure block devices, but filter out missing devs
|
||||
_none = ['None', 'none']
|
||||
valid_bdevs = \
|
||||
|
@ -165,6 +165,17 @@ class SwiftStorageUtilsTests(CharmTestCase):
|
||||
self.test_config.set('block-device', bdevs)
|
||||
result = swift_utils.determine_block_devices()
|
||||
ex = ['/dev/vdb', '/dev/vdc', '/tmp/swift.img']
|
||||
ex = list(set(ex))
|
||||
self.assertEquals(ex, result)
|
||||
|
||||
@patch.object(swift_utils, 'ensure_block_device')
|
||||
def test_determine_block_device_dublicate_dev(self, _ensure):
|
||||
_ensure.side_effect = self._fake_ensure
|
||||
bdevs = '/dev/vdb /dev/vdc /dev/vdc /dev/vdb /tmp/swift.img|1G'
|
||||
self.test_config.set('block-device', bdevs)
|
||||
result = swift_utils.determine_block_devices()
|
||||
ex = ['/dev/vdb', '/dev/vdc', '/tmp/swift.img']
|
||||
ex = list(set(ex))
|
||||
self.assertEquals(ex, result)
|
||||
|
||||
@patch.object(swift_utils, 'ensure_block_device')
|
||||
|
Loading…
Reference in New Issue
Block a user