Skip to content

Commit

Permalink
Added logic to invoke update dashboard flow from monitoring integration
Browse files Browse the repository at this point in the history
tendrl-bug-id: Tendrl#385
Signed-off-by: Shubhendu <[email protected]>
  • Loading branch information
Shubhendu committed Aug 31, 2017
1 parent f56e899 commit dcb4290
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tendrl/gluster_integration/sds_sync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from tendrl.commons import sds_sync
from tendrl.commons.utils import cmd_utils
from tendrl.commons.utils import etcd_utils
from tendrl.commons.utils import monitoring_utils
from tendrl.commons.utils.time_utils import now as tendrl_now
from tendrl.gluster_integration import ini2json
from tendrl.gluster_integration.sds_sync import brick_device_details
Expand All @@ -26,6 +27,10 @@

gevent.hub.Hub.NOT_ERROR=(Exception,)

RESOURCE_TYPE_BRICK = "brick"
RESOURCE_TYPE_PEER = "host"
RESOURCE_TYPE_VOLUME = "volume"


class GlusterIntegrationSdsSyncStateThread(sds_sync.SdsSyncThread):

Expand Down Expand Up @@ -151,6 +156,13 @@ def _run(self):
],
state=peers['peer%s.state' % index]
)
if not peer.exists():
monitoring_utils.update_dashboard(
peer.hostname,
RESOURCE_TYPE_PEER,
NS.tendrl_context.integration_id,
"add"
)
peer.save(ttl=SYNC_TTL)
index += 1
except KeyError:
Expand Down Expand Up @@ -346,6 +358,13 @@ def sync_volumes(volumes, index, vol_options):
snapd_status=volumes['volume%s.snapd_svc.online_status' % index],
snapd_inited=volumes['volume%s.snapd_svc.inited' % index],
)
if not volume.exists():
monitoring_utils.update_dashboard(
volume.name,
RESOURCE_TYPE_VOLUME,
NS.tendrl_context.integration_id,
"add"
)
volume.save(ttl=SYNC_TTL)

# Save the default values of volume options
Expand Down Expand Up @@ -514,6 +533,13 @@ def sync_volumes(volumes, index, vol_options):
'volume%s.brick%s.is_arbiter' % (index, b_index)
),
)
if not brick.exists():
monitoring_utils.update_dashboard(
brick.brick_name,
RESOURCE_TYPE_BRICK,
NS.tendrl_context.integration_id,
"add"
)
brick.save(ttl=SYNC_TTL)
# sync brick device details
brick_device_details.\
Expand Down

0 comments on commit dcb4290

Please sign in to comment.