Skip to content

Commit

Permalink
Merge 339790c into 0074ca6
Browse files Browse the repository at this point in the history
  • Loading branch information
nnDarshan committed Dec 30, 2016
2 parents 0074ca6 + 339790c commit a261de1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 34 deletions.
13 changes: 6 additions & 7 deletions tendrl/ceph_integration/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import greenlet
import logging
import signal
import sys
import traceback

import gevent.event
Expand Down Expand Up @@ -198,13 +197,13 @@ def main():
config.get('ceph_integration', 'log_cfg_path'),
config.get('ceph_integration', 'log_level')
)
if sys.argv:
if len(sys.argv) > 1:
if "cluster-id" in sys.argv[1]:
cluster_id = sys.argv[2]
utils.set_tendrl_context(cluster_id)

m = Manager(utils.get_tendrl_context())
cluster_id = utils.get_tendrl_context()
if not cluster_id:
LOG.error("Could not find cluster_id")
exit(1)

m = Manager(cluster_id)
m.start()

complete = gevent.event.Event()
Expand Down
33 changes: 17 additions & 16 deletions tendrl/ceph_integration/manager/tendrl_definitions_ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@
type: Create
uuid: faeab231-69e9-4c9d-b5ef-a67ed057f98b
version: 1
DeletePool:
atoms:
- tendrl.ceph_integration.objects.pool.atoms.delete
description: "Delete Ceph Pool"
enabled: true
inputs:
mandatory:
- Pool.pool_id
- Tendrl_context.sds_name
- Tendrl_context.sds_version
- Tendrl_context.cluster_id
run: tendrl.ceph_integration.flows.delete_pool.DeletePool
type: Delete
uuid: 4ac41d8f-a0cf-420a-b2fe-18761e07f3b9
version: 1
objects:
Pool:
atoms:
Expand Down Expand Up @@ -61,6 +46,22 @@
run: tendrl.ceph_integration.objects.pool.atoms.delete.Delete
type: Delete
uuid: 9a2df258-9b24-4fd3-a66f-ee346e2e3720
flows:
DeletePool:
atoms:
- tendrl.ceph_integration.objects.pool.atoms.delete
description: "Delete Ceph Pool"
enabled: true
inputs:
mandatory:
- Pool.pool_id
- Tendrl_context.sds_name
- Tendrl_context.sds_version
- Tendrl_context.cluster_id
run: tendrl.ceph_integration.flows.delete_pool.DeletePool
type: Delete
uuid: 4ac41d8f-a0cf-420a-b2fe-18761e07f3b9
version: 1
attrs:
crush_ruleset:
help: "The ID of a CRUSH ruleset to use for this pool. The specified ruleset must exist."
Expand Down Expand Up @@ -114,4 +115,4 @@
enabled: true
value: clusters/$Tendrl_context.cluster_id/Tendrl_context/
tendrl_schema_version: 0.3
"""
"""
15 changes: 4 additions & 11 deletions tendrl/ceph_integration/manager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,19 @@
import subprocess

LOG = logging.getLogger(__name__)
TENDRL_CONTEXT = "/etc/tendrl/ceph_integration/tendrl_context"
NODE_CONTEXT = "/etc/tendrl/node_agent/node_context"
FSID = "/etc/tendrl/ceph_integration/fsid"
TENDRL_CONTEXT = "/var/lib/tendrl/ceph_cluster_id"
NODE_CONTEXT = "/etc/tendrl/node_agent/node_context"


def get_tendrl_context():
# check if valid uuid is already present in tendrl_context
# if not present generate one and update the file
if os.path.isfile(TENDRL_CONTEXT):
with open(TENDRL_CONTEXT) as f:
cluster_id = f.read()
LOG.info("Tendrl_context.cluster_id=%s found!" % cluster_id)
return cluster_id


def set_tendrl_context(cluster_id):
with open(TENDRL_CONTEXT, 'wb+') as f:
f.write(cluster_id)
LOG.info("Tendrl_context.cluster_id==%s created!" % cluster_id)
return cluster_id
else:
return None


def get_node_context():
Expand Down

0 comments on commit a261de1

Please sign in to comment.