[gnuoy,trivial] ch sync
This commit is contained in:
parent
8a71ca2070
commit
d0d5007446
@ -13,3 +13,9 @@ log to syslog = {{ use_syslog }}
|
|||||||
err to syslog = {{ use_syslog }}
|
err to syslog = {{ use_syslog }}
|
||||||
clog to syslog = {{ use_syslog }}
|
clog to syslog = {{ use_syslog }}
|
||||||
|
|
||||||
|
[client]
|
||||||
|
{% if rbd_client_cache_settings -%}
|
||||||
|
{% for key, value in rbd_client_cache_settings.iteritems() -%}
|
||||||
|
{{ key }} = {{ value }}
|
||||||
|
{% endfor -%}
|
||||||
|
{%- endif %}
|
@ -54,7 +54,8 @@ from charmhelpers.contrib.storage.linux.lvm import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.network.ip import (
|
from charmhelpers.contrib.network.ip import (
|
||||||
get_ipv6_addr
|
get_ipv6_addr,
|
||||||
|
is_ipv6,
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.python.packages import (
|
from charmhelpers.contrib.python.packages import (
|
||||||
@ -519,6 +520,12 @@ def sync_db_with_multi_ipv6_addresses(database, database_user,
|
|||||||
relation_prefix=None):
|
relation_prefix=None):
|
||||||
hosts = get_ipv6_addr(dynamic_only=False)
|
hosts = get_ipv6_addr(dynamic_only=False)
|
||||||
|
|
||||||
|
if config('vip'):
|
||||||
|
vips = config('vip').split()
|
||||||
|
for vip in vips:
|
||||||
|
if vip and is_ipv6(vip):
|
||||||
|
hosts.append(vip)
|
||||||
|
|
||||||
kwargs = {'database': database,
|
kwargs = {'database': database,
|
||||||
'username': database_user,
|
'username': database_user,
|
||||||
'hostname': json.dumps(hosts)}
|
'hostname': json.dumps(hosts)}
|
||||||
|
@ -623,6 +623,38 @@ def unit_private_ip():
|
|||||||
return unit_get('private-address')
|
return unit_get('private-address')
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def storage_get(attribute="", storage_id=""):
|
||||||
|
"""Get storage attributes"""
|
||||||
|
_args = ['storage-get', '--format=json']
|
||||||
|
if storage_id:
|
||||||
|
_args.extend(('-s', storage_id))
|
||||||
|
if attribute:
|
||||||
|
_args.append(attribute)
|
||||||
|
try:
|
||||||
|
return json.loads(subprocess.check_output(_args).decode('UTF-8'))
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def storage_list(storage_name=""):
|
||||||
|
"""List the storage IDs for the unit"""
|
||||||
|
_args = ['storage-list', '--format=json']
|
||||||
|
if storage_name:
|
||||||
|
_args.append(storage_name)
|
||||||
|
try:
|
||||||
|
return json.loads(subprocess.check_output(_args).decode('UTF-8'))
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
except OSError as e:
|
||||||
|
import errno
|
||||||
|
if e.errno == errno.ENOENT:
|
||||||
|
# storage-list does not exist
|
||||||
|
return []
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
class UnregisteredHookError(Exception):
|
class UnregisteredHookError(Exception):
|
||||||
"""Raised when an undefined hook is called"""
|
"""Raised when an undefined hook is called"""
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user