Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
fix network configuration issues with prefix (#1473)
Browse files Browse the repository at this point in the history
* fix network configuration issues with mtu and prefix

Signed-off-by: Anjali Somwanshi <[email protected]>

* use stored grains-id value in node variable

Signed-off-by: Anjali Somwanshi <[email protected]>

* fix issues

Signed-off-by: Anjali Somwanshi <[email protected]>

* Add netmask and gateway params for private data network

Signed-off-by: Anjali Somwanshi <[email protected]>

* update mtu for mgmt and data networks

Signed-off-by: Anjali Somwanshi <[email protected]>

* update mtu for mgmt and data networks

Signed-off-by: Anjali Somwanshi <[email protected]>

* fix codacy issues

Signed-off-by: Anjali Somwanshi <[email protected]>

Co-authored-by: Pritam Bhavsar <[email protected]>
  • Loading branch information
SomwanshiAnjali and 83bhp authored Jul 6, 2021
1 parent 936917c commit 9618eab
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions api/python/provisioner/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,14 @@ class PrivateDataNetwork(ParamGroupInputBase):
_param_group, descr="node data network mtu",
default=1500
)
data_gateway: str = ParamGroupInputBase._attr_ib(
_param_group, descr="node data gateway IP",
validator=Validation.check_ip4
)
data_netmask: str = ParamGroupInputBase._attr_ib(
_param_group, descr="node data interface netmask",
validator=Validation.check_ip4
)


class ReleaseParams():
Expand Down
2 changes: 2 additions & 0 deletions api/python/provisioner/params_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public_data_network:
private_data_network:
_path: cluster.sls
data_private_ip: cluster/srvnode-0/network/data/private_ip
data_netmask: cluster/srvnode-0/network/data/netmask
data_gateway: cluster/srvnode-0/network/data/gateway
data_private_interfaces: cluster/srvnode-0/network/data/private_interfaces
data_mtu: cluster/srvnode-0/network/data/mtu

Expand Down
11 changes: 10 additions & 1 deletion lr-cli/cortx_setup/commands/node/prepare/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
set_public_data_network,
set_private_data_network
)
from provisioner.salt import local_minion_id
from provisioner.salt import local_minion_id, function_run
from cortx.utils.conf_store import Conf


Expand Down Expand Up @@ -129,6 +129,12 @@ def run(self, hostname=None, network_type=None, gateway=None, netmask=None,

if network_type is not None:

server_type = function_run('grains.get', fun_args=['virtual'],
targets=node_id)[f'{node_id}']
if not server_type:
raise Exception("server_type missing in grains")
mtu = '1500' if server_type == 'virtual' or network_type == 'management' else '9000'

config_method = 'Static' if ip_address else 'DHCP'
self.logger.debug(
f"Configuring {network_type} network using {config_method} method"
Expand All @@ -140,18 +146,21 @@ def run(self, hostname=None, network_type=None, gateway=None, netmask=None,
mgmt_public_ip=ip_address,
mgmt_netmask=netmask,
mgmt_gateway=gateway,
mgmt_mtu=mtu,
local=True
)
elif network_type == 'data':
set_public_data_network(
data_public_ip=ip_address,
data_netmask=netmask,
data_gateway=gateway,
data_mtu=mtu,
local=True
)
elif network_type == 'private':
set_private_data_network(
data_private_ip=ip_address,
data_mtu=mtu,
local=True
)
except Exception as ex:
Expand Down
7 changes: 6 additions & 1 deletion srv/components/system/network/data/direct/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ Private data network configuration:
- nm_controlled: no
- peerdns: no
- userctl: no
- prefix: 24
{% if pillar['cluster'][node]['network']['data']['private_ip'] %}
- proto: none
- ipaddr: {{ pillar['cluster'][node]['network']['data']['private_ip'] }}
- mtu: {{ pillar['cluster'][node]['network']['data']['mtu'] }}
{% if pillar['cluster'][node]['network']['data']['netmask'] %}
- netmask: {{ pillar['cluster'][node]['network']['data']['netmask'] }}
{%- endif %}
{% if pillar['cluster'][node]['network']['data']['gateway'] %}
- gateway: {{ pillar['cluster'][node]['network']['data']['gateway'] }}
{% endif %}
{%- else %}
- proto: dhcp
{%- endif %}

0 comments on commit 9618eab

Please sign in to comment.