Skip to content

Commit

Permalink
feat: add get gateway and subnet mask params for gcp nfs
Browse files Browse the repository at this point in the history
  • Loading branch information
kristina-solovyova authored and assafgi committed Sep 3, 2024
1 parent c1a6adb commit 6e9f9a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions clusterize/configure_nfs_protocol_gw.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func (c *ConfigureNfsScriptGenerator) GetNFSSetupScript() string {
containersUid=(%s)
nic_names=(%s)
secondary_ips=(%s)
gateway="%s"
subnet_mask="%s"
LOAD_BALANCER_IP="%s"
# fetch function definition
Expand Down Expand Up @@ -58,8 +60,14 @@ func (c *ConfigureNfsScriptGenerator) GetNFSSetupScript() string {
current_mngmnt_ip=$(weka local resources | grep 'Management IPs' | awk '{print $NF}')
nic_name=$(ip -o -f inet addr show | grep "$current_mngmnt_ip/"| awk '{print $2}')
gateway=$(ip r | grep default | awk '{print $3}')
subnet_mask=$(ifconfig $nic_name | grep 'inet ' | awk '{print $4}')
if [ -z "$gateway" ]; then
gateway=$(ip r | grep default | awk '{print $3}')
fi
if [ -z "$subnet_mask" ]; then
subnet_mask=$(ifconfig $nic_name | grep 'inet ' | awk '{print $4}')
fi
function create_interface_group() {
if weka_rest interfacegroups | grep ${interface_group_name}; then
Expand Down Expand Up @@ -149,6 +157,8 @@ func (c *ConfigureNfsScriptGenerator) GetNFSSetupScript() string {
strings.Join(c.Params.ContainersUid, " "),
strings.Join(c.Params.NicNames, " "),
strings.Join(c.Params.SecondaryIps, " "),
c.Params.Gateway,
c.Params.SubnetMask,
c.LoadBalancerIP,
c.FuncDef.GetFunctionCmdDefinition(functions_def.Fetch),
c.FuncDef.GetFunctionCmdDefinition(functions_def.Report),
Expand Down
2 changes: 2 additions & 0 deletions protocol/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ type NFSParams struct {
ContainersUid []string
NicNames []string
HostsNum int
Gateway string // optional
SubnetMask string // optional
}

type Vm struct {
Expand Down

0 comments on commit 6e9f9a8

Please sign in to comment.