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

Commit

Permalink
virtual-host-fix: Add virtual-host parameter to cluster create command (
Browse files Browse the repository at this point in the history
#5986)

* Add virtaul-host parameter to cluster create command

Signed-off-by: Anjali Somwanshi <anjali.somwanshi@seagate.com>

* fix typo error

Signed-off-by: Anjali Somwanshi <anjali.somwanshi@seagate.com>
  • Loading branch information
SomwanshiAnjali committed Jul 23, 2021
1 parent b2ae11c commit c6ba4b9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 124 deletions.
2 changes: 0 additions & 2 deletions lr-cli/cortx_setup/api_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ cluster:
prepare:
ClusterPrepare
config:
network:
ClusterNetworkConfig
component:
ClusterConfigComponent

Expand Down
2 changes: 0 additions & 2 deletions lr-cli/cortx_setup/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from .cluster.encrypt import EncryptSecrets
from .cluster.generate import GenerateCluster
from .cluster.show import ClusterShow
from .cluster.config.network import ClusterNetworkConfig
from .cluster.prepare import ClusterPrepare
from .cluster.config.component import ClusterConfigComponent
from .security.config import SecurityConfig
Expand All @@ -55,7 +54,6 @@
'AddStorageEnclosure',
'Commons',
'ClusterCreate',
'ClusterNetworkConfig',
'ClusterPrepare',
'ClusterConfigComponent',
'ClusterShow',
Expand Down
90 changes: 0 additions & 90 deletions lr-cli/cortx_setup/commands/cluster/config/network.py

This file was deleted.

35 changes: 29 additions & 6 deletions lr-cli/cortx_setup/commands/cluster/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from cortx_setup.commands.node.prepare.time import (
NodePrepareTime
)
from cortx_setup.validate import ipv4
from cortx.utils.conf_store import Conf

from provisioner.commands import (
Expand Down Expand Up @@ -122,6 +123,12 @@ class ClusterCreate(Command):
'optional': True,
'help': ('iso os path, for iso-source deployment. '
'e.g: {/opt/isos/cortx-os-1.0.0-23.iso}')
},
'virtual_host': {
'type': ipv4,
'default': None,
'optional': True,
'help': 'Management vip'
}
}

Expand All @@ -140,7 +147,7 @@ def run(self, **kwargs):
index = 'cluster_info_index'
local_minion = None
local_fqdn = socket.gethostname()
cluster_args = ['name', 'site_count', 'storageset_count']
cluster_args = ['name', 'site_count', 'storageset_count', 'virtual_host']

# Ref: `nodes` will be removed from this args list.
# Read more on https://github.com/Seagate/cortx-prvsnr/tree/pre-cortx-1.0/docs/design_updates.md#field-api-design-changes
Expand Down Expand Up @@ -231,8 +238,6 @@ def run(self, **kwargs):
self.logger.debug(f"Setting time on enclosure with server & timezone")
NodePrepareTime().set_enclosure_time()
StatesApplier.apply( ['components.system.config.sync_salt'] ,targets=ALL_MINIONS)
self.logger.debug("Exporting to Confstore")
confstore_export.ConfStoreExport().run()

self.logger.info("Environment set up! Proceeding to create a cluster..")

Expand All @@ -241,15 +246,15 @@ def run(self, **kwargs):
f'json://{CONFSTORE_CLUSTER_FILE}'
)
clust_id = get_cluster_id()

for key, value in cluster_dict.items():
if value:
if value and 'virtual_host' not in key:
self.logger.debug(
f"Updating {key} to {value} in confstore"
)
PillarSet().run(
f'cluster/{key}',
value,
local=True
value
)
if 'storageset_count' in key:
conf_key = f'cluster>{clust_id}>site>storage_set_count'
Expand All @@ -260,7 +265,25 @@ def run(self, **kwargs):
conf_key,
value
)
if value and 'virtual_host' in key:
self.logger.debug(
f"Updating virtual_host to {value} in confstore"
)
PillarSet().run(
f'cluster/mgmt_vip',
value
)
Conf.set(
index,
f'cluster>{clust_id}>network>management>virtual_host',
value

)
Conf.save(index)

self.logger.debug("Exporting to Confstore")
confstore_export.ConfStoreExport().run()

self.logger.debug("Success: Cluster created")
return f"Cluster created with node(s): {nodes}"

Expand Down
29 changes: 5 additions & 24 deletions node_cli/schema/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
"type": "str",
"help": "iso os path, for iso-source deployment. e.g: {/opt/isos/cortx-os-1.0.0-23.iso}"
},
{
"flag": "--virtual_host",
"type": "str",
"help": "Management vip"
},
{
"flag": "args",
"default": [],
Expand All @@ -96,30 +101,6 @@
"description": "Cluster config command",
"permissions_tag": "bypass",
"sub_commands": [
{
"name": "network",
"description": "cluster network config command",
"permissions_tag": "bypass",
"args": [
{
"flag": "--virtual_host",
"type": "str",
"help": "Cluster vip"
},
{
"flag": "args",
"default": [],
"suppress_help": true,
"nargs": "?",
"help": ""
}],
"comm": {
"type": "direct",
"target": "cortx_setup.commands",
"method": "run",
"class": "ClusterNetworkConfig"
}
},
{
"name": "component",
"description": "cluster component config command",
Expand Down

0 comments on commit c6ba4b9

Please sign in to comment.