Remove etc/hosts change and pull back reassign_resource_agent
This commit is contained in:
parent
78d19c8d60
commit
6c4fc3212b
@ -24,6 +24,7 @@ from charmhelpers.core.host import (
|
||||
)
|
||||
from charmhelpers.contrib.hahelpers.cluster import(
|
||||
get_hacluster_config,
|
||||
eligible_leader
|
||||
)
|
||||
from charmhelpers.contrib.hahelpers.apache import(
|
||||
install_ca_cert
|
||||
@ -52,9 +53,9 @@ from quantum_utils import (
|
||||
cache_env_data,
|
||||
update_legacy_ha_files,
|
||||
remove_legacy_ha_files,
|
||||
add_hostname_to_hosts,
|
||||
install_legacy_ha_files,
|
||||
cleanup_ovs_netns,
|
||||
reassign_agent_resources,
|
||||
stop_neutron_ha_monitor_daemon
|
||||
)
|
||||
|
||||
@ -84,9 +85,6 @@ def install():
|
||||
# Legacy HA for Icehouse
|
||||
update_legacy_ha_files()
|
||||
|
||||
# Fix ovsdb-client monitor error
|
||||
add_hostname_to_hosts()
|
||||
|
||||
|
||||
@hooks.hook('config-changed')
|
||||
@restart_on_change(restart_map())
|
||||
@ -226,6 +224,9 @@ def cluster_departed():
|
||||
log('Unable to re-assign agent resources for failed nodes with n1kv',
|
||||
level=WARNING)
|
||||
return
|
||||
if not config('ha-legacy-mode') and eligible_leader(None):
|
||||
reassign_agent_resources()
|
||||
CONFIGS.write_all()
|
||||
|
||||
|
||||
@hooks.hook('cluster-relation-broken')
|
||||
|
@ -1,5 +1,4 @@
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
from shutil import copy2
|
||||
from charmhelpers.core.host import (
|
||||
@ -681,20 +680,6 @@ def cache_env_data():
|
||||
f.write(''.join([k, '=', v, '\n']))
|
||||
|
||||
|
||||
def add_hostname_to_hosts():
|
||||
# To fix bug 1405588, ovsdb-server got error when
|
||||
# running ovsdb-client monitor command start with 'sudo'.
|
||||
hostsfile = '/etc/hosts'
|
||||
resolve_hostname = '127.0.0.1 %s' % socket.gethostname()
|
||||
with open(hostsfile, 'r') as f:
|
||||
for line in f:
|
||||
if resolve_hostname in line:
|
||||
return
|
||||
|
||||
with open(hostsfile, 'a') as f:
|
||||
f.write('\n%s\n' % resolve_hostname)
|
||||
|
||||
|
||||
def stop_neutron_ha_monitor_daemon():
|
||||
try:
|
||||
cmd = ['pgrep', '-f', 'neutron-ha-monitor.py']
|
||||
|
@ -42,7 +42,6 @@ TO_PATCH = [
|
||||
'create_sysctl',
|
||||
'update_nrpe_config',
|
||||
'update_legacy_ha_files',
|
||||
'add_hostname_to_hosts',
|
||||
'install_legacy_ha_files',
|
||||
'cache_env_data',
|
||||
'get_hacluster_config',
|
||||
|
Loading…
Reference in New Issue
Block a user