diff --git a/manila/service.py b/manila/service.py index ffd71dbc75..caa132e614 100644 --- a/manila/service.py +++ b/manila/service.py @@ -277,7 +277,7 @@ class WSGIService(service.ServiceBase): self.host = getattr(CONF, '%s_listen' % name, "0.0.0.0") self.port = getattr(CONF, '%s_listen_port' % name, 0) self.workers = getattr(CONF, '%s_workers' % name, None) - if self.workers < 1: + if self.workers is not None and self.workers < 1: LOG.warn( _LW("Value of config option %(name)s_workers must be integer " "greater than 1. Input value ignored.") % {'name': name}) diff --git a/manila/share/driver.py b/manila/share/driver.py index 1ce22ff066..3ee2924ad2 100644 --- a/manila/share/driver.py +++ b/manila/share/driver.py @@ -299,7 +299,7 @@ class ShareDriver(object): def check_for_setup_error(self): """Check for setup error.""" max_ratio = self.configuration.safe_get('max_over_subscription_ratio') - if max_ratio < 1.0: + if not max_ratio or float(max_ratio) < 1.0: msg = (_("Invalid max_over_subscription_ratio '%s'. " "Valid value should be >= 1.0.") % max_ratio) raise exception.InvalidParameterValue(err=msg) diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index ba9e165e3f..18701fb12a 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -1072,7 +1072,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): # Do the unmount, handling split-related errors with retries. retry_interval = 3 # seconds - for retry in range(wait_seconds / retry_interval): + for retry in range(int(wait_seconds / retry_interval)): try: self._unmount_volume(volume_name, force=force) LOG.debug('Volume %s unmounted.', volume_name) diff --git a/manila/share/manager.py b/manila/share/manager.py index b0911ce5df..4dade1d1d6 100644 --- a/manila/share/manager.py +++ b/manila/share/manager.py @@ -845,7 +845,7 @@ class ShareManager(manager.SchedulerDependentManager): elif (network_info['network_type'] == 'vlan' and (network_info['segmentation_id'] is None or int(network_info['segmentation_id']) > 4094 - or int(network_info['segmentation_id'] < 1))): + or int(network_info['segmentation_id']) < 1)): msg = _('A segmentation ID %s was specified but is not valid for ' 'a VLAN network type; the segmentation ID must be an ' 'integer value in the range of [1,4094]') @@ -854,7 +854,7 @@ class ShareManager(manager.SchedulerDependentManager): elif (network_info['network_type'] == 'vxlan' and (network_info['segmentation_id'] is None or int(network_info['segmentation_id']) > 16777215 - or int(network_info['segmentation_id'] < 1))): + or int(network_info['segmentation_id']) < 1)): msg = _('A segmentation ID %s was specified but is not valid for ' 'a VXLAN network type; the segmentation ID must be an ' 'integer value in the range of [1,16777215]') @@ -863,7 +863,7 @@ class ShareManager(manager.SchedulerDependentManager): elif (network_info['network_type'] == 'gre' and (network_info['segmentation_id'] is None or int(network_info['segmentation_id']) > 4294967295 - or int(network_info['segmentation_id'] < 1))): + or int(network_info['segmentation_id']) < 1)): msg = _('A segmentation ID %s was specified but is not valid for ' 'a GRE network type; the segmentation ID must be an ' 'integer value in the range of [1, 4294967295]') diff --git a/manila/tests/share/test_driver.py b/manila/tests/share/test_driver.py index c2211dc8b2..272c194fb8 100644 --- a/manila/tests/share/test_driver.py +++ b/manila/tests/share/test_driver.py @@ -207,14 +207,14 @@ class ShareDriverTestCase(test.TestCase): self.assertEqual([], share_driver.get_share_server_pools('fake_server')) - @ddt.data(0.8, 1.0, 10.5, 20.0, None) + @ddt.data(0.8, 1.0, 10.5, 20.0, None, '1', '1.1') def test_check_for_setup_error(self, value): driver.CONF.set_default('driver_handles_share_servers', False) share_driver = driver.ShareDriver(False) share_driver.configuration = configuration.Configuration(None) self.mock_object(share_driver.configuration, 'safe_get', mock.Mock(return_value=value)) - if value >= 1.0: + if value and float(value) >= 1.0: share_driver.check_for_setup_error() else: self.assertRaises(exception.InvalidParameterValue,