From 8c52d2b68d656aef61baf8d092e40024f397c5ed Mon Sep 17 00:00:00 2001 From: wutianwei Date: Fri, 19 Jan 2018 17:07:41 +0800 Subject: Change gnocchi storage and increase the capacity of ceph 1. Change the gnocchi storage to ceph. 2. Change the size of loopback to 500GB 3. Change the ceilometer polling yaml 4. Run ceilometer-upgrade command and restart ceilometer service Change-Id: I8948c7b7e340c11e5d05c06a7d54c0e1b807620c Signed-off-by: wutianwei --- .../ansible/openstack/HA-ansible-multinodes.yml | 1 + .../ansible/roles/config-osa/files/polling.yaml | 6 +++++ .../ansible/roles/config-osa/files/user_ceph.yml | 10 ++++++++ .../ansible/roles/config-osa/tasks/meters.yml | 12 ++++++++++ .../ansible/roles/post-osa/handlers/main.yml | 14 +++++++++++ .../roles/post-osa/tasks/ceilometer-upgrade.yml | 28 ++++++++++++++++++++++ .../adapters/ansible/roles/post-osa/tasks/main.yml | 4 ++++ .../adapters/ansible/roles/post-osa/vars/main.yml | 11 +++++++++ .../adapters/ansible/roles/storage/vars/main.yml | 2 +- 9 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 deploy/adapters/ansible/roles/config-osa/files/polling.yaml create mode 100755 deploy/adapters/ansible/roles/post-osa/tasks/ceilometer-upgrade.yml (limited to 'deploy') diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index f923d0d3..6e6502de 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -45,6 +45,7 @@ - compute - utility - neutron_server + - ceilometer_all remote_user: root roles: - post-osa diff --git a/deploy/adapters/ansible/roles/config-osa/files/polling.yaml b/deploy/adapters/ansible/roles/config-osa/files/polling.yaml new file mode 100644 index 00000000..631e3687 --- /dev/null +++ b/deploy/adapters/ansible/roles/config-osa/files/polling.yaml @@ -0,0 +1,6 @@ +--- +sources: + - name: all_pollsters + interval: 300 + meters: + - "*" diff --git a/deploy/adapters/ansible/roles/config-osa/files/user_ceph.yml b/deploy/adapters/ansible/roles/config-osa/files/user_ceph.yml index 9d5f13a9..6daa1436 100644 --- a/deploy/adapters/ansible/roles/config-osa/files/user_ceph.yml +++ b/deploy/adapters/ansible/roles/config-osa/files/user_ceph.yml @@ -14,3 +14,13 @@ cinder_backends: rbd_user: cinder rbd_secret_uuid: "{{ cinder_ceph_client_uuid }}" report_discard_supported: true + +gnocchi_storage_driver: ceph +gnocchi_ceph_pool: "metrics" +ceph_extra_components: + - component: gnocchi_api + package: + - "{{ python_ceph_package }}" + client: + - '{{ gnocchi_ceph_client }}' + service: '{{ ceph_gnocchi_service_names }}' diff --git a/deploy/adapters/ansible/roles/config-osa/tasks/meters.yml b/deploy/adapters/ansible/roles/config-osa/tasks/meters.yml index 8f06a884..2b3bce5f 100644 --- a/deploy/adapters/ansible/roles/config-osa/tasks/meters.yml +++ b/deploy/adapters/ansible/roles/config-osa/tasks/meters.yml @@ -69,3 +69,15 @@ [database]{% raw %} connection = mysql+pymysql://{{ ceilometer_galera_user }}:{{ ceilometer_container_db_password }}@{{ceilometer_galera_address }}/{{ ceilometer_galera_database }}?charset=utf86{% endraw %} # yamllint enable rule:line-length + +- name: make sure the directory exist + file: + dest: /etc/openstack_deploy/ceilometer + state: directory + mode: 0755 + +- name: copy the polling.yml + copy: + dest: /etc/openstack_deploy/ceilometer/polling.yaml + src: polling.yaml + mode: 0644 diff --git a/deploy/adapters/ansible/roles/post-osa/handlers/main.yml b/deploy/adapters/ansible/roles/post-osa/handlers/main.yml index 3d979e6a..d685edca 100755 --- a/deploy/adapters/ansible/roles/post-osa/handlers/main.yml +++ b/deploy/adapters/ansible/roles/post-osa/handlers/main.yml @@ -9,3 +9,17 @@ - name: restart network service shell: "/sbin/ifconfig eth0 0 &&/sbin/ifdown -a && \ /sbin/ifup --ignore-errors -a" + +- name: Restart ceilometer services + service: + name: "{{ item.0.service_name }}" + enabled: "yes" + state: "restarted" + with_subelements: + - "{{ ceilometer_services }}" + - group + when: inventory_hostname in groups[item.1] + register: _restart + until: _restart | success + retries: 5 + delay: 2 diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/ceilometer-upgrade.yml b/deploy/adapters/ansible/roles/post-osa/tasks/ceilometer-upgrade.yml new file mode 100755 index 00000000..3d991b74 --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/tasks/ceilometer-upgrade.yml @@ -0,0 +1,28 @@ +############################################################################# +# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +- name: check for gnocchi resource file + stat: + path: "/etc/ceilometer/gnocchi_resources.yaml" + register: gnocchi_resource_file + +- name: get the path of ceilometer-upgrade + shell: "find / -name ceilometer-upgrade 2>/dev/null || true" + register: ceilometer_upgrade_path + +- name: Initialize Gnocchi database by creating ceilometer resources + command: "{{ ceilometer_upgrade_path.stdout }} --skip-metering-database" + become: "yes" + when: gnocchi_resource_file.stat.exists + register: _upgrade + until: _upgrade | success + retries: 10 + delay: 2 + notify: + - Restart ceilometer services diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml index bd83b50f..205f3392 100644 --- a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml +++ b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml @@ -23,3 +23,7 @@ when: - ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' - inventory_hostname in groups['compute'] + +- include: ceilometer-upgrade.yml + when: + - inventory_hostname in groups['ceilometer_all'] diff --git a/deploy/adapters/ansible/roles/post-osa/vars/main.yml b/deploy/adapters/ansible/roles/post-osa/vars/main.yml index da886028..12728150 100644 --- a/deploy/adapters/ansible/roles/post-osa/vars/main.yml +++ b/deploy/adapters/ansible/roles/post-osa/vars/main.yml @@ -24,3 +24,14 @@ intf_storage: |- {%- set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %} {%- endif %} {{- intf_storage }} + +ceilometer_services: + ceilometer-agent-notification: + group: + - ceilometer_agent_notification + service_name: ceilometer-agent-notification + ceilometer-polling: + group: + - ceilometer_agent_central + - ceilometer_agent_compute + service_name: ceilometer-polling diff --git a/deploy/adapters/ansible/roles/storage/vars/main.yml b/deploy/adapters/ansible/roles/storage/vars/main.yml index cbee9c1e..d6c5961a 100644 --- a/deploy/adapters/ansible/roles/storage/vars/main.yml +++ b/deploy/adapters/ansible/roles/storage/vars/main.yml @@ -7,7 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- -host_loopback_ceph_size: "100G" +host_loopback_ceph_size: "500G" rc_local_insert_before: "^exit 0$" bootstrap_host_data_disk_device: null bootstrap_host_data_disk_device_force: "no" -- cgit 1.2.3-korg