Bug 1477307

Summary: [RFE] Physical network awareness when binding bare metal ports
Product: Red Hat OpenStack Reporter: Bob Fournier <bfournie>
Component: openstack-ironicAssignee: Bob Fournier <bfournie>
Status: CLOSED ERRATA QA Contact: mlammon
Severity: medium Docs Contact:
Priority: medium    
Version: 12.0 (Pike)CC: bfournie, dsneddon, hjensas, jjoyce, mburns, racedoro, rhel-osp-director-maint, srevivo, tvignaud
Target Milestone: Upstream M1Keywords: FutureFeature, OtherQA, Triaged
Target Release: 12.0 (Pike)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://specs.openstack.org/openstack/ironic-specs/specs/approved/physical-network-awareness.html
Whiteboard:
Fixed In Version: openstack-ironic-9.0.2-0.20170821162300.adff15e.el7ost python-ironicclient-1.16.0-0.20170821151022.835c5d4.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-13 21:48:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1477642    

Description Bob Fournier 2017-08-01 18:03:01 UTC
Description of problem:

This RFE tracks the discussion of Ironic physical network awareness that is needed for Routed Network support as initiated by Harald Janses here: http://lists.openstack.org/pipermail/openstack-dev/2017-June/119024.html

The key points are summarized below:

With the following Neutron patches recently merged, it is now possible to provide DHCP service to instances on remote routed networks that have a dhcp forwarder configured.

https://review.openstack.org/#/c/459861/
https://review.openstack.org/#/c/468744/
https://review.openstack.org/476477

This enables provisioning of baremetal machines on remote routed networks as well. Removing the need to deploy ironic conductor/inspector etc with local connection to each routed network segment.

However with the flat driver this does not work, because the flat
driver bind neutron ports to the node running ironic-conductor service,
e.g 'nova_host_id'. Not to the actual baremetal node. (Ref: https://git
hub.com/openstack/ironic/blob/master/ironic/drivers/modules/network/fla
t.py#L64)

The result of binding to the 'nova_host_id' causes this error for baremetal nodes on the remote routed network segment.

==================================

Response from Sam Betts:

On the ironic service side the major feature required for routed networks support is physical network awareness, patches for this are progressing well and can be found here: https://review.openstack.org/#/q/topic:bug/1666009

This feature will allow ironic to be aware of which neutron physnet each baremetal node NIC is connected too, which lets us make intelligent decisions when mapping neutron ports to physical NICs on the baremetal server, and which provides us with required information to feed the segment to host mapping data into neutron.

The additional pieces which will be required to make routed networks work exist the new openstack/networking-baremetal repo, which is where we will be storing any neutron drivers and agents required to make ironic neutron networking operate correctly.

The first puzzle piece is a new ML2 driver which provides the functionality for binding baremetal vnic type ports into statically/manually configured (flat) networks:
https://review.openstack.org/#/c/448073/

With this driver, the flat network interface in Ironic will no longer incorrectly do the port binding for flat networks by binding the neutron port to the nova host that requested the ironic deploy, and instead it will be able to use the baremetal vnic type and set the binding host id to the ironic node uuid.

The second puzzle piece is to do with populating the host to physical network mapping information in neutron so that it can calculate the segment to host mapping information, that is done by using the neutron L2 agent RPC API to push this information up into neutron, and the current proposed solution for that can be found here: https://review.openstack.org/#/c/456235/

Once this is in place then neutron will be aware about which physical network segments each baremetal is plugged into and by populating nova placement’s API aggregates (like it does for normal nova compute hosts) will ensure that scheduling gives you a valid baremetal node when you request a baremetal instance on a routed network.

Comment 1 Dmitry Tantsur 2017-08-02 12:24:45 UTC
The code work was done in Pike, now we need to test it. As to routed networks, let's have another RFE depending on this one. It will need networking-baremetal packaging.

Comment 3 Bob Fournier 2017-08-14 14:34:47 UTC
I think this bug is actually tracking the fixes that went into Pike for physical network awareness as Dmitry noted in comment 1, but the versions didn't get updated, doing that now.

Comment 5 Bob Fournier 2017-11-02 14:49:05 UTC
>Bob, the QE team won't have cycles to work on this RFE in Pike. Does it make sense for >this code be OtherQA and be tested by engineering?

Yes. I added the OtherQA keyword.

Comment 7 Bob Fournier 2017-11-16 20:55:25 UTC
I've verified the physical network changes using latest OSP-12.

1. Modify the physical network of baremetal port and verify it can be bound to node

Using existing baremetal network

(overcloud) [stack@undercloud-0 ~]$ openstack network show baremetal
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        | nova                                 |
| created_at                | 2017-11-16T00:12:24Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 7015fa96-b5c7-41b2-b389-390ef31c78da |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | None                                 |
| is_vlan_transparent       | None                                 |
| mtu                       | 1500                                 |
| name                      | baremetal                            |
| port_security_enabled     | True                                 |
| project_id                | 1551c924c40c466c90ad890bd1d95e2e     |
| provider:network_type     | flat                                 |
| provider:physical_network | baremetal                            |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 4                                    |
| router:external           | Internal                             |
| segments                  | None                                 |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   | acb9f08f-eeec-44bc-b42c-e5f6defa245f |
| tags                      |                                      |
| updated_at                | 2017-11-16T00:12:31Z                 |
+---------------------------+--------------------------------------+

The baremetal port does not have physical-network set:
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port show 7ddfc890-60b3-46c9-9659-df594a73cacf
+-----------------------+------------------------------------------------------------------+
| Field                 | Value                                                            |
+-----------------------+------------------------------------------------------------------+
| address               | 52:54:00:24:a0:c4                                                |
| created_at            | 2017-11-16T14:58:17+00:00                                        |
| extra                 | {}                                                               |
| internal_info         | {u'tenant_vif_port_id': u'9407f5d0-ff5a-4dc8-bb62-439f8e2cc378'} |
| local_link_connection | {}                                                               |
| node_uuid             | 49aa31f2-330d-4c9d-ab5a-af64df1a5883                             |
| physical_network      | None                                                             |
| portgroup_uuid        | None                                                             |
| pxe_enabled           | True                                                             |
| updated_at            | 2017-11-16T15:31:20+00:00                                        |
| uuid                  | 7ddfc890-60b3-46c9-9659-df594a73cacf                             |
+-----------------------+------------------------------------------------------------------+

From internal_info above we can see that this baremetal (Ironic) port is bound to this logical Neutron port:
(overcloud) [stack@undercloud-0 ~]$ openstack port show 9407f5d0-ff5a-4dc8-bb62-439f8e2cc378
+-----------------------+------------------------------------------------------------------------------+
| Field                 | Value                                                                        |
+-----------------------+------------------------------------------------------------------------------+
| admin_state_up        | UP                                                                           |
| allowed_address_pairs |                                                                              |
| binding_host_id       | 49aa31f2-330d-4c9d-ab5a-af64df1a5883                                         |
| binding_profile       | local_link_information='[{}]'                                                |
| binding_vif_details   |                                                                              |
| binding_vif_type      | binding_failed                                                               |
| binding_vnic_type     | baremetal                                                                    |
| created_at            | 2017-11-16T15:31:11Z                                                         |
| data_plane_status     | None                                                                         |
| description           |                                                                              |
| device_id             | 01103a08-6c6e-4620-9713-21f621f125c4                                         |
| device_owner          | compute:nova                                                                 |
| dns_assignment        | None                                                                         |
| dns_name              | None                                                                         |
| extra_dhcp_opts       |                                                                              |
| fixed_ips             | ip_address='192.168.24.25', subnet_id='acb9f08f-eeec-44bc-b42c-e5f6defa245f' |
| id                    | 9407f5d0-ff5a-4dc8-bb62-439f8e2cc378                                         |
| ip_address            | None                                                                         |
| mac_address           | 52:54:00:24:a0:c4                                                            |
| name                  | ironic-1-extra                                                               |
| network_id            | 7015fa96-b5c7-41b2-b389-390ef31c78da                                         |
| option_name           | None                                                                         |
| option_value          | None                                                                         |
| port_security_enabled | True                                                                         |
| project_id            | 1551c924c40c466c90ad890bd1d95e2e                                             |
| qos_policy_id         | None                                                                         |
| revision_number       | 8                                                                            |
| security_group_ids    | c4179b01-9034-4a5e-91fd-d3f885fdcc52                                         |
| status                | DOWN                                                                         |
| subnet_id             | None                                                                         |
| tags                  |                                                                              |
| trunk_details         | None                                                                         |
| updated_at            | 2017-11-16T15:31:21Z                                                         |
+-----------------------+------------------------------------------------------------------------------+

The node is ironic-1:
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node list --fields uuid name
+--------------------------------------+----------+
| UUID                                 | Name     |
+--------------------------------------+----------+
| 49aa31f2-330d-4c9d-ab5a-af64df1a5883 | ironic-1 |
| 87d22ca8-c313-4a1d-ab19-432a45050394 | ironic-0 |
+--------------------------------------+----------+

Do these steps to remove port, set the physical network on baremetal port, and rebind port:
(overcloud) [stack@undercloud-0 ~]$ openstack server remove port instance2 ironic-1-extra
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node maintenance set ironic-1
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port set --physical-network baremetal 7ddfc890-60b3-46c9-9659-df594a73cacf
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port show 7ddfc890-60b3-46c9-9659-df594a73cacf
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| address               | 52:54:00:24:a0:c4                    |
| created_at            | 2017-11-16T14:58:17+00:00            |
| extra                 | {}                                   |
| internal_info         | {}                                   |
| local_link_connection | {}                                   |
| node_uuid             | 49aa31f2-330d-4c9d-ab5a-af64df1a5883 |
| physical_network      | baremetal                            |
| portgroup_uuid        | None                                 |
| pxe_enabled           | True                                 |
| updated_at            | 2017-11-16T17:44:20+00:00            |
| uuid                  | 7ddfc890-60b3-46c9-9659-df594a73cacf |
+-----------------------+--------------------------------------+

(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node maintenance unset ironic-1
(overcloud) [stack@undercloud-0 ~]$ openstack server add port instance2 ironic-1-extra
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node vif list ironic-1
+--------------------------------------+
| ID                                   |
+--------------------------------------+
| 9407f5d0-ff5a-4dc8-bb62-439f8e2cc378 |
+--------------------------------------+

2. Set baremetal port to invalid physical network and verify it can't be bound to node

(overcloud) [stack@undercloud-0 ~]$ openstack server remove port instance2 ironic-1-extra
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node maintenance set ironic-1
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port set --physical-network foo 7ddfc890-60b3-46c9-9659-df594a73cacf
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port show 7ddfc890-60b3-46c9-9659-df594a73cacf
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| address               | 52:54:00:24:a0:c4                    |
| created_at            | 2017-11-16T14:58:17+00:00            |
| extra                 | {}                                   |
| internal_info         | {}                                   |
| local_link_connection | {}                                   |
| node_uuid             | 49aa31f2-330d-4c9d-ab5a-af64df1a5883 |
| physical_network      | foo                                  |
| portgroup_uuid        | None                                 |
| pxe_enabled           | True                                 |
| updated_at            | 2017-11-16T17:54:20+00:00            |
| uuid                  | 7ddfc890-60b3-46c9-9659-df594a73cacf |
+-----------------------+--------------------------------------+

(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node maintenance unset ironic-1
(overcloud) [stack@undercloud-0 ~]$ openstack server add port instance2 ironic-1-extra
Failed to attach network adapter device to 01103a08-6c6e-4620-9713-21f621f125c4 (HTTP 500) (Request-ID: req-d5e5d2f3-5106-41a0-adae-bc841b747032)
(overcloud) [stack@undercloud-0 ~]$ 

3. Verify that can set physical network when creating baremetal port and bind new baremetal port to node

(overcloud) [stack@undercloud-0 ~]$ openstack server remove port instance2 ironic-1-extra
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node maintenance set ironic-1
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port delete 7ddfc890-60b3-46c9-9659-df594a73cacf

(overcloud) [stack@undercloud-0 ~]$ openstack baremetal port create --pxe-enabled true --physical-network baremetal --node 49aa31f2-330d-4c9d-ab5a-af64df1a5883 52:54:00:24:a0:c4
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| address               | 52:54:00:24:a0:c4                    |
| created_at            | 2017-11-16T20:22:09+00:00            |
| extra                 | {}                                   |
| internal_info         | {}                                   |
| local_link_connection | {}                                   |
| node_uuid             | 49aa31f2-330d-4c9d-ab5a-af64df1a5883 |
| physical_network      | baremetal                            |
| portgroup_uuid        | None                                 |
| pxe_enabled           | True                                 |
| updated_at            | None                                 |
| uuid                  | e11d1931-1b10-4129-85c0-0e380c8157f6 |
+-----------------------+--------------------------------------+

(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node maintenance unset ironic-1
(overcloud) [stack@undercloud-0 ~]$ openstack server add port instance2 ironic-1-extra
(overcloud) [stack@undercloud-0 ~]$ openstack baremetal node vif list ironic-1
+--------------------------------------+
| ID                                   |
+--------------------------------------+
| 9407f5d0-ff5a-4dc8-bb62-439f8e2cc378 |
+--------------------------------------+

Comment 10 errata-xmlrpc 2017-12-13 21:48:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:3462