def mod_ceilometer(): rc, out, err = utils.detailed_execute('pcs', 'resource', 'show', 'p_ceilometer-agent-central', allowed_return_codes=[0, 1]) """Wait until all ocf resources are started, otherwise there is risk for race condition: If run "pcs resource restart" while some resources are still in restarting or initiating stage, it may result into failures for both. """ if rc == 0: wait_ocf_resource_started(300, 10) LOG.info("Patching ceilometer pipeline.yaml to exclude \ network.servers.*") # Exclude network.services.* to avoid error 404 pipeline = '/etc/ceilometer/pipeline.yaml' if not os.path.exists(pipeline): utils.reportError('%s not found' % pipeline) with open(pipeline) as f: ceilometer = yaml.safe_load(f) sources = utils.astute_get(ceilometer, ('sources', )) if len(sources) != 1: utils.reportError('ceilometer has none or more than one sources') source = sources[0] meters = utils.astute_get(source, ('meters', )) new_meter = '!network.services.*' if new_meter not in meters: meters.append(new_meter) with open(pipeline, "w") as f: ceilometer = yaml.safe_dump(ceilometer, f) restart_info = utils.execute('pcs', 'resource', 'restart', 'p_ceilometer-agent-central') LOG.info(restart_info)
def mod_ceilometer(): rc, out, err = utils.detailed_execute( 'pcs', 'resource', 'show', 'p_ceilometer-agent-central', allowed_return_codes=[0, 1]) """Wait until all ocf resources are started, otherwise there is risk for race condition: If run "pcs resource restart" while some resources are still in restarting or initiating stage, it may result into failures for both. """ if rc == 0: wait_ocf_resource_started(300, 10) LOG.info("Patching ceilometer pipeline.yaml to exclude \ network.servers.*") # Exclude network.services.* to avoid error 404 pipeline = '/etc/ceilometer/pipeline.yaml' if not os.path.exists(pipeline): utils.reportError('%s not found' % pipeline) with open(pipeline) as f: ceilometer = yaml.safe_load(f) sources = utils.astute_get(ceilometer, ('sources',)) if len(sources) != 1: utils.reportError('ceilometer has none or more than one sources') source = sources[0] meters = utils.astute_get(source, ('meters',)) new_meter = '!network.services.*' if new_meter not in meters: meters.append(new_meter) with open(pipeline, "w") as f: ceilometer = yaml.safe_dump(ceilometer, f) restart_info = utils.execute( 'pcs', 'resource', 'restart', 'p_ceilometer-agent-central') LOG.info(restart_info)
utils.ssh(himn, username, 'rm', '-f', '/etc/systemd/system/%s' % AUTO_START_SERVICE) utils.ssh(himn, username, 'rm', '-f', '/etc/sysconfig/network-scripts/%s' % AUTO_SCRIPT) utils.ssh(himn, username, 'systemctl', 'daemon-reload') if __name__ == '__main__': install_xenapi_sdk() astute = utils.get_astute() if astute: username, password, install_xapi = utils.get_options(astute) endpoints = get_endpoints(astute) himn_eth, himn_local = utils.init_eth() public_ip = utils.astute_get( astute, ('network_metadata', 'vips', 'public', 'ipaddr')) services_ssl = utils.astute_get(astute, ('public_ssl', 'services')) if username and password and endpoints and himn_local: route_to_compute(endpoints, HIMN_IP, himn_local, username) xcp_version = utils.get_xcp_version(HIMN_IP, username) if install_xapi: install_suppack(HIMN_IP, username, XS_PLUGIN_ISO, xcp_version) enable_linux_bridge(HIMN_IP, username) forward_from_himn(himn_eth) # port forwarding for novnc forward_port('br-mgmt', himn_eth, HIMN_IP, '80') create_novacompute_conf(HIMN_IP, username, password, public_ip,
CONNTRACK_CONF_SAMPLE, '/etc/conntrackd/conntrackd.conf') # Restart conntrackd service utils.ssh(himn, username, 'service', 'conntrackd', 'restart') if __name__ == '__main__': install_xenapi_sdk() astute = utils.get_astute() if astute: username, password, install_xapi = utils.get_options(astute) endpoints = get_endpoints(astute) himn_eth, himn_local = utils.init_eth() public_ip = utils.astute_get( astute, ('network_metadata', 'vips', 'public', 'ipaddr')) services_ssl = utils.astute_get( astute, ('public_ssl', 'services')) if username and password and endpoints and himn_local: route_to_compute(endpoints, HIMN_IP, himn_local, username) if install_xapi: install_suppack(HIMN_IP, username, XS_PLUGIN_ISO) enable_linux_bridge(HIMN_IP, username) forward_from_himn(himn_eth) # port forwarding for novnc forward_port('br-mgmt', himn_eth, HIMN_IP, '80') create_novacompute_conf(HIMN_IP, username, password, public_ip,