Integrate telemetry to virtual-mcp-pike-ovs

Change-Id: I362835110f63d7b23726eac2b1e414b4d4175904
diff --git a/classes/cluster/virtual-mcp-pike-ovs/infra/config.yml b/classes/cluster/virtual-mcp-pike-ovs/infra/config.yml
index a3b7a52..3a64332 100644
--- a/classes/cluster/virtual-mcp-pike-ovs/infra/config.yml
+++ b/classes/cluster/virtual-mcp-pike-ovs/infra/config.yml
@@ -7,6 +7,8 @@
 - system.salt.master.api
 - system.salt.master.pkg
 - system.salt.master.formula.pkg.manila
+- system.salt.master.formula.pkg.gnocchi
+- system.salt.master.formula.pkg.panko
 - system.reclass.storage.salt
 - system.salt.minion.ca.salt_master
 - system.sphinx.server.doc.reclass
@@ -18,10 +20,15 @@
 - system.keystone.client.service.designate
 - system.keystone.client.service.manila
 - system.keystone.client.service.manila2
+- system.keystone.client.service.aodh
+- system.keystone.client.service.ceilometer
+- system.keystone.client.service.panko
+- system.keystone.client.service.gnocchi
 - system.reclass.storage.system.openstack_control_cluster
 - system.reclass.storage.system.openstack_compute_multi
 - system.reclass.storage.system.openstack_gateway_single
 - system.reclass.storage.system.openstack_dashboard_single
+- system.reclass.storage.system.openstack_telemetry_cluster
 - cluster.virtual-mcp-pike-ovs
 parameters:
   _param:
@@ -125,6 +132,21 @@
           node_param:
             manila_share_address:
               value_template: <<node_tenant_ip>>
+        openstack_telemetry01:
+          expression: <<node_hostname>>__equals__mdb01
+          cluster_param:
+            openstack_telemetry_node01_address:
+              value_template: <<node_control_ip>>
+        openstack_telemetry02:
+          expression: <<node_hostname>>__equals__mdb02
+          cluster_param:
+            openstack_telemetry_node02_address:
+              value_template: <<node_control_ip>>
+        openstack_telemetry03:
+          expression: <<node_hostname>>__equals__mdb03
+          cluster_param:
+            openstack_telemetry_node03_address:
+              value_template: <<node_control_ip>>
       node:
         openstack_control_node01:
           classes:
@@ -163,3 +185,15 @@
           - cluster.virtual-mcp-pike-ovs.openstack.proxy
           params:
             linux_system_codename: xenial
+        openstack_telemetry_node01:
+          params:
+            # create resources only from 1 controller
+            # to prevent race conditions
+            ceilometer_create_gnocchi_resources: true
+            redis_cluster_role: 'master'
+        openstack_telemetry_node02:
+          params:
+            redis_cluster_role: 'slave'
+        openstack_telemetry_node03:
+          params:
+            redis_cluster_role: 'slave'
diff --git a/classes/cluster/virtual-mcp-pike-ovs/openstack/compute.yml b/classes/cluster/virtual-mcp-pike-ovs/openstack/compute.yml
index 65e84e5..6613c2a 100644
--- a/classes/cluster/virtual-mcp-pike-ovs/openstack/compute.yml
+++ b/classes/cluster/virtual-mcp-pike-ovs/openstack/compute.yml
@@ -5,6 +5,8 @@
 - system.linux.network.hosts
 - system.nova.compute.cluster
 - system.neutron.compute.cluster
+- system.ceilometer.agent.cluster
+- system.ceilometer.agent.polling.default
 - cluster.virtual-mcp-pike-ovs
 parameters:
   _param:
diff --git a/classes/cluster/virtual-mcp-pike-ovs/openstack/control.yml b/classes/cluster/virtual-mcp-pike-ovs/openstack/control.yml
index e9a0053..ac9402d 100644
--- a/classes/cluster/virtual-mcp-pike-ovs/openstack/control.yml
+++ b/classes/cluster/virtual-mcp-pike-ovs/openstack/control.yml
@@ -32,6 +32,12 @@
 - system.galera.server.database.nova
 - system.galera.server.database.designate
 - system.galera.server.database.manila
+- system.galera.server.database.aodh
+- system.galera.server.database.panko
+- system.galera.server.database.gnocchi
+- system.ceilometer.client
+- system.ceilometer.client.cinder_volume
+- system.ceilometer.client.neutron
 - system.haproxy.proxy.listen.openstack.nova-placement
 - system.haproxy.proxy.listen.openstack.manila
 - system.manila.control.cluster
diff --git a/classes/cluster/virtual-mcp-pike-ovs/openstack/init.yml b/classes/cluster/virtual-mcp-pike-ovs/openstack/init.yml
index dc71ab6..90f9843 100644
--- a/classes/cluster/virtual-mcp-pike-ovs/openstack/init.yml
+++ b/classes/cluster/virtual-mcp-pike-ovs/openstack/init.yml
@@ -25,6 +25,16 @@
     openstack_dns_node02_address: 172.16.10.112
     openstack_share_node01_address: 172.16.10.97
     openstack_share_node01_share_address: ${_param:openstack_share_node01_address}
+    openstack_telemetry_address: 172.16.10.253
+    openstack_telemetry_node01_address: 172.16.10.121
+    openstack_telemetry_node02_address: 172.16.10.122
+    openstack_telemetry_node03_address: 172.16.10.123
+    openstack_telemetry_system_codename: xenial
+    openstack_telemetry_hostname: mdb
+    openstack_telemetry_node01_hostname: mdb01
+    openstack_telemetry_node02_hostname: mdb02
+    openstack_telemetry_node03_hostname: mdb03
+    openstack_telemetry_keepalived_password: hf9GQOjG2uPhkJ2Q
 
     openstack_version: pike
     cinder_version: ${_param:openstack_version}
@@ -33,6 +43,7 @@
     admin_email: root@localhost
     cluster_public_protocol: http
     cluster_public_host: 172.16.10.254
+    telemetry_public_host: ${_param:openstack_telemetry_address}
     neutron_public_protocol: http
     neutron_control_dvr: False
     neutron_tenant_network_types: "flat,vxlan"
@@ -105,6 +116,18 @@
     cinder_service_host: ${_param:cluster_vip_address}
     manila_version: ${_param:openstack_version}
     manila_service_host: ${_param:cluster_vip_address}
+    panko_version: ${_param:openstack_version}
+    panko_service_host: ${_param:openstack_telemetry_address}
+    ceilometer_version: ${_param:openstack_version}
+    ceilometer_service_host: ${_param:openstack_telemetry_address}
+    aodh_version: ${_param:openstack_version}
+    aodh_service_host: ${_param:openstack_telemetry_address}
+    gnocchi_version: 4.0
+    gnocchi_service_host: ${_param:openstack_telemetry_address}
+    gnocchi_public_host: ${_param:telemetry_public_host}
+    aodh_public_host: ${_param:telemetry_public_host}
+    ceilometer_public_host: ${_param:telemetry_public_host}
+    panko_public_host: ${_param:telemetry_public_host}
     nova_version: ${_param:openstack_version}
     nova_service_host: ${_param:cluster_vip_address}
     nova_vncproxy_url: http://${_param:cluster_vip_address}:8060
@@ -123,6 +146,10 @@
     mysql_nova_password: workshop
     mysql_designate_password: workshop
     mysql_manila_password: workshop
+    mysql_ceilometer_password: workshop
+    mysql_panko_password: workshop
+    mysql_aodh_password: workshop
+    mysql_gnocchi_password: workshop
     keystone_service_token: workshop
     keystone_admin_password: workshop
     keystone_cinder_password: workshop
@@ -133,6 +160,10 @@
     keystone_nova_password: workshop
     keystone_designate_password: workshop
     keystone_manila_password: workshop
+    keystone_aodh_password: workshop
+    keystone_panko_password: workshop
+    keystone_ceilometer_password: workshop
+    keystone_gnocchi_password: workshop
     horizon_version: ${_param:openstack_version}
     horizon_secret_key: opaesee8Que2yahJoh9fo0eefo1Aeyo6ahyei8zeiboh3aeth5loth7ieNa5xi5e
     horizon_identity_host: ${_param:cluster_vip_address}
@@ -140,6 +171,10 @@
     horizon_identity_version: 2
     openstack_log_appender: true
     openstack_fluentd_handler_enabled: true
+    ceilometer_secret_key: workshop
+    ceilometer_agent_default_polling_interval: 15
+    ceilometer_agent_default_polling_meters:
+      - "*"
   linux:
     network:
       purge_hosts: true
diff --git a/classes/cluster/virtual-mcp-pike-ovs/openstack/telemetry.yml b/classes/cluster/virtual-mcp-pike-ovs/openstack/telemetry.yml
new file mode 100644
index 0000000..513ae52
--- /dev/null
+++ b/classes/cluster/virtual-mcp-pike-ovs/openstack/telemetry.yml
@@ -0,0 +1,104 @@
+classes:
+- system.linux.system.repo.ubuntu
+- system.linux.system.repo.glusterfs
+- system.linux.system.repo.mcp.openstack
+- system.memcached.server.single
+- system.apache.server.single
+- system.apache.server.site.gnocchi
+- system.apache.server.site.panko
+- system.glusterfs.server.cluster
+- system.glusterfs.client.cluster
+- system.glusterfs.client.volume.gnocchi
+- system.glusterfs.server.volume.gnocchi
+- service.redis.server.single
+- system.gnocchi.server.cluster
+- system.gnocchi.common.storage.incoming.redis
+- system.gnocchi.common.storage.file
+- system.gnocchi.common.coordination.redis
+- system.ceilometer.server.cluster
+- system.ceilometer.server.coordination.redis
+- system.aodh.server.cluster
+- system.aodh.server.coordination.redis
+- system.panko.server.cluster
+- system.ceilometer.server.backend.default
+- cluster.virtual-mcp-pike-ovs
+parameters:
+  _param:
+    gnocchi_statsd_resource_id: 07f26121-5777-48ba-8a0b-d70468133dd9
+    keepalived_openstack_telemetry_vip_address: ${_param:openstack_telemetry_address}
+    keepalived_openstack_telemetry_vip_password: ${_param:openstack_telemetry_keepalived_password}
+    keepalived_openstack_telemetry_vip_interface: ens3
+    cluster_vip_address: ${_param:openstack_telemetry_address}
+    cluster_local_address: ${_param:single_address}
+    cluster_node01_hostname: ${_param:openstack_telemetry_node01_hostname}
+    cluster_node01_address: ${_param:openstack_telemetry_node01_address}
+    cluster_node02_hostname: ${_param:openstack_telemetry_node02_hostname}
+    cluster_node02_address: ${_param:openstack_telemetry_node02_address}
+    cluster_node03_hostname: ${_param:openstack_telemetry_node03_hostname}
+    cluster_node03_address: ${_param:openstack_telemetry_node03_address}
+    glusterfs_service_host: ${_param:openstack_telemetry_address}
+    gnocchi_glusterfs_service_host: ${_param:glusterfs_service_host}
+    redis_sentinel_node01_address: ${_param:openstack_telemetry_node01_address}
+    redis_sentinel_node02_address: ${_param:openstack_telemetry_node02_address}
+    redis_sentinel_node03_address: ${_param:openstack_telemetry_node03_address}
+    openstack_telemetry_redis_url: redis://${_param:redis_sentinel_node01_address}:26379?sentinel=master_1&sentinel_fallback=${_param:redis_sentinel_node02_address}:26379&sentinel_fallback=${_param:redis_sentinel_node03_address}:26379
+    gnocchi_coordination_url: ${_param:openstack_telemetry_redis_url}
+    gnocchi_storage_incoming_redis_url: ${_param:openstack_telemetry_redis_url}
+    glusterfs_node01_address: ${_param:cluster_node01_address}
+    glusterfs_node02_address: ${_param:cluster_node02_address}
+    glusterfs_node03_address: ${_param:cluster_node03_address}
+  linux:
+    network:
+      interface:
+        ens4:
+          enabled: true
+          type: eth
+          proto: static
+          address: ${_param:single_address}
+          netmask: 255.255.255.0
+  keepalived:
+    cluster:
+      instance:
+        VIP:
+          virtual_router_id: 160
+  redis:
+    server:
+      version: 3.0
+      bind:
+        address: ${_param:single_address}
+    cluster:
+      enabled: True
+      mode: sentinel
+      role: ${_param:redis_cluster_role}
+      quorum: 2
+      master:
+        host: ${_param:cluster_node01_address}
+        port: 6379
+      sentinel:
+        address: ${_param:single_address}
+  apache:
+    server:
+      modules:
+        - wsgi
+  gnocchi:
+    common:
+      database:
+        host: ${_param:openstack_database_address}
+    server:
+      pkgs:
+      # TODO: move python-memcache installation to formula
+      - gnocchi-api
+      - gnocchi-metricd
+      - python-memcache
+  aodh:
+    server:
+      coordination_backend:
+        url: ${_param:openstack_telemetry_redis_url}
+      identity:
+        host: ${_param:openstack_control_address}
+  ceilometer:
+    server:
+      coordination_backend:
+        url: ${_param:openstack_telemetry_redis_url}
+      identity:
+        host: ${_param:openstack_control_address}