From 1b2a7642bdf3878b69a5eaf6849f8006f7a0cc7a Mon Sep 17 00:00:00 2001 From: shibaPuppy Date: Wed, 26 Apr 2023 01:04:21 +0900 Subject: [PATCH] Add bond hash policy https://github.com/openstack/ironic/blob/master/ironic/tests/unit/drivers/modules/network/json_samples/network_data.json#L31 Adds the bond hash policy feature added to Ironic. --- api/v1beta1/metal3datatemplate_types.go | 5 +++++ baremetal/metal3data_manager.go | 13 +++++++------ ...ucture.cluster.x-k8s.io_metal3datatemplates.yaml | 5 ++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/api/v1beta1/metal3datatemplate_types.go b/api/v1beta1/metal3datatemplate_types.go index ebcd8b0aba..9d2fdb18e4 100644 --- a/api/v1beta1/metal3datatemplate_types.go +++ b/api/v1beta1/metal3datatemplate_types.go @@ -224,6 +224,10 @@ type NetworkDataLinkBond struct { // balance-rr, active-backup, balance-xor, broadcast, balance-tlb, balance-alb, 802.3ad BondMode string `json:"bondMode"` + // Selects the transmit hash policy used for port selection in balance-xor and 802.3ad modes + // +optional + BondHashPolicy string `json:"bond_xmit_hash_policy"` + // Id is the ID of the interface (used for naming) Id string `json:"id"` //nolint:revive,stylecheck @@ -238,6 +242,7 @@ type NetworkDataLinkBond struct { MACAddress *NetworkLinkEthernetMac `json:"macAddress"` // BondLinks is the list of links that are part of the bond. + // +optional BondLinks []string `json:"bondLinks"` } diff --git a/baremetal/metal3data_manager.go b/baremetal/metal3data_manager.go index 776ebce1e6..5a624d2745 100644 --- a/baremetal/metal3data_manager.go +++ b/baremetal/metal3data_manager.go @@ -727,12 +727,13 @@ func renderNetworkLinks(networkLinks infrav1.NetworkDataLink, bmh *bmov1alpha1.B return nil, err } data = append(data, map[string]interface{}{ - "type": "bond", - "id": link.Id, - "mtu": link.MTU, - "ethernet_mac_address": macAddress, - "bond_mode": link.BondMode, - "bond_links": link.BondLinks, + "type": "bond", + "id": link.Id, + "mtu": link.MTU, + "ethernet_mac_address": macAddress, + "bond_mode": link.BondMode, + "bond_xmit_hash_policy": link.BondHashPolicy, + "bond_links": link.BondLinks, }) } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_metal3datatemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_metal3datatemplates.yaml index 88170fba01..31c052dc09 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_metal3datatemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_metal3datatemplates.yaml @@ -1146,6 +1146,10 @@ spec: description: NetworkDataLinkBond represents a bond link object. properties: + bond_xmit_hash_policy: + description: Selects the transmit hash policy used for + port selection in balance-xor and 802.3ad modes + type: string bondLinks: description: BondLinks is the list of links that are part of the bond. @@ -1189,7 +1193,6 @@ spec: maximum: 9000 type: integer required: - - bondLinks - bondMode - id - macAddress