Last active
April 19, 2019 23:05
-
-
Save juliakreger/4b56b0c67c2776b54815dfcc02847c04 to your computer and use it in GitHub Desktop.
Maybe something that might work?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py | |
index f667e7bfb..229447dd3 100644 | |
--- a/ironic/common/neutron.py | |
+++ b/ironic/common/neutron.py | |
@@ -217,6 +217,7 @@ def add_ports_to_network(task, network_uuid, security_groups=None): | |
""" | |
client = get_client(context=task.context) | |
node = task.node | |
+ add_all_ports = CONF.neutron.add_all_ports | |
# If Security Groups are specified, verify that they exist | |
_verify_security_groups(security_groups, client) | |
@@ -225,6 +226,7 @@ def add_ports_to_network(task, network_uuid, security_groups=None): | |
'%(network_uuid)s using %(net_iface)s network interface.', | |
{'net_iface': task.driver.network.__class__.__name__, | |
'node': node.uuid, 'network_uuid': network_uuid}) | |
+ | |
body = { | |
'port': { | |
'network_id': network_uuid, | |
@@ -245,7 +247,11 @@ def add_ports_to_network(task, network_uuid, security_groups=None): | |
ports = {} | |
failures = [] | |
portmap = get_node_portmap(task) | |
- pxe_enabled_ports = [p for p in task.ports if p.pxe_enabled] | |
+ | |
+ if not add_all_ports: | |
+ pxe_enabled_ports = [p for p in task.ports if p.pxe_enabled] | |
+ else: | |
+ pxe_enabled_ports = task.ports | |
if not pxe_enabled_ports: | |
raise exception.NetworkError(_( | |
@@ -261,6 +267,13 @@ def add_ports_to_network(task, network_uuid, security_groups=None): | |
[portmap[ironic_port.uuid]]} | |
body['port']['binding:profile'] = binding_profile | |
+ if add_all_ports and not ironic_port.pxe_enabled: | |
+ LOG.debug("Adding port %(port)s to network %(net) for " | |
+ "provisioning without an IP allocation.", | |
+ {'port': ironic_port.uuid, | |
+ 'net': network_uuid}) | |
+ body['fixed_ips'] = [] | |
+ | |
is_smart_nic = is_smartnic_port(ironic_port) | |
if is_smart_nic: | |
link_info = binding_profile['local_link_information'][0] | |
@@ -321,7 +334,11 @@ def remove_ports_from_network(task, network_uuid): | |
:param network_uuid: UUID of a neutron network ports will be deleted from. | |
:raises: NetworkError | |
""" | |
- macs = [p.address for p in task.ports if p.pxe_enabled] | |
+ add_all_ports = CONF.neutron.add_all_ports | |
+ if not add_all_ports: | |
+ macs = [p.address for p in task.ports if p.pxe_enabled] | |
+ else: | |
+ macs = [p.address for p in task.ports] | |
if macs: | |
params = { | |
'network_id': network_uuid, | |
diff --git a/ironic/conf/neutron.py b/ironic/conf/neutron.py | |
index 567625543..23fc9995f 100644 | |
--- a/ironic/conf/neutron.py | |
+++ b/ironic/conf/neutron.py | |
@@ -108,6 +108,13 @@ opts = [ | |
'"neutron" network interface and not used for the ' | |
'"flat" or "noop" network interfaces. If not ' | |
'specified, the default security group is used.')), | |
+ cfg.BoolOpt('add_all_ports', | |
+ default=False, | |
+ help=_('Option to enable transmission of all ports ' | |
+ 'to neutron when creating ports for provisioning, ' | |
+ 'cleaning, or rescue. This is done without IP ' | |
+ 'addresses assigned to the port, and may be useful ' | |
+ 'in some bonded network configurations.')), | |
] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment