The check allowed to specify values greater than 1
because of a error in condition. So I've fixed the
condition and updated unit test, so it would catch
the bug.
Closes-Bug: #
1469249
Change-Id: I34f4128a8a80ae57be5c0af90308d2d517022d8e
fake_config.smbfs_used_ratio = -1
self._test_setup(config=fake_config)
+ def test_setup_invalid_used_ratio2(self):
+ fake_config = copy.copy(self._FAKE_SMBFS_CONFIG)
+ fake_config.smbfs_used_ratio = 1.1
+ self._test_setup(config=fake_config)
+
def _test_create_volume(self, volume_exists=False, volume_format=None):
fake_method = mock.MagicMock()
self._smbfs_driver.configuration = copy.copy(self._FAKE_SMBFS_CONFIG)
LOG.error(msg)
raise exception.SmbfsException(msg)
- if ((not self.configuration.smbfs_used_ratio > 0) and
- (self.configuration.smbfs_used_ratio <= 1)):
+ if not 0 < self.configuration.smbfs_used_ratio <= 1:
msg = _("SMBFS config 'smbfs_used_ratio' invalid. Must be > 0 "
"and <= 1.0: %s") % self.configuration.smbfs_used_ratio
LOG.error(msg)