def _run(self, application, socket): """Start a WSGI server in a new green thread.""" logger = logging.getLogger('eventlet.wsgi') eventlet.wsgi.server(socket, application, custom_pool=self.tg.pool, log=logging.WritableLogger(logger))
def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using openstack's default logging system""" priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( 'libra.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using OpenStack's default logging system. """ priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( 'libra.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
# License for the specific language governing permissions and limitations # under the License. import eventlet eventlet.monkey_patch() import ipaddress from libra.common.json_gearman import JSONGearmanClient from libra.common.api.lbaas import LoadBalancer, db_session, Device, Node, Vip from libra.common.api.lbaas import HealthMonitor, Counters from libra.common.api.lbaas import loadbalancers_devices from libra.common.api.mnb import update_mnb from libra.openstack.common import log from pecan import conf LOG = log.getLogger(__name__) gearman_workers = [ 'UPDATE', # Create/Update a Load Balancer. 'SUSPEND', # Suspend a Load Balancer. 'ENABLE', # Enable a suspended Load Balancer. 'DELETE', # Delete a Load Balancer. 'DISCOVER', # Return service discovery information. 'ARCHIVE', # Archive LB log files. 'METRICS', # Get load balancer statistics. 'STATS' # Ping load balancers ] def submit_job(job_type, host, data, lbid):
# # 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. import threading from datetime import datetime from oslo.config import cfg from libra.common.api.lbaas import LoadBalancer, Device, Node, db_session from libra.openstack.common import log as logging from libra.admin_api.stats.stats_gearman import GearJobs LOG = logging.getLogger(__name__) class PingStats(object): PING_SECONDS = cfg.CONF['admin_api'].ping_timer_seconds def __init__(self, drivers): self.drivers = drivers self.ping_timer = None self.error_limit = cfg.CONF['admin_api']['stats_device_error_limit'] self.server_id = cfg.CONF['admin_api']['server_id'] self.number_of_servers = cfg.CONF['admin_api']['number_of_servers'] self.stats_driver = cfg.CONF['admin_api']['stats_driver'] LOG.info("Selected stats drivers: %s", self.stats_driver)