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

Commit

Permalink
CORTX-29979: Multiple Data pod deployment: Support Node group in CDF
Browse files Browse the repository at this point in the history
Solution:
Added support for 'node_group' in CDF format

Signed-off-by: Swapnil Gaonkar <swapnil.gaonkar@seagate.com>
  • Loading branch information
SwapnilGaonkar7 committed Jun 14, 2022
1 parent 929122f commit 9c6895e
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions cfgen/cfgen
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class ShowSchema(argparse.Action):
create_aux: <bool> # optional, defaults to false if not present in CDF
nodes:
- hostname: <str> # [user@]hostname; e.g., localhost, pod-c1
node_group: <str> # name of the node_group in which this node is present
data_iface: <str> # name of network interface; e.g., eth1, eth1:c1
data_iface_type: tcp|o2ib # type of network interface;
# optional, defaults to "tcp"
Expand Down
1 change: 1 addition & 0 deletions cfgen/dhall/types/NodeDesc.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-}

{ hostname : Text
, node_group: Optional Text
, machine_id : Optional Text
, processorcount: Optional Natural
, memorysize_mb: Optional Double
Expand Down
1 change: 1 addition & 0 deletions cfgen/examples/ci-boot1-2ios.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nodes:
- hostname: localhost
node_group: localhost
data_iface: eth1
data_iface_type: tcp
transport_type: libfab
Expand Down
2 changes: 2 additions & 0 deletions cfgen/examples/ci-boot2-1confd.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nodes:
- hostname: ssu1
node_group: ssu1
data_iface: eth1
transport_type: libfab
m0_servers:
Expand All @@ -18,6 +19,7 @@ nodes:
- name: m0_client_other # name of the motr client
instances: 2 # Number of instances, this host will run
- hostname: ssu2
node_group: ssu2
data_iface: eth1
transport_type: libfab
m0_servers:
Expand Down
2 changes: 2 additions & 0 deletions cfgen/examples/ci-boot2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nodes:
- hostname: ssu1
node_group: ssu1
data_iface: eth1
transport_type: libfab
m0_servers:
Expand All @@ -18,6 +19,7 @@ nodes:
- name: m0_client_other # name of the motr client
instances: 2 # Number of instances, this host will run
- hostname: ssu2
node_group: ssu2
data_iface: eth1
transport_type: libfab
m0_servers:
Expand Down
3 changes: 3 additions & 0 deletions cfgen/examples/ci-boot3.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nodes:
- hostname: ssu1
node_group: ssu1
data_iface: eth1
transport_type: libfab
m0_servers:
Expand All @@ -18,6 +19,7 @@ nodes:
- name: m0_client_other # name of the motr client
instances: 2 # Number of instances, this host will run
- hostname: ssu2
node_group: ssu2
data_iface: eth1
transport_type: libfab
m0_servers:
Expand All @@ -36,6 +38,7 @@ nodes:
- name: m0_client_other # name of the motr client
instances: 2 # Number of instances, this host will run
- hostname: ssu3
node_group: ssu3
data_iface: eth1
transport_type: libfab
m0_servers:
Expand Down
2 changes: 2 additions & 0 deletions cfgen/examples/ldr1-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

nodes:
- hostname: pod-c1 # [user@]hostname
node_group: pod-c1
data_iface: eth1_c1 # name of data network interface
data_iface_type: o2ib # LNet type of network interface (optional);
# supported values: "tcp" (default), "o2ib"
Expand All @@ -21,6 +22,7 @@ nodes:
- name: m0_client_other # name of the motr client
instances: 2 # Number of instances, this host will run
- hostname: pod-c2
node_group: pod-c2
data_iface: eth1_c2
data_iface_type: o2ib
transport_type: libfab
Expand Down
2 changes: 2 additions & 0 deletions cfgen/examples/multipools.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nodes:
- hostname: srvnode-1
node_group: srvnode-1
data_iface: enp175s0f1_c1
data_iface_type: o2ib
transport_type: libfab
Expand Down Expand Up @@ -33,6 +34,7 @@ nodes:
# port: 21500
# m0_client_s3: 22500
- hostname: srvnode-2
node_group: srvnode-2
data_iface: enp175s0f1_c2
data_iface_type: o2ib
transport_type: libfab
Expand Down
1 change: 1 addition & 0 deletions cfgen/examples/singlenode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

nodes:
- hostname: localhost # [user@]hostname
node_group: localhost
data_iface: eth1 # name of data network interface
data_iface_ip_addr: null
transport_type: libfab
Expand Down
1 change: 1 addition & 0 deletions cfgen/tests/singlenode.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ in
, nodes =
[ { hostname = "localhost"
, machine_id = None Text
, node_group = Some "localhost"
, memorysize_mb = None Double
, processorcount = None Natural
, transport_type = "libfab"
Expand Down
2 changes: 2 additions & 0 deletions provisioning/miniprov/hare_mp/cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ def _create_node(self, machine_id: str) -> NodeDesc:
store = self.provider

hostname = self.utils.get_hostname(machine_id)
node_group = self.utils.get_node_group(machine_id)
# node>{machine-id}>name
iface = self._get_iface(machine_id)
servers = None
Expand Down Expand Up @@ -543,6 +544,7 @@ def _create_node(self, machine_id: str) -> NodeDesc:

return NodeDesc(
hostname=Text(hostname),
node_group=Maybe(Text(node_group), 'Text'),
machine_id=Maybe(Text(machine_id), 'Text'),
processorcount=Maybe(node_facts['processorcount'], 'Natural'),
memorysize_mb=Maybe(node_facts['memorysize_mb'], 'Double'),
Expand Down
2 changes: 2 additions & 0 deletions provisioning/miniprov/hare_mp/dhall/gencdf.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let ServerPort =

let NodeInfo =
{ hostname : Text
, node_group : Optional Text
, machine_id : Optional Text
, processorcount : Optional Natural
, memorysize_mb : Optional Double
Expand Down Expand Up @@ -85,6 +86,7 @@ let toNodeDesc
: NodeInfo -> T.NodeDesc
= \(n : NodeInfo)
-> { hostname = n.hostname
, node_group = n.node_group
, machine_id = n.machine_id
, processorcount = n.processorcount
, memorysize_mb = n.memorysize_mb
Expand Down
1 change: 1 addition & 0 deletions provisioning/miniprov/hare_mp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class NetworkPorts(DhallTuple):
@dataclass(repr=False)
class NodeDesc(DhallTuple):
hostname: Text
node_group: Maybe[Text]
machine_id: Maybe[Text]
processorcount: Maybe[int]
memorysize_mb: Maybe[int]
Expand Down
9 changes: 9 additions & 0 deletions provisioning/miniprov/hare_mp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ def save_ssl_config(self):
})
self.kv.kv_put('ssl/hax', ssl_hax)

@func_log(func_enter, func_leave)
@repeat_if_fails()
def get_node_group(self, machine_id: str):
key = f'conf/node>{machine_id}>node_group'
node_group = self.kv.kv_get(key, allow_null=True)
if node_group:
return node_group['Value'].decode()
return None


class LogWriter:
def __init__(self, logger: logging.Logger, logging_handler):
Expand Down

0 comments on commit 9c6895e

Please sign in to comment.