Merge "Remove status* fields from HealthMonitor model"
This commit is contained in:
commit
6c0dd3f455
@ -130,8 +130,7 @@ class Pool(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant,
|
|||||||
vip = orm.relationship(Vip, backref='pool')
|
vip = orm.relationship(Vip, backref='pool')
|
||||||
|
|
||||||
|
|
||||||
class HealthMonitor(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant,
|
class HealthMonitor(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
|
||||||
models_v2.HasStatusDescription):
|
|
||||||
"""Represents a v2 neutron loadbalancer healthmonitor."""
|
"""Represents a v2 neutron loadbalancer healthmonitor."""
|
||||||
|
|
||||||
type = sa.Column(sa.Enum("PING", "TCP", "HTTP", "HTTPS",
|
type = sa.Column(sa.Enum("PING", "TCP", "HTTP", "HTTPS",
|
||||||
@ -667,9 +666,7 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase,
|
|||||||
'delay': health_monitor['delay'],
|
'delay': health_monitor['delay'],
|
||||||
'timeout': health_monitor['timeout'],
|
'timeout': health_monitor['timeout'],
|
||||||
'max_retries': health_monitor['max_retries'],
|
'max_retries': health_monitor['max_retries'],
|
||||||
'admin_state_up': health_monitor['admin_state_up'],
|
'admin_state_up': health_monitor['admin_state_up']}
|
||||||
'status': health_monitor['status'],
|
|
||||||
'status_description': health_monitor['status_description']}
|
|
||||||
# no point to add the values below to
|
# no point to add the values below to
|
||||||
# the result if the 'type' is not HTTP/S
|
# the result if the 'type' is not HTTP/S
|
||||||
if res['type'] in ['HTTP', 'HTTPS']:
|
if res['type'] in ['HTTP', 'HTTPS']:
|
||||||
@ -692,8 +689,7 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase,
|
|||||||
http_method=v['http_method'],
|
http_method=v['http_method'],
|
||||||
url_path=v['url_path'],
|
url_path=v['url_path'],
|
||||||
expected_codes=v['expected_codes'],
|
expected_codes=v['expected_codes'],
|
||||||
admin_state_up=v['admin_state_up'],
|
admin_state_up=v['admin_state_up'])
|
||||||
status=constants.ACTIVE)
|
|
||||||
context.session.add(monitor_db)
|
context.session.add(monitor_db)
|
||||||
return self._make_health_monitor_dict(monitor_db)
|
return self._make_health_monitor_dict(monitor_db)
|
||||||
|
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
#
|
||||||
|
# Copyright 2013 OpenStack Foundation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
"""remove status from HealthMonitor
|
||||||
|
|
||||||
|
Revision ID: 35c7c198ddea
|
||||||
|
Revises: 11c6e18605c8
|
||||||
|
Create Date: 2013-08-02 23:14:54.037976
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '35c7c198ddea'
|
||||||
|
down_revision = '11c6e18605c8'
|
||||||
|
|
||||||
|
# Change to ['*'] if this migration applies to all plugins
|
||||||
|
|
||||||
|
migration_for_plugins = ['*']
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade(active_plugin=None, options=None):
|
||||||
|
if not migration.should_run(active_plugin, migration_for_plugins):
|
||||||
|
return
|
||||||
|
op.drop_column('healthmonitors', 'status')
|
||||||
|
op.drop_column('healthmonitors', 'status_description')
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(active_plugin=None, options=None):
|
||||||
|
if not migration.should_run(active_plugin, migration_for_plugins):
|
||||||
|
return
|
||||||
|
|
||||||
|
op.add_column('healthmonitors', sa.Column('status',
|
||||||
|
sa.String(16),
|
||||||
|
nullable=False))
|
||||||
|
op.add_column('healthmonitors', sa.Column('status_description',
|
||||||
|
sa.String(255)))
|
@ -831,8 +831,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
('delay', 30),
|
('delay', 30),
|
||||||
('timeout', 10),
|
('timeout', 10),
|
||||||
('max_retries', 3),
|
('max_retries', 3),
|
||||||
('admin_state_up', True),
|
('admin_state_up', True)]
|
||||||
('status', 'ACTIVE')]
|
|
||||||
with self.health_monitor() as monitor:
|
with self.health_monitor() as monitor:
|
||||||
for k, v in keys:
|
for k, v in keys:
|
||||||
self.assertEqual(monitor['health_monitor'][k], v)
|
self.assertEqual(monitor['health_monitor'][k], v)
|
||||||
@ -843,8 +842,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
('delay', 20),
|
('delay', 20),
|
||||||
('timeout', 20),
|
('timeout', 20),
|
||||||
('max_retries', 2),
|
('max_retries', 2),
|
||||||
('admin_state_up', False),
|
('admin_state_up', False)]
|
||||||
('status', 'PENDING_UPDATE')]
|
|
||||||
with self.health_monitor() as monitor:
|
with self.health_monitor() as monitor:
|
||||||
data = {'health_monitor': {'delay': 20,
|
data = {'health_monitor': {'delay': 20,
|
||||||
'timeout': 20,
|
'timeout': 20,
|
||||||
@ -915,8 +913,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
('delay', 30),
|
('delay', 30),
|
||||||
('timeout', 10),
|
('timeout', 10),
|
||||||
('max_retries', 3),
|
('max_retries', 3),
|
||||||
('admin_state_up', True),
|
('admin_state_up', True)]
|
||||||
('status', 'ACTIVE')]
|
|
||||||
req = self.new_show_request('health_monitors',
|
req = self.new_show_request('health_monitors',
|
||||||
monitor['health_monitor']['id'],
|
monitor['health_monitor']['id'],
|
||||||
fmt=self.fmt)
|
fmt=self.fmt)
|
||||||
|
Loading…
Reference in New Issue
Block a user