File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1411,6 +1411,13 @@ def init_host(self):
14111411 eventlet.semaphore.BoundedSemaphore(
14121412 CONF.compute.max_concurrent_disk_ops)
14131413
1414+ if CONF.compute.max_disk_devices_to_attach == 0:
1415+ msg = _('[compute]max_disk_devices_to_attach has been set to 0, '
1416+ 'which will prevent instances from being able to boot. '
1417+ 'Set -1 for unlimited or set >= 1 to limit the maximum '
1418+ 'number of disk devices.')
1419+ raise exception.InvalidConfiguration(msg)
1420+
14141421 self.driver.init_host(host=self.host)
14151422 context = nova.context.get_admin_context()
14161423 instances = objects.InstanceList.get_by_host(
Original file line number Diff line number Diff line change 962962The configured maximum is not enforced on shelved offloaded servers, as they
963963have no compute host.
964964
965+ .. warning:: If this option is set to 0, the ``nova-compute`` service will fail
966+ to start, as 0 disk devices is an invalid configuration that would
967+ prevent instances from being able to boot.
968+
965969Possible values:
966970
967971* -1 means unlimited
968- * Any integer >= 0 represents the maximum allowed
972+ * Any integer >= 1 represents the maximum allowed. A value of 0 will cause the
973+ ``nova-compute`` service to fail to start, as 0 disk devices is an invalid
974+ configuration that would prevent instances from being able to boot.
969975""" ),
970976 cfg .StrOpt ('provider_config_location' ,
971977 default = '/etc/nova/provider_config/' ,
Original file line number Diff line number Diff line change @@ -1111,6 +1111,11 @@ def test_get_nodes_node_not_found(
11111111 "time this service is starting on this host, then you can ignore "
11121112 "this warning.", 'fake-node1')
11131113
1114+ def test_init_host_disk_devices_configuration_failure(self):
1115+ self.flags(max_disk_devices_to_attach=0, group='compute')
1116+ self.assertRaises(exception.InvalidConfiguration,
1117+ self.compute.init_host)
1118+
11141119 @mock.patch.object(objects.InstanceList, 'get_by_host',
11151120 new=mock.Mock())
11161121 @mock.patch('nova.compute.manager.ComputeManager.'
You can’t perform that action at this time.
0 commit comments