Add haproxy/trusty-backports to support IPv6.

This commit is contained in:
Hui Xiang
2014-08-14 20:36:15 +08:00
parent fb6a6dea07
commit a4d4b98dba

View File

@@ -44,7 +44,8 @@ from charmhelpers.core.host import (
) )
from charmhelpers.fetch import ( from charmhelpers.fetch import (
apt_install, apt_install,
apt_update apt_update,
add_source
) )
from charmhelpers.payload.execd import execd_preinstall from charmhelpers.payload.execd import execd_preinstall
@@ -75,13 +76,25 @@ def install():
src = config('openstack-origin') src = config('openstack-origin')
if src != 'distro': if src != 'distro':
openstack.configure_installation_source(src) openstack.configure_installation_source(src)
# Note(xianghui): Need to install haproxy(1.5.3) from trusty-backports
# to support ipv6 address, so check is required to make sure not
# breaking other versions.
trusty = lsb_release()['DISTRIB_CODENAME'] == 'trusty'
if config('prefer-ipv6') and trusty:
add_source('deb http://archive.ubuntu.com/ubuntu trusty-backports'
' main')
add_source('deb-src http://archive.ubuntu.com/ubuntu trusty-backports'
' main')
apt_update(fatal=True) apt_update(fatal=True)
rel = openstack.get_os_codename_install_source(src) rel = openstack.get_os_codename_install_source(src)
pkgs = determine_packages(rel) pkgs = determine_packages(rel)
apt_install(pkgs, fatal=True) apt_install(pkgs, fatal=True)
apt_install(extra_pkgs, fatal=True) apt_install(extra_pkgs, fatal=True)
if config('prefer-ipv6') and trusty:
apt_install('haproxy/trusty-backports', fatal=True)
ensure_swift_dir() ensure_swift_dir()
# initialize new storage rings. # initialize new storage rings.
for ring in SWIFT_RINGS.iteritems(): for ring in SWIFT_RINGS.iteritems():
@@ -164,7 +177,7 @@ def balance_rings():
@restart_on_change(restart_map()) @restart_on_change(restart_map())
def storage_changed(): def storage_changed():
if config('prefer-ipv6'): if config('prefer-ipv6'):
host_ip = get_ipv6_addr() host_ip = relation_get('private-address')
else: else:
host_ip = openstack.get_host_ip(relation_get('private-address')) host_ip = openstack.get_host_ip(relation_get('private-address'))
zone = get_zone(config('zone-assignment')) zone = get_zone(config('zone-assignment'))