Permalink
Browse files

refactor: Drop unsupported configurations and code

Includes dropping support for quantum, nvp plugin (renamed
nsx long ago) and generally refactoring the unit tests
around no longer having to deal with neutron and quantum in
the same codebase.

Drop support for database connections - these are no longer
required as all DB access is now via RPC to nova-conductor
or neutron-server.

Roll-up configuration file templates < icehouse, remove any
that are no longer required.

Refactor basic_deployment a bit as it was using the shared-db
relation to retrieve the n-gateway units private-address.

Change-Id: I22957c0e21c4dd49e5aa74795173b4fc8f043f55
  • Loading branch information...
1 parent fce66ca commit 00f0edc70d68ce846db928ec2304d79fc6d1a5ae @javacruft javacruft committed Feb 29, 2016
Showing with 83 additions and 645 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 actions/openstack_upgrade.py
  3. +5 −12 config.yaml
  4. +9 −58 hooks/neutron_contexts.py
  5. +6 −40 hooks/neutron_hooks.py
  6. +33 −153 hooks/neutron_utils.py
  7. +0 −1 hooks/pgsql-db-relation-changed
  8. +0 −1 hooks/pgsql-db-relation-joined
  9. +0 −1 hooks/shared-db-relation-changed
  10. +0 −1 hooks/shared-db-relation-joined
  11. +0 −4 metadata.yaml
  12. +0 −10 templates/folsom/dhcp_agent.ini
  13. +0 −8 templates/folsom/l3_agent.ini
  14. +0 −12 templates/folsom/metadata_agent.ini
  15. +0 −26 templates/folsom/nova.conf
  16. +0 −8 templates/folsom/ovs_quantum_plugin.ini
  17. +0 −15 templates/folsom/quantum.conf
  18. +0 −22 templates/grizzly/nova.conf
  19. +0 −11 templates/grizzly/quantum.conf
  20. +0 −18 templates/havana/metadata_agent.ini
  21. +0 −16 templates/havana/neutron.conf
  22. +0 −14 templates/havana/ovs_neutron_plugin.ini
  23. 0 templates/{havana → icehouse}/dhcp_agent.ini
  24. 0 templates/{havana → icehouse}/dnsmasq.conf
  25. 0 templates/{havana → icehouse}/fwaas_driver.ini
  26. 0 templates/{havana → icehouse}/l3_agent.ini
  27. 0 templates/{havana → icehouse}/lbaas_agent.ini
  28. 0 templates/{havana → icehouse}/metering_agent.ini
  29. 0 templates/{havana → icehouse}/nova.conf
  30. 0 templates/{havana → icehouse}/vpn_agent.ini
  31. +9 −40 tests/basic_deployment.py
  32. +1 −0 tox.ini
  33. +0 −1 unit_tests/test_actions_openstack_upgrade.py
  34. +3 −35 unit_tests/test_neutron_contexts.py
  35. +1 −58 unit_tests/test_neutron_hooks.py
  36. +13 −78 unit_tests/test_neutron_utils.py
View
@@ -3,4 +3,5 @@ bin
tags
.tox
.testrepository
+*.pyc
*.sw[nop]
@@ -9,7 +9,7 @@
from neutron_utils import (
do_openstack_upgrade,
- get_common_package,
+ NEUTRON_COMMON,
)
from neutron_hooks import (
@@ -26,7 +26,7 @@ def openstack_upgrade():
code to run, otherwise a full service level upgrade will fire
on config-changed."""
- if do_action_openstack_upgrade(get_common_package(),
+ if do_action_openstack_upgrade(NEUTRON_COMMON,
do_openstack_upgrade,
CONFIGS):
config_changed()
View
@@ -33,7 +33,8 @@ options:
For series=Trusty we support cloud archives for openstack-release:
* juno
* kilo
- * ...
+ * liberty
+ * mitaka
NOTE: updating this setting to a source that is known to provide
a later version of OpenStack will trigger a software upgrade.
@@ -60,10 +61,10 @@ options:
Network configuration plugin to use for quantum.
Supported values include:
- ovs - Open vSwitch
- nvp|nsx - Nicira NVP/VMware NSX
+ ovs - ML2 + Open vSwitch
+ nsx - VMware NSX
n1kv - Cisco N1kv
- ovs-odl - Open vSwitch with OpenDayLight Controller
+ ovs-odl - ML2 + Open vSwitch with OpenDayLight Controller
ext-port:
type: string
default:
@@ -140,14 +141,6 @@ options:
description: |
Optional configuration to support use of linux router
Note that this is used only for Cisco n1kv plugin.
- database-user:
- default: nova
- type: string
- description: Username for database access
- database:
- default: nova
- type: string
- description: Database name
nagios_context:
default: "juju"
type: string
View
@@ -15,85 +15,36 @@
NeutronAPIContext,
config_flags_parser
)
-from charmhelpers.contrib.openstack.utils import (
- get_os_codename_install_source
-)
from charmhelpers.contrib.hahelpers.cluster import(
eligible_leader
)
from charmhelpers.contrib.network.ip import (
get_address_in_network,
)
-DB_USER = "quantum"
-QUANTUM_DB = "quantum"
-NOVA_DB_USER = "nova"
-NOVA_DB = "nova"
-
-QUANTUM_OVS_PLUGIN = \
- "quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2"
-QUANTUM_NVP_PLUGIN = \
- "quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin.NvpPluginV2"
-NEUTRON_OVS_PLUGIN = \
- "neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2"
-NEUTRON_ML2_PLUGIN = \
- "neutron.plugins.ml2.plugin.Ml2Plugin"
-NEUTRON_NVP_PLUGIN = \
- "neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin.NvpPluginV2"
+NEUTRON_ML2_PLUGIN = "ml2"
NEUTRON_N1KV_PLUGIN = \
"neutron.plugins.cisco.n1kv.n1kv_neutron_plugin.N1kvNeutronPluginV2"
NEUTRON_NSX_PLUGIN = "vmware"
NEUTRON_OVS_ODL_PLUGIN = "ml2"
-NEUTRON = 'neutron'
-QUANTUM = 'quantum'
-
-
-def networking_name():
- ''' Determine whether neutron or quantum should be used for name '''
- if get_os_codename_install_source(config('openstack-origin')) >= 'havana':
- return NEUTRON
- else:
- return QUANTUM
-
OVS = 'ovs'
-NVP = 'nvp'
N1KV = 'n1kv'
NSX = 'nsx'
OVS_ODL = 'ovs-odl'
+NEUTRON = 'neutron'
+
CORE_PLUGIN = {
- QUANTUM: {
- OVS: QUANTUM_OVS_PLUGIN,
- NVP: QUANTUM_NVP_PLUGIN,
- },
- NEUTRON: {
- OVS: NEUTRON_OVS_PLUGIN,
- NVP: NEUTRON_NVP_PLUGIN,
- N1KV: NEUTRON_N1KV_PLUGIN,
- NSX: NEUTRON_NSX_PLUGIN,
- OVS_ODL: NEUTRON_OVS_ODL_PLUGIN,
- },
+ OVS: NEUTRON_ML2_PLUGIN,
+ N1KV: NEUTRON_N1KV_PLUGIN,
+ NSX: NEUTRON_NSX_PLUGIN,
+ OVS_ODL: NEUTRON_OVS_ODL_PLUGIN,
}
-def remap_plugin(plugin):
- ''' Remaps plugin name for renames/switches in packaging '''
- release = get_os_codename_install_source(config('openstack-origin'))
- if plugin == 'nvp' and release >= 'icehouse':
- plugin = 'nsx'
- elif plugin == 'nsx' and release < 'icehouse':
- plugin = 'nvp'
- return plugin
-
-
def core_plugin():
- plugin = remap_plugin(config('plugin'))
- if (get_os_codename_install_source(config('openstack-origin')) >=
- 'icehouse' and plugin == OVS):
- return NEUTRON_ML2_PLUGIN
- else:
- return CORE_PLUGIN[networking_name()][plugin]
+ return CORE_PLUGIN[config('plugin')]
class L3AgentContext(OSContextGenerator):
@@ -189,7 +140,7 @@ def get_host_ip(hostname=None):
def get_shared_secret():
secret = None
- _path = SHARED_SECRET.format(networking_name())
+ _path = SHARED_SECRET.format(NEUTRON)
if not os.path.exists(_path):
secret = str(uuid.uuid4())
with open(_path, 'w') as secret_file:
View
@@ -5,11 +5,9 @@
from charmhelpers.core.hookenv import (
log, ERROR, WARNING,
config,
- is_relation_made,
relation_get,
relation_set,
relation_ids,
- unit_get,
Hooks,
UnregisteredHookError,
status_set,
@@ -52,7 +50,6 @@
do_openstack_upgrade,
get_packages,
get_early_packages,
- get_common_package,
get_topics,
git_install,
git_install_requested,
@@ -69,6 +66,7 @@
use_l3ha,
REQUIRED_INTERFACES,
check_optional_relations,
+ NEUTRON_COMMON,
)
hooks = Hooks()
@@ -82,7 +80,7 @@ def install():
src = config('openstack-origin')
if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
src == 'distro'):
- src = 'cloud:precise-folsom'
+ src = 'cloud:precise-icehouse'
configure_installation_source(src)
status_set('maintenance', 'Installing apt packages')
apt_update(fatal=True)
@@ -115,7 +113,7 @@ def config_changed():
CONFIGS.write_all()
elif not config('action-managed-upgrade'):
- if openstack_upgrade_available(get_common_package()):
+ if openstack_upgrade_available(NEUTRON_COMMON):
status_set('maintenance', 'Running openstack upgrade')
do_openstack_upgrade(CONFIGS)
@@ -126,10 +124,6 @@ def config_changed():
create_sysctl(sysctl_dict, '/etc/sysctl.d/50-quantum-gateway.conf')
# Re-run joined hooks as config might have changed
- for r_id in relation_ids('shared-db'):
- db_joined(relation_id=r_id)
- for r_id in relation_ids('pgsql-db'):
- pgsql_db_joined(relation_id=r_id)
for r_id in relation_ids('amqp'):
amqp_joined(relation_id=r_id)
for r_id in relation_ids('amqp-nova'):
@@ -163,32 +157,6 @@ def upgrade_charm():
update_legacy_ha_files(force=True)
-@hooks.hook('shared-db-relation-joined')
-def db_joined(relation_id=None):
- if is_relation_made('pgsql-db'):
- # raise error
- e = ('Attempting to associate a mysql database when there is already '
- 'associated a postgresql one')
- log(e, level=ERROR)
- raise Exception(e)
- relation_set(username=config('database-user'),
- database=config('database'),
- hostname=unit_get('private-address'),
- relation_id=relation_id)
-
-
-@hooks.hook('pgsql-db-relation-joined')
-def pgsql_db_joined(relation_id=None):
- if is_relation_made('shared-db'):
- # raise error
- e = ('Attempting to associate a postgresql database when there'
- ' is already associated a mysql one')
- log(e, level=ERROR)
- raise Exception(e)
- relation_set(database=config('database'),
- relation_id=relation_id)
-
-
@hooks.hook('amqp-nova-relation-joined')
def amqp_nova_joined(relation_id=None):
relation_set(relation_id=relation_id,
@@ -222,13 +190,11 @@ def amqp_departed():
CONFIGS.write_all()
-@hooks.hook('shared-db-relation-changed',
- 'pgsql-db-relation-changed',
- 'amqp-relation-changed',
+@hooks.hook('amqp-relation-changed',
'cluster-relation-changed',
'cluster-relation-joined')
@restart_on_change(restart_map())
-def db_amqp_changed():
+def amqp_changed():
CONFIGS.write_all()
@@ -280,7 +246,7 @@ def stop():
@hooks.hook('zeromq-configuration-relation-joined')
-@os_requires_version('kilo', 'neutron-common')
+@os_requires_version('kilo', NEUTRON_COMMON)
def zeromq_configuration_relation_joined(relid=None):
relation_set(relation_id=relid,
topics=" ".join(get_topics()),
Oops, something went wrong.

0 comments on commit 00f0edc

Please sign in to comment.