This commit is contained in:
Subbarayudu Mukkamala 2015-04-17 17:02:54 -07:00
parent 1f2e43cd1f
commit f83fc6be77
3 changed files with 15 additions and 48 deletions

View File

@ -237,10 +237,6 @@ options:
SSL CA to use with the certificate and key provided - this is only
required if you are providing a privately signed ssl_cert and ssl_key.
# Neutron Nuage plugin (VSD) configuration
vsp-packages:
type: string
default: "python-nuagenetlib"
description: List of packages to install for neutron-plugin-nuage VSP.
vsd-server:
type: string
default:
@ -252,7 +248,7 @@ options:
vsd-organization:
type: string
default: csp
description: Name of the organization to create in Nuage VSD
description: Name of the organization in Nuage VSD
vsd-auth-ssl:
type: string
default: "True"
@ -260,19 +256,15 @@ options:
vsd-base-uri:
type: string
default: "/nuage/api/v3_0"
description: Name of the organization to create in Nuage VSD
description: Nuage VSD API endpoint URI
vsd-auth-resource:
type: string
default: "/me"
description: Name of the organization to create in Nuage VSD
description: Nuage VSD authentication resource
vsd-netpart-name:
type: string
default: juju-enterprise
description: Name of the organization to create in Nuage VSD
vsd-config-file:
type: string
default: "/etc/neutron/plugins/nuage/nuage_plugin.ini"
description: VSD configuration file name.
description: Name of the Organization or Enterprise to create in Nuage VSD
# end of Nuage VSD configuration
l2-population:
type: boolean

View File

@ -76,6 +76,10 @@ from charmhelpers.contrib.openstack.ip import (
PUBLIC, INTERNAL, ADMIN
)
from charmhelpers.contrib.openstack.neutron import (
neutron_plugin_attribute,
)
from charmhelpers.contrib.network.ip import (
get_iface_for_address,
get_netmask_for_address,
@ -129,7 +133,6 @@ def install():
if config('neutron-plugin-ppa-key') is not None:
key = config('neutron-plugin-ppa-key')
add_source(config('neutron-plugin-repository-url'), key)
packages += config('vsp-packages').split()
apt_update()
apt_install(packages, fatal=True)
@ -139,7 +142,6 @@ def install():
if source is not None:
try:
handler = ArchiveUrlFetchHandler()
#packages = config('vsp-packages').split()
packages = ['nuage-neutron']
path = handler.install(source)
for package in packages:
@ -169,9 +171,11 @@ def vsd_changed(relation_id=None, remote_unit=None):
if not vsd_ip_address:
return
vsd_address = '{}:8443'.format(vsd_ip_address)
nuage_config_file = neutron_plugin_attribute(config('neutron-plugin'),
'config', 'neutron')
log('vsd-rest-api-relation-changed: ip address:{}'.format(vsd_address))
vsd_config_file = config('vsd-config-file')
update_config_file(vsd_config_file, 'server', vsd_address)
log('vsd-rest-api-relation-changed:{}'.format(nuage_config_file))
CONFIGS.write(nuage_config_file)
@hooks.hook('upgrade-charm')
@ -482,38 +486,6 @@ def ha_changed():
neutron_api_relation_joined(rid=rid)
def update_config_file(config_file, key, value):
"""Updates or append configuration as key value pairs """
insert_config = key + " = " + str(value)
with open(config_file, "r+") as vrs_file:
mm = mmap.mmap(vrs_file.fileno(), 0)
origFileSize = mm.size()
newSize = len(insert_config)
search_str = '^\s*' + key
match = re.search(search_str, mm, re.MULTILINE)
if match is not None:
start_index = match.start()
end_index = mm.find("\n", match.end())
if end_index != -1:
origSize = end_index - start_index
if newSize > origSize:
newFileSize = origFileSize + len(insert_config) - origSize
mm.resize(newFileSize)
mm[start_index + newSize:] = mm[end_index:origFileSize]
elif newSize < origSize:
insert_config += (" " * (int(origSize) - int(newSize)))
newSize = origSize
mm[start_index:start_index+newSize] = insert_config
else:
mm.resize(start_index + len(insert_config))
mm[start_index:start_index+newSize] = insert_config
else:
mm.seek(0, os.SEEK_END)
mm.resize(origFileSize + len(insert_config) + 1)
mm.write("\n" + insert_config)
mm.close()
@hooks.hook('zeromq-configuration-relation-joined')
@os_requires_version('kilo', 'neutron-server')
def zeromq_configuration_relation_joined(relid=None):

View File

@ -123,6 +123,9 @@ def determine_packages(source=None):
packages.extend(pkgs)
if get_os_codename_install_source(source) >= 'kilo':
packages.extend(KILO_PACKAGES)
if config('neutron-plugin') == 'vsp':
packages.append('python-nuagenetlib')
return list(set(packages))