Browse Source

Merge "Remove support for classic drivers"

tags/9.1.0
Zuul 1 year ago
parent
commit
ad1b8113e7
4 changed files with 10 additions and 63 deletions
  1. +0
    -1
      elements/puppet-stack-config/puppet-stack-config.yaml.template
  2. +0
    -19
      instack_undercloud/tests/test_undercloud.py
  3. +6
    -31
      instack_undercloud/undercloud.py
  4. +4
    -12
      undercloud.conf.sample

+ 0
- 1
elements/puppet-stack-config/puppet-stack-config.yaml.template View File

@@ -518,7 +518,6 @@ ironic::conductor::cleaning_disk_erase: 'metadata'
ironic::conductor::cleaning_network: 'ctlplane'
ironic::conductor::provisioning_network: 'ctlplane'
ironic::conductor::default_boot_option: 'local'
ironic::conductor::enabled_drivers: {{ENABLED_DRIVERS}}
ironic::conductor::enabled_hardware_types: {{ENABLED_HARDWARE_TYPES}}
ironic::drivers::interfaces::default_inspect_interface: inspector
ironic::drivers::interfaces::enabled_boot_interfaces: {{ENABLED_BOOT_INTERFACES}}

+ 0
- 19
instack_undercloud/tests/test_undercloud.py View File

@@ -506,9 +506,6 @@ class TestGenerateEnvironment(BaseTestCase):
self.assertEqual('192.168.24.1', env['LOCAL_IP'])
# The list is generated from a set, so we can't rely on ordering.
# Instead make sure that it looks like a valid list by parsing it.
drivers = json.loads(env['ENABLED_DRIVERS'])
self.assertEqual(sorted(drivers), ['pxe_drac', 'pxe_ilo',
'pxe_ipmitool'])
hw_types = json.loads(env['ENABLED_HARDWARE_TYPES'])
self.assertEqual(sorted(hw_types), ['idrac', 'ilo', 'ipmi', 'redfish'])
self.assertEqual(
@@ -560,29 +557,13 @@ class TestGenerateEnvironment(BaseTestCase):
['idrac', 'ipmitool', 'no-vendor'])

def test_enabled_discovery(self):
self.conf.config(enable_node_discovery=True,
discovery_default_driver='pxe_foobar')
env = undercloud._generate_environment('.')
# The list is generated from a set, so we can't rely on ordering.
# Instead make sure that it looks like a valid list by parsing it.
drivers = json.loads(env['ENABLED_DRIVERS'])
# Discovery requires enabling the default driver. The pxe_ prefix
# designates a classic driver.
self.assertEqual(sorted(drivers), ['pxe_drac', 'pxe_foobar', 'pxe_ilo',
'pxe_ipmitool'])
self.assertEqual(env['INSPECTION_NODE_NOT_FOUND_HOOK'], 'enroll')

def test_enabled_hardware_types(self):
self.conf.config(enable_node_discovery=True,
discovery_default_driver='foobar',
enabled_hardware_types=['ipmi', 'something'])
env = undercloud._generate_environment('.')
# The list is generated from a set, so we can't rely on ordering.
# Instead make sure that it looks like a valid list by parsing it.
drivers = json.loads(env['ENABLED_DRIVERS'])
hw_types = json.loads(env['ENABLED_HARDWARE_TYPES'])
self.assertEqual(sorted(drivers), ['pxe_drac', 'pxe_ilo',
'pxe_ipmitool'])
self.assertEqual(sorted(hw_types), ['foobar', 'ipmi', 'something'])

def test_docker_registry_mirror(self):

+ 6
- 31
instack_undercloud/undercloud.py View File

@@ -298,7 +298,7 @@ _opts = [
default=False,
help=('Makes ironic-inspector enroll any unknown node that '
'PXE-boots introspection ramdisk in Ironic. By default, '
'the "fake" driver is used for new nodes (it is '
'the "ipmi" driver is used for new nodes (it is '
'automatically enabled when this option is set to True).'
' Set discovery_default_driver to override. '
'Introspection rules can also be used to specify driver '
@@ -306,10 +306,9 @@ _opts = [
),
cfg.StrOpt('discovery_default_driver',
default='ipmi',
help=('The default driver or hardware type to use for newly '
'discovered nodes (requires enable_node_discovery set to '
'True). It is automatically added to enabled_drivers '
'or enabled_hardware_types accordingly.')
help=('The default hardware type to use for newly discovered '
'nodes (requires enable_node_discovery set to True). '
'It is automatically added to enabled_hardware_types.')
),
cfg.BoolOpt('undercloud_debug',
default=True,
@@ -380,12 +379,6 @@ _opts = [
default=False,
help=('Whether to clean overcloud nodes (wipe the hard drive) '
'between deployments and after the introspection.')),
cfg.ListOpt('enabled_drivers',
default=['pxe_ipmitool', 'pxe_drac', 'pxe_ilo'],
help=('List of enabled bare metal drivers.'),
deprecated_for_removal=True,
deprecated_reason=('Please switch to hardware types and '
'the enabled_hardware_types option.')),
cfg.ListOpt('enabled_hardware_types',
default=['ipmi', 'redfish', 'ilo', 'idrac'],
help=('List of enabled bare metal hardware types (next '
@@ -1223,30 +1216,13 @@ def _generate_sysctl_settings():
return json.dumps(sysctl_settings)


def _is_classic_driver(name):
"""Poor man's way to detect if something is a driver or a hardware type.

To be removed when we remove support for classic drivers.
"""
return (name == 'fake' or
name.startswith('fake_') or
name.startswith('pxe_') or
name.startswith('agent_') or
name.startswith('iscsi_'))


def _process_drivers_and_hardware_types(instack_env):
"""Populate the environment with ironic driver information."""
# Ensure correct rendering of the list and uniqueness of the items
enabled_drivers = set(CONF.enabled_drivers)
enabled_hardware_types = set(CONF.enabled_hardware_types)
if CONF.enable_node_discovery:
if _is_classic_driver(CONF.discovery_default_driver):
if CONF.discovery_default_driver not in enabled_drivers:
enabled_drivers.add(CONF.discovery_default_driver)
else:
if CONF.discovery_default_driver not in enabled_hardware_types:
enabled_hardware_types.add(CONF.discovery_default_driver)
if CONF.discovery_default_driver not in enabled_hardware_types:
enabled_hardware_types.add(CONF.discovery_default_driver)
instack_env['INSPECTION_NODE_NOT_FOUND_HOOK'] = 'enroll'
else:
instack_env['INSPECTION_NODE_NOT_FOUND_HOOK'] = ''
@@ -1279,7 +1255,6 @@ def _process_drivers_and_hardware_types(instack_env):
if hw_type in enabled_hardware_types:
vendor_interfaces.add(iface)

instack_env['ENABLED_DRIVERS'] = _make_list(enabled_drivers)
instack_env['ENABLED_HARDWARE_TYPES'] = _make_list(enabled_hardware_types)

instack_env['ENABLED_BOOT_INTERFACES'] = _make_list(boot_interfaces)

+ 4
- 12
undercloud.conf.sample View File

@@ -141,17 +141,16 @@
#inspection_runbench = false

# Makes ironic-inspector enroll any unknown node that PXE-boots
# introspection ramdisk in Ironic. By default, the "fake" driver is
# introspection ramdisk in Ironic. By default, the "ipmi" driver is
# used for new nodes (it is automatically enabled when this option is
# set to True). Set discovery_default_driver to override.
# Introspection rules can also be used to specify driver information
# for newly enrolled nodes. (boolean value)
#enable_node_discovery = false

# The default driver or hardware type to use for newly discovered
# nodes (requires enable_node_discovery set to True). It is
# automatically added to enabled_drivers or enabled_hardware_types
# accordingly. (string value)
# The default hardware type to use for newly discovered nodes
# (requires enable_node_discovery set to True). It is automatically
# added to enabled_hardware_types. (string value)
#discovery_default_driver = ipmi

# Whether to enable the debug log level for Undercloud OpenStack
@@ -211,13 +210,6 @@
# deployments and after the introspection. (boolean value)
#clean_nodes = false

# DEPRECATED: List of enabled bare metal drivers. (list value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
# Reason: Please switch to hardware types and the
# enabled_hardware_types option.
#enabled_drivers = pxe_ipmitool,pxe_drac,pxe_ilo

# List of enabled bare metal hardware types (next generation drivers).
# (list value)
#enabled_hardware_types = ipmi,redfish,ilo,idrac

Loading…
Cancel
Save