[hopem] Added use-syslog cfg option to allow logging to syslog
This commit is contained in:
parent
4be26cb9e4
commit
5ffc750880
@ -50,6 +50,11 @@ options:
|
|||||||
type: string
|
type: string
|
||||||
description: RabbitMQ Virtual Host
|
description: RabbitMQ Virtual Host
|
||||||
default: openstack
|
default: openstack
|
||||||
|
use-syslog:
|
||||||
|
type: boolean
|
||||||
|
default: False
|
||||||
|
description: |
|
||||||
|
If set to True, supporting services will log to syslog.
|
||||||
instance-mtu:
|
instance-mtu:
|
||||||
type: int
|
type: int
|
||||||
description: |
|
description: |
|
||||||
|
@ -25,6 +25,9 @@ from charmhelpers.contrib.openstack.utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
import charmhelpers.contrib.openstack.context as context
|
import charmhelpers.contrib.openstack.context as context
|
||||||
|
from charmhelpers.contrib.openstack.context import (
|
||||||
|
SyslogContext
|
||||||
|
)
|
||||||
import charmhelpers.contrib.openstack.templating as templating
|
import charmhelpers.contrib.openstack.templating as templating
|
||||||
from charmhelpers.contrib.openstack.neutron import headers_package
|
from charmhelpers.contrib.openstack.neutron import headers_package
|
||||||
from quantum_contexts import (
|
from quantum_contexts import (
|
||||||
@ -150,19 +153,22 @@ NOVA_CONFIG_FILES = {
|
|||||||
'hook_contexts': [context.AMQPContext(),
|
'hook_contexts': [context.AMQPContext(),
|
||||||
QuantumSharedDBContext(),
|
QuantumSharedDBContext(),
|
||||||
NetworkServiceContext(),
|
NetworkServiceContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['nova-api-metadata']
|
'services': ['nova-api-metadata']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
QUANTUM_SHARED_CONFIG_FILES = {
|
QUANTUM_SHARED_CONFIG_FILES = {
|
||||||
QUANTUM_DHCP_AGENT_CONF: {
|
QUANTUM_DHCP_AGENT_CONF: {
|
||||||
'hook_contexts': [QuantumGatewayContext()],
|
'hook_contexts': [QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['quantum-dhcp-agent']
|
'services': ['quantum-dhcp-agent']
|
||||||
},
|
},
|
||||||
QUANTUM_METADATA_AGENT_CONF: {
|
QUANTUM_METADATA_AGENT_CONF: {
|
||||||
'hook_contexts': [NetworkServiceContext(),
|
'hook_contexts': [NetworkServiceContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['quantum-metadata-agent']
|
'services': ['quantum-metadata-agent']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -170,7 +176,8 @@ QUANTUM_SHARED_CONFIG_FILES.update(NOVA_CONFIG_FILES)
|
|||||||
|
|
||||||
NEUTRON_SHARED_CONFIG_FILES = {
|
NEUTRON_SHARED_CONFIG_FILES = {
|
||||||
NEUTRON_DHCP_AGENT_CONF: {
|
NEUTRON_DHCP_AGENT_CONF: {
|
||||||
'hook_contexts': [QuantumGatewayContext()],
|
'hook_contexts': [QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['neutron-dhcp-agent']
|
'services': ['neutron-dhcp-agent']
|
||||||
},
|
},
|
||||||
NEUTRON_DNSMASQ_CONF: {
|
NEUTRON_DNSMASQ_CONF: {
|
||||||
@ -179,7 +186,8 @@ NEUTRON_SHARED_CONFIG_FILES = {
|
|||||||
},
|
},
|
||||||
NEUTRON_METADATA_AGENT_CONF: {
|
NEUTRON_METADATA_AGENT_CONF: {
|
||||||
'hook_contexts': [NetworkServiceContext(),
|
'hook_contexts': [NetworkServiceContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['neutron-metadata-agent']
|
'services': ['neutron-metadata-agent']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -188,20 +196,23 @@ NEUTRON_SHARED_CONFIG_FILES.update(NOVA_CONFIG_FILES)
|
|||||||
QUANTUM_OVS_CONFIG_FILES = {
|
QUANTUM_OVS_CONFIG_FILES = {
|
||||||
QUANTUM_CONF: {
|
QUANTUM_CONF: {
|
||||||
'hook_contexts': [context.AMQPContext(),
|
'hook_contexts': [context.AMQPContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['quantum-l3-agent',
|
'services': ['quantum-l3-agent',
|
||||||
'quantum-dhcp-agent',
|
'quantum-dhcp-agent',
|
||||||
'quantum-metadata-agent',
|
'quantum-metadata-agent',
|
||||||
'quantum-plugin-openvswitch-agent']
|
'quantum-plugin-openvswitch-agent']
|
||||||
},
|
},
|
||||||
QUANTUM_L3_AGENT_CONF: {
|
QUANTUM_L3_AGENT_CONF: {
|
||||||
'hook_contexts': [NetworkServiceContext()],
|
'hook_contexts': [NetworkServiceContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['quantum-l3-agent']
|
'services': ['quantum-l3-agent']
|
||||||
},
|
},
|
||||||
# TODO: Check to see if this is actually required
|
# TODO: Check to see if this is actually required
|
||||||
QUANTUM_OVS_PLUGIN_CONF: {
|
QUANTUM_OVS_PLUGIN_CONF: {
|
||||||
'hook_contexts': [QuantumSharedDBContext(),
|
'hook_contexts': [QuantumSharedDBContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['quantum-plugin-openvswitch-agent']
|
'services': ['quantum-plugin-openvswitch-agent']
|
||||||
},
|
},
|
||||||
EXT_PORT_CONF: {
|
EXT_PORT_CONF: {
|
||||||
@ -214,7 +225,8 @@ QUANTUM_OVS_CONFIG_FILES.update(QUANTUM_SHARED_CONFIG_FILES)
|
|||||||
NEUTRON_OVS_CONFIG_FILES = {
|
NEUTRON_OVS_CONFIG_FILES = {
|
||||||
NEUTRON_CONF: {
|
NEUTRON_CONF: {
|
||||||
'hook_contexts': [context.AMQPContext(),
|
'hook_contexts': [context.AMQPContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['neutron-l3-agent',
|
'services': ['neutron-l3-agent',
|
||||||
'neutron-dhcp-agent',
|
'neutron-dhcp-agent',
|
||||||
'neutron-metadata-agent',
|
'neutron-metadata-agent',
|
||||||
@ -222,13 +234,15 @@ NEUTRON_OVS_CONFIG_FILES = {
|
|||||||
},
|
},
|
||||||
NEUTRON_L3_AGENT_CONF: {
|
NEUTRON_L3_AGENT_CONF: {
|
||||||
'hook_contexts': [NetworkServiceContext(),
|
'hook_contexts': [NetworkServiceContext(),
|
||||||
L3AgentContext()],
|
L3AgentContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['neutron-l3-agent']
|
'services': ['neutron-l3-agent']
|
||||||
},
|
},
|
||||||
# TODO: Check to see if this is actually required
|
# TODO: Check to see if this is actually required
|
||||||
NEUTRON_OVS_PLUGIN_CONF: {
|
NEUTRON_OVS_PLUGIN_CONF: {
|
||||||
'hook_contexts': [QuantumSharedDBContext(),
|
'hook_contexts': [QuantumSharedDBContext(),
|
||||||
QuantumGatewayContext()],
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['neutron-plugin-openvswitch-agent']
|
'services': ['neutron-plugin-openvswitch-agent']
|
||||||
},
|
},
|
||||||
EXT_PORT_CONF: {
|
EXT_PORT_CONF: {
|
||||||
|
@ -3,6 +3,7 @@ state_path = /var/lib/quantum
|
|||||||
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
|
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
|
||||||
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
|
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
|
||||||
root_helper = sudo /usr/bin/quantum-rootwrap /etc/quantum/rootwrap.conf
|
root_helper = sudo /usr/bin/quantum-rootwrap /etc/quantum/rootwrap.conf
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
{% if plugin == 'nvp' %}
|
{% if plugin == 'nvp' %}
|
||||||
ovs_use_veth = True
|
ovs_use_veth = True
|
||||||
enable_metadata_network = True
|
enable_metadata_network = True
|
||||||
|
@ -6,3 +6,4 @@ admin_tenant_name = {{ service_tenant }}
|
|||||||
admin_user = {{ service_username }}
|
admin_user = {{ service_username }}
|
||||||
admin_password = {{ service_password }}
|
admin_password = {{ service_password }}
|
||||||
root_helper = sudo /usr/bin/quantum-rootwrap /etc/quantum/rootwrap.conf
|
root_helper = sudo /usr/bin/quantum-rootwrap /etc/quantum/rootwrap.conf
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
|
@ -15,3 +15,4 @@ nova_metadata_port = 8775
|
|||||||
# but it must match here and in the configuration used by the Nova Metadata
|
# but it must match here and in the configuration used by the Nova Metadata
|
||||||
# Server. NOTE: Nova uses a different key: quantum_metadata_proxy_shared_secret
|
# Server. NOTE: Nova uses a different key: quantum_metadata_proxy_shared_secret
|
||||||
metadata_proxy_shared_secret = {{ shared_secret }}
|
metadata_proxy_shared_secret = {{ shared_secret }}
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
|
@ -4,6 +4,7 @@ state_path=/var/lib/nova
|
|||||||
lock_path=/var/lock/nova
|
lock_path=/var/lock/nova
|
||||||
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
|
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
|
||||||
verbose=True
|
verbose=True
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
api_paste_config=/etc/nova/api-paste.ini
|
api_paste_config=/etc/nova/api-paste.ini
|
||||||
enabled_apis=metadata
|
enabled_apis=metadata
|
||||||
multi_host=True
|
multi_host=True
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
[DATABASE]
|
[DATABASE]
|
||||||
sql_connection = mysql://{{ quantum_user }}:{{ quantum_password }}@{{ database_host }}/{{ quantum_db }}?charset=utf8
|
sql_connection = mysql://{{ quantum_user }}:{{ quantum_password }}@{{ database_host }}/{{ quantum_db }}?charset=utf8
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
@ -5,6 +5,7 @@ rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
|||||||
rabbit_host = {{ rabbitmq_host }}
|
rabbit_host = {{ rabbitmq_host }}
|
||||||
rabbit_password = {{ rabbitmq_password }}
|
rabbit_password = {{ rabbitmq_password }}
|
||||||
debug = True
|
debug = True
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
bind_host = 0.0.0.0
|
bind_host = 0.0.0.0
|
||||||
bind_port = 9696
|
bind_port = 9696
|
||||||
core_plugin = {{ core_plugin }}
|
core_plugin = {{ core_plugin }}
|
||||||
|
@ -7,6 +7,7 @@ state_path = /var/lib/neutron
|
|||||||
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
|
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
|
||||||
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
|
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
|
||||||
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
ovs_use_veth = True
|
ovs_use_veth = True
|
||||||
{% if instance_mtu -%}
|
{% if instance_mtu -%}
|
||||||
dnsmasq_config_file = /etc/neutron/dnsmasq.conf
|
dnsmasq_config_file = /etc/neutron/dnsmasq.conf
|
||||||
|
@ -6,6 +6,7 @@ admin_tenant_name = {{ service_tenant }}
|
|||||||
admin_user = {{ service_username }}
|
admin_user = {{ service_username }}
|
||||||
admin_password = {{ service_password }}
|
admin_password = {{ service_password }}
|
||||||
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
ovs_use_veth = True
|
ovs_use_veth = True
|
||||||
handle_internal_only_routers = {{ handle_internal_only_router }}
|
handle_internal_only_routers = {{ handle_internal_only_router }}
|
||||||
{% if ext_net_id %}
|
{% if ext_net_id %}
|
||||||
|
@ -15,3 +15,4 @@ nova_metadata_port = 8775
|
|||||||
# but it must match here and in the configuration used by the Nova Metadata
|
# but it must match here and in the configuration used by the Nova Metadata
|
||||||
# Server. NOTE: Nova uses a different key: neutron_metadata_proxy_shared_secret
|
# Server. NOTE: Nova uses a different key: neutron_metadata_proxy_shared_secret
|
||||||
metadata_proxy_shared_secret = {{ shared_secret }}
|
metadata_proxy_shared_secret = {{ shared_secret }}
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
|
@ -5,6 +5,7 @@ rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
|||||||
rabbit_host = {{ rabbitmq_host }}
|
rabbit_host = {{ rabbitmq_host }}
|
||||||
rabbit_password = {{ rabbitmq_password }}
|
rabbit_password = {{ rabbitmq_password }}
|
||||||
debug = True
|
debug = True
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
bind_host = 0.0.0.0
|
bind_host = 0.0.0.0
|
||||||
bind_port = 9696
|
bind_port = 9696
|
||||||
core_plugin = {{ core_plugin }}
|
core_plugin = {{ core_plugin }}
|
||||||
|
@ -4,6 +4,7 @@ state_path=/var/lib/nova
|
|||||||
lock_path=/var/lock/nova
|
lock_path=/var/lock/nova
|
||||||
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
|
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
|
||||||
verbose=True
|
verbose=True
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
api_paste_config=/etc/nova/api-paste.ini
|
api_paste_config=/etc/nova/api-paste.ini
|
||||||
enabled_apis=metadata
|
enabled_apis=metadata
|
||||||
multi_host=True
|
multi_host=True
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
use_syslog = {{ use_syslog }}
|
||||||
[DATABASE]
|
[DATABASE]
|
||||||
sql_connection = mysql://{{ quantum_user }}:{{ quantum_password }}@{{ database_host }}/{{ quantum_db }}?charset=utf8
|
sql_connection = mysql://{{ quantum_user }}:{{ quantum_password }}@{{ database_host }}/{{ quantum_db }}?charset=utf8
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
from mock import MagicMock, patch
|
from mock import (
|
||||||
|
Mock,
|
||||||
|
MagicMock,
|
||||||
|
patch
|
||||||
|
)
|
||||||
import quantum_contexts
|
import quantum_contexts
|
||||||
|
import sys
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from test_utils import (
|
from test_utils import (
|
||||||
@ -199,6 +204,7 @@ class TestQuantumGatewayContext(CharmTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestQuantumGatewayContext, self).setUp(quantum_contexts,
|
super(TestQuantumGatewayContext, self).setUp(quantum_contexts,
|
||||||
TO_PATCH)
|
TO_PATCH)
|
||||||
|
self.config.side_effect = self.test_config.get
|
||||||
|
|
||||||
@patch.object(quantum_contexts, 'get_shared_secret')
|
@patch.object(quantum_contexts, 'get_shared_secret')
|
||||||
@patch.object(quantum_contexts, 'get_host_ip')
|
@patch.object(quantum_contexts, 'get_host_ip')
|
||||||
@ -256,6 +262,19 @@ class TestHostIP(CharmTestCase):
|
|||||||
super(TestHostIP, self).setUp(quantum_contexts,
|
super(TestHostIP, self).setUp(quantum_contexts,
|
||||||
TO_PATCH)
|
TO_PATCH)
|
||||||
self.config.side_effect = self.test_config.get
|
self.config.side_effect = self.test_config.get
|
||||||
|
# Save and inject
|
||||||
|
self.mods = {'dns': None, 'dns.resolver': None}
|
||||||
|
for mod in self.mods:
|
||||||
|
if mod not in sys.modules:
|
||||||
|
sys.modules[mod] = Mock()
|
||||||
|
else:
|
||||||
|
del self.mods[mod]
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestHostIP, self).tearDown()
|
||||||
|
# Cleanup
|
||||||
|
for mod in self.mods.keys():
|
||||||
|
del sys.modules[mod]
|
||||||
|
|
||||||
def test_get_host_ip_already_ip(self):
|
def test_get_host_ip_already_ip(self):
|
||||||
self.assertEquals(quantum_contexts.get_host_ip('10.5.0.1'),
|
self.assertEquals(quantum_contexts.get_host_ip('10.5.0.1'),
|
||||||
@ -268,8 +287,7 @@ class TestHostIP(CharmTestCase):
|
|||||||
|
|
||||||
@patch('dns.resolver.query')
|
@patch('dns.resolver.query')
|
||||||
def test_get_host_ip_hostname_unresolvable(self, _query):
|
def test_get_host_ip_hostname_unresolvable(self, _query):
|
||||||
class NXDOMAIN(Exception):
|
class NXDOMAIN(Exception): pass
|
||||||
pass
|
|
||||||
_query.side_effect = NXDOMAIN()
|
_query.side_effect = NXDOMAIN()
|
||||||
self.assertRaises(NXDOMAIN, quantum_contexts.get_host_ip,
|
self.assertRaises(NXDOMAIN, quantum_contexts.get_host_ip,
|
||||||
'missing.example.com')
|
'missing.example.com')
|
||||||
|
Loading…
Reference in New Issue
Block a user