Revert "Adds tags for inhibit and silence"
This reverts commit 8781a256f0
.
Since this only implements part of the silence / group / inhibit
feature, reverting until the rest is ready to go
Change-Id: Ied34507feb5d3580960c918254f905ab90d9691e
This commit is contained in:
parent
80b4f18e1e
commit
f69cb3152a
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
|
||||
* (C) Copyright 2015,2016 Hewlett Packard Enterprise Development LP
|
||||
* Copyright 2017 FUJITSU LIMITED
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -43,8 +43,6 @@ CREATE TABLE `alarm` (
|
|||
`state` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`lifecycle_state` varchar(50) DEFAULT NULL,
|
||||
`link` varchar(512) DEFAULT NULL,
|
||||
`inhibited` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`silenced` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`created_at` datetime NOT NULL,
|
||||
`state_updated_at` datetime,
|
||||
`updated_at` datetime NOT NULL,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
-- # Copyright 2017 FUJITSU LIMITED
|
||||
-- # (C) Copyright 2017 Hewlett Packard Enterprise Development LP
|
||||
---
|
||||
|
||||
SET statement_timeout = 0;
|
||||
|
@ -39,8 +38,6 @@ CREATE TABLE alarm (
|
|||
updated_at timestamp without time zone NOT NULL,
|
||||
lifecycle_state character varying(50),
|
||||
link character varying(512),
|
||||
inhibited boolean NOT NULL DEFAULT FALSE,
|
||||
silenced boolean NOT NULL DEFAULT FALSE,
|
||||
state character varying(20) NOT NULL,
|
||||
state_updated_at timestamp without time zone,
|
||||
alarm_definition_id character varying(36) NOT NULL
|
||||
|
|
|
@ -72,8 +72,6 @@ class AlarmsRepository(sql_repository.SQLRepository,
|
|||
a_s.c.created_at.label('created_timestamp'),
|
||||
a_s.c.lifecycle_state,
|
||||
a_s.c.link,
|
||||
a_s.c.inhibited,
|
||||
a_s.c.silenced,
|
||||
ad.c.id.label('alarm_definition_id'),
|
||||
ad.c.name.label('alarm_definition_name'),
|
||||
ad.c.severity,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright 2015 Robin Hood
|
||||
# Copyright 2016 FUJITSU LIMITED
|
||||
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
|
||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -33,8 +33,6 @@ def create_a_model(metadata=None):
|
|||
Column('state', String(20)),
|
||||
Column('lifecycle_state', String(50)),
|
||||
Column('link', String(512)),
|
||||
Column('inhibited', Boolean),
|
||||
Column('silenced', Boolean),
|
||||
Column('created_at', DateTime),
|
||||
Column('state_updated_at', DateTime),
|
||||
Column('updated_at', DateTime))
|
||||
|
|
|
@ -44,8 +44,6 @@ CREATE TABLE `alarm` (
|
|||
`state` varchar(20) NOT NULL,
|
||||
`lifecycle_state` varchar(50) DEFAULT NULL,
|
||||
`link` varchar(512) DEFAULT NULL,
|
||||
`inhibited` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`silenced` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`created_at` datetime NOT NULL,
|
||||
`state_updated_at` datetime,
|
||||
`updated_at` datetime NOT NULL,
|
||||
|
|
|
@ -441,8 +441,6 @@ class TestAlarmRepoDB(base.BaseTestCase):
|
|||
'id': '1',
|
||||
'lifecycle_state': 'OPEN',
|
||||
'link': 'http://somesite.com/this-alarm-info',
|
||||
'inhibited': False,
|
||||
'silenced': False,
|
||||
'metrics': [{'dimensions': {'instance_id': '123',
|
||||
'service': 'monitoring'},
|
||||
'name': 'cpu.idle_perc'},
|
||||
|
@ -458,8 +456,6 @@ class TestAlarmRepoDB(base.BaseTestCase):
|
|||
'id': '2',
|
||||
'lifecycle_state': 'OPEN',
|
||||
'link': 'http://somesite.com/this-alarm-info',
|
||||
'inhibited': False,
|
||||
'silenced': False,
|
||||
'metrics': [{'dimensions': {'instance_id': '123',
|
||||
'service': 'monitoring'},
|
||||
'name': 'cpu.idle_perc'}],
|
||||
|
@ -473,8 +469,6 @@ class TestAlarmRepoDB(base.BaseTestCase):
|
|||
'id': '234111',
|
||||
'lifecycle_state': None,
|
||||
'link': None,
|
||||
'inhibited': False,
|
||||
'silenced': False,
|
||||
'metrics': [
|
||||
{'dimensions': {'hostname': 'roland',
|
||||
'region': 'colorado',
|
||||
|
@ -496,8 +490,6 @@ class TestAlarmRepoDB(base.BaseTestCase):
|
|||
'id': '3',
|
||||
'lifecycle_state': None,
|
||||
'link': 'http://somesite.com/this-alarm-info',
|
||||
'inhibited': False,
|
||||
'silenced': False,
|
||||
'metrics': [{'dimensions': {'flavor_id': '222'},
|
||||
'name': 'cpu.idle_perc'}],
|
||||
'state': 'ALARM',
|
||||
|
@ -551,8 +543,6 @@ class TestAlarmRepoDB(base.BaseTestCase):
|
|||
u'state': alarm_row['state'],
|
||||
u'lifecycle_state': alarm_row['lifecycle_state'],
|
||||
u'link': alarm_row['link'],
|
||||
u'inhibited': alarm_row['inhibited'],
|
||||
u'silenced': alarm_row['silenced'],
|
||||
u'state_updated_timestamp':
|
||||
alarm_row['state_updated_timestamp'].isoformat() +
|
||||
'Z',
|
||||
|
@ -883,27 +873,3 @@ class TestAlarmRepoDB(base.BaseTestCase):
|
|||
'expression': 'avg(cpu.idle_perc{flavor_id=777, image_id=888, device=1}) > 10',
|
||||
'sub_alarm_id': '43'}]
|
||||
self.assertEqual(sub_alarms, expected)
|
||||
|
||||
def test_silence_inhibit_tag_true(self):
|
||||
silence_query = "UPDATE alarm SET silenced=1 WHERE id=1"
|
||||
inhibit_query = "UPDATE alarm SET inhibited=1 WHERE id=1"
|
||||
with self.engine.begin() as conn:
|
||||
conn.execute(silence_query)
|
||||
conn.execute(inhibit_query)
|
||||
|
||||
self.alarm1['inhibited'] = True
|
||||
self.alarm1['silenced'] = True
|
||||
|
||||
res = self.repo.get_alarms(tenant_id='Not a tenant id', limit=1)
|
||||
self.assertEqual(res, [])
|
||||
|
||||
tenant_id = 'bob'
|
||||
res = self.repo.get_alarms(tenant_id=tenant_id, limit=1000)
|
||||
res = self.helper_builder_result(res)
|
||||
|
||||
expected = [self.alarm1,
|
||||
self.alarm2,
|
||||
self.alarm_compound,
|
||||
self.alarm3]
|
||||
|
||||
self.assertEqual(res, expected)
|
||||
|
|
|
@ -267,8 +267,6 @@ class Alarms(alarms_api_v2.AlarmsV2API,
|
|||
u'state': alarm_row['state'],
|
||||
u'lifecycle_state': alarm_row['lifecycle_state'],
|
||||
u'link': alarm_row['link'],
|
||||
u'inhibited': alarm_row['inhibited'],
|
||||
u'silenced': alarm_row['silenced'],
|
||||
u'state_updated_timestamp':
|
||||
alarm_row['state_updated_timestamp'].isoformat() +
|
||||
'Z',
|
||||
|
@ -324,8 +322,6 @@ class Alarms(alarms_api_v2.AlarmsV2API,
|
|||
u'state': alarm_row['state'],
|
||||
u'lifecycle_state': alarm_row['lifecycle_state'],
|
||||
u'link': alarm_row['link'],
|
||||
u'inhibited': alarm_row['inhibited'],
|
||||
u'silenced': alarm_row['silenced'],
|
||||
u'state_updated_timestamp':
|
||||
alarm_row['state_updated_timestamp'].isoformat() +
|
||||
'Z',
|
||||
|
|
Loading…
Reference in New Issue