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

Commit

Permalink
EOS-20028: updated confstore index for updating storageset data (#5987)
Browse files Browse the repository at this point in the history
Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
  • Loading branch information
tanujashinde0405 committed Jul 23, 2021
1 parent 83a74d9 commit 193590a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
13 changes: 8 additions & 5 deletions lr-cli/cortx_setup/commands/storageset/add/enclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
get_enclosure_id,
get_pillar_data
)

from provisioner.commands import PillarSet
from cortx.utils.conf_store import Conf
from provisioner.commands import (
PillarSet,
confstore_export
)


class AddStorageEnclosure(Command):
Expand All @@ -49,7 +51,7 @@ class AddStorageEnclosure(Command):

def run(self, storage_set_name=None, storage_enclosure=None):
try:
index = 'cluster_info_index'
index = 'storage_enclosure_index'
cluster_id = get_cluster_id()
enclosure_id = []

Expand Down Expand Up @@ -95,8 +97,7 @@ def run(self, storage_set_name=None, storage_enclosure=None):

PillarSet().run(
'cluster/storage_set/storage_enclosures',
enclosure_id,
local=True
enclosure_id
)
Conf.set(
index,
Expand All @@ -109,6 +110,8 @@ def run(self, storage_set_name=None, storage_enclosure=None):
f"Storage enclosure for nodes {storage_enclosure} with corresponding "
f"enclosure_id {enclosure_id} added to Storageset"
)
self.logger.debug("Exporting to Confstore")
confstore_export.ConfStoreExport().run()

except ValueError as exc:
raise ValueError(
Expand Down
12 changes: 8 additions & 4 deletions lr-cli/cortx_setup/commands/storageset/add/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
get_pillar_data
)

from provisioner.commands import PillarSet
from provisioner.commands import (
PillarSet,
confstore_export
)
from cortx.utils.conf_store import Conf


Expand All @@ -49,7 +52,7 @@ class AddServerNode(Command):

def run(self, storage_set_name=None, server_node=None):
try:
index = 'cluster_info_index'
index = 'storage_add_index'
cluster_id = get_cluster_id()
machine_id = []

Expand Down Expand Up @@ -90,8 +93,7 @@ def run(self, storage_set_name=None, server_node=None):

PillarSet().run(
'cluster/storage_set/server_nodes',
machine_id,
local=True
machine_id
)
Conf.set(
index,
Expand All @@ -102,6 +104,8 @@ def run(self, storage_set_name=None, server_node=None):
Conf.save(index)
self.logger.debug(f"Server nodes {server_node} with correspoding "
f"machine_id {machine_id} added to Storageset")
self.logger.debug("Exporting to Confstore")
confstore_export.ConfStoreExport().run()

except ValueError as exc:
raise ValueError(
Expand Down
12 changes: 8 additions & 4 deletions lr-cli/cortx_setup/commands/storageset/config/durability.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
get_cluster_id
)

from provisioner.commands import PillarSet
from provisioner.commands import (
PillarSet,
confstore_export
)
from provisioner.salt import local_minion_id
from cortx.utils.conf_store import Conf

Expand Down Expand Up @@ -66,7 +69,7 @@ class DurabilityConfig(Command):
def run(self, **kwargs):
try:
node_id = local_minion_id()
index = 'cluster_info_index'
index = 'storage_durability_index'
storage_set_name = kwargs['storage_set_name']
durability_type = kwargs['durability_type']
cluster_id = get_cluster_id()
Expand Down Expand Up @@ -96,8 +99,7 @@ def run(self, **kwargs):

PillarSet().run(
'cluster/storage_set/durability',
durability_dict,
local=True
durability_dict
)
Conf.set(
index,
Expand All @@ -109,6 +111,8 @@ def run(self, **kwargs):
self.logger.debug(
f"Durability configured for Storageset '{storage_set_name}'"
)
self.logger.debug("Exporting to Confstore")
confstore_export.ConfStoreExport().run()

except ValueError as exc:
raise ValueError(
Expand Down
16 changes: 10 additions & 6 deletions lr-cli/cortx_setup/commands/storageset/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
from cortx_setup.commands.common_utils import (
get_cluster_id
)
from provisioner.commands import PillarSet
from provisioner.commands import (
PillarSet,
confstore_export
)
from provisioner.salt import local_minion_id
from cortx.utils.conf_store import Conf

Expand All @@ -45,7 +48,7 @@ class CreateStorageSet(Command):
def run(self, name=None, count=None):
try:
node_id = local_minion_id()
index = 'cluster_info_index'
index = 'storage_create_index'

# TODO: Addnl validation needed. Support for updating
# values for multiple storagesets in a cluster.
Expand All @@ -62,15 +65,13 @@ def run(self, name=None, count=None):

PillarSet().run(
'cluster/storage_set/name',
name,
local=True
name
)

# Not updating node count to Confstore
PillarSet().run(
'cluster/storage_set/count',
count,
local=True
count
)

Conf.set(
Expand All @@ -81,6 +82,9 @@ def run(self, name=None, count=None):

Conf.save(index)

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

except ValueError as exc:
raise ValueError(
f"Failed to create Storageset: {str(exc)}"
Expand Down

0 comments on commit 193590a

Please sign in to comment.