Merge "RabbitMQ TLS support"
diff --git a/.kitchen.travis.yml b/.kitchen.travis.yml
index f847543..2d5e772 100644
--- a/.kitchen.travis.yml
+++ b/.kitchen.travis.yml
@@ -3,4 +3,4 @@
   - name: <%= ENV['SUITE'] %>
     provisioner:
       pillars-from-files:
-        neutron.sls: tests/pillar/<%= ENV['SUITE'] %>.sls
+        glance.sls: tests/pillar/<%= ENV['SUITE'] %>.sls
diff --git a/glance/files/grafana_dashboards/glance_prometheus.json b/glance/files/grafana_dashboards/glance_prometheus.json
old mode 100644
new mode 100755
index 9573799..9965f14
--- a/glance/files/grafana_dashboards/glance_prometheus.json
+++ b/glance/files/grafana_dashboards/glance_prometheus.json
@@ -1,5 +1,8 @@
 {% raw %}
 {
+  "annotations": {
+    "list": []
+  },
   "description": "Monitors Glance cluster using Prometheus. Shows overall cluster processes and usage.",
   "editable": true,
   "gnetId": 315,
@@ -74,7 +77,7 @@
               "intervalFactor": 2,
               "legendFormat": "{{ service }}",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "1,0",
@@ -162,7 +165,7 @@
               "intervalFactor": 2,
               "legendFormat": "per sec",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -177,27 +180,6 @@
             }
           ],
           "valueName": "current"
-        }
-      ],
-      "repeat": null,
-      "repeatIteration": null,
-      "repeatRowId": null,
-      "showTitle": true,
-      "title": "Service Status",
-      "titleSize": "h6"
-    },
-    {
-      "collapse": false,
-      "height": "100px",
-      "panels": [
-        {
-          "content": "<br />\n<h3 align=\"center\"> Up </h3>",
-          "id": 3,
-          "links": [],
-          "mode": "html",
-          "span": 1,
-          "title": "",
-          "type": "text"
         },
         {
           "cacheTimeout": null,
@@ -260,11 +242,11 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
-          "title": "API",
+          "title": "Glance API backends",
           "type": "singlestat",
           "valueFontSize": "80%",
           "valueMaps": [
@@ -337,11 +319,11 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
-          "title": "Registry",
+          "title": "Glance Registry backends",
           "type": "singlestat",
           "valueFontSize": "80%",
           "valueMaps": [
@@ -352,22 +334,177 @@
             }
           ],
           "valueName": "current"
-        },
-        {
-          "content": "",
-          "id": 6,
-          "links": [],
-          "mode": "markdown",
-          "span": 5,
-          "title": "",
-          "type": "text"
         }
       ],
       "repeat": null,
       "repeatIteration": null,
       "repeatRowId": null,
       "showTitle": true,
-      "title": "Glance APIs",
+      "title": "Service Status",
+      "titleSize": "h6"
+    },
+    {
+      "collapse": false,
+      "height": "250",
+      "panels": [
+        {
+          "aliasColors": {},
+          "bars": false,
+          "dashLength": 10,
+          "dashes": false,
+          "datasource": "prometheus",
+          "fill": 1,
+          "id": 19,
+          "legend": {
+            "avg": false,
+            "current": false,
+            "max": false,
+            "min": false,
+            "show": true,
+            "total": false,
+            "values": false
+          },
+          "lines": true,
+          "linewidth": 1,
+          "links": [],
+          "nullPointMode": "null",
+          "percentage": false,
+          "pointradius": 5,
+          "points": false,
+          "renderer": "flot",
+          "seriesOverrides": [],
+          "spaceLength": 10,
+          "span": 6,
+          "stack": false,
+          "steppedLine": false,
+          "targets": [
+            {
+              "expr": "sum(openstack_glance_http_response_times_rate{host=~\"^$host$\"})  by (http_status)",
+              "format": "time_series",
+              "intervalFactor": 2,
+              "legendFormat": "{{ http_status }}",
+              "refId": "A",
+              "step": 10
+            }
+          ],
+          "thresholds": [],
+          "timeFrom": null,
+          "timeShift": null,
+          "title": "Throughput",
+          "tooltip": {
+            "shared": true,
+            "sort": 0,
+            "value_type": "individual"
+          },
+          "type": "graph",
+          "xaxis": {
+            "buckets": null,
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
+          },
+          "yaxes": [
+            {
+              "format": "ops",
+              "label": null,
+              "logBase": 1,
+              "max": null,
+              "min": "0",
+              "show": true
+            },
+            {
+              "format": "short",
+              "label": null,
+              "logBase": 1,
+              "max": null,
+              "min": null,
+              "show": true
+            }
+          ]
+        },
+        {
+          "aliasColors": {},
+          "bars": false,
+          "dashLength": 10,
+          "dashes": false,
+          "datasource": "prometheus",
+          "fill": 1,
+          "id": 20,
+          "legend": {
+            "avg": false,
+            "current": false,
+            "max": false,
+            "min": false,
+            "show": true,
+            "total": false,
+            "values": false
+          },
+          "lines": true,
+          "linewidth": 1,
+          "links": [],
+          "nullPointMode": "null",
+          "percentage": false,
+          "pointradius": 5,
+          "points": false,
+          "renderer": "flot",
+          "seriesOverrides": [],
+          "spaceLength": 10,
+          "span": 6,
+          "stack": false,
+          "steppedLine": false,
+          "targets": [
+            {
+              "expr": "max(openstack_glance_http_response_times_upper_90{host=~\"^$host$\"})  by (http_method)",
+              "format": "time_series",
+              "intervalFactor": 2,
+              "legendFormat": "{{ http_method }}",
+              "refId": "A",
+              "step": 10
+            }
+          ],
+          "thresholds": [],
+          "timeFrom": null,
+          "timeShift": null,
+          "title": "Latency",
+          "tooltip": {
+            "shared": true,
+            "sort": 0,
+            "value_type": "individual"
+          },
+          "type": "graph",
+          "xaxis": {
+            "buckets": null,
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
+          },
+          "yaxes": [
+            {
+              "format": "s",
+              "label": null,
+              "logBase": 1,
+              "max": null,
+              "min": "0",
+              "show": true
+            },
+            {
+              "format": "short",
+              "label": null,
+              "logBase": 1,
+              "max": null,
+              "min": null,
+              "show": true
+            }
+          ]
+        }
+      ],
+      "repeat": null,
+      "repeatIteration": null,
+      "repeatRowId": null,
+      "showTitle": true,
+      "title": "API Performances",
       "titleSize": "h6"
     },
     {
@@ -436,7 +573,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -514,7 +651,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -568,7 +705,7 @@
               "intervalFactor": 2,
               "legendFormat": "{{ visibility }}",
               "refId": "A",
-              "step": 2
+              "step": 4
             }
           ],
           "thresholds": [],
@@ -669,7 +806,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -747,7 +884,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -801,7 +938,7 @@
               "intervalFactor": 2,
               "legendFormat": "{{ visibility }}",
               "refId": "A",
-              "step": 2
+              "step": 4
             }
           ],
           "thresholds": [],
@@ -902,7 +1039,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -980,7 +1117,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -1034,7 +1171,7 @@
               "intervalFactor": 2,
               "legendFormat": "{{ visibility }}",
               "refId": "A",
-              "step": 2
+              "step": 4
             }
           ],
           "thresholds": [],
@@ -1135,7 +1272,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -1213,7 +1350,7 @@
               "intervalFactor": 2,
               "legendFormat": "",
               "refId": "A",
-              "step": 20
+              "step": 60
             }
           ],
           "thresholds": "",
@@ -1267,7 +1404,7 @@
               "intervalFactor": 2,
               "legendFormat": "{{ visibility }}",
               "refId": "A",
-              "step": 2
+              "step": 4
             }
           ],
           "thresholds": [],
@@ -1322,7 +1459,29 @@
     "glance"
   ],
   "templating": {
-    "list": []
+    "list": [
+      {
+        "allValue": null,
+        "current": {},
+        "datasource": "prometheus",
+        "hide": 0,
+        "includeAll": true,
+        "label": null,
+        "multi": true,
+        "name": "host",
+        "options": [],
+        "query": "label_values(openstack_glance_http_response_times_count,host)",
+        "refresh": 1,
+        "refresh_on_load": true,
+        "regex": "",
+        "sort": 1,
+        "tagValuesQuery": "",
+        "tags": [],
+        "tagsQuery": "",
+        "type": "query",
+        "useTags": false
+      }
+    ]
   },
   "time": {
     "from": "now-1h",
@@ -1355,6 +1514,6 @@
   },
   "timezone": "browser",
   "title": "Glance",
-  "version": 2
+  "version": 3
 }
 {% endraw %}
diff --git a/glance/files/newton/glance-api.conf.Debian b/glance/files/newton/glance-api.conf.Debian
index 7f77ba8..ea18c08 100644
--- a/glance/files/newton/glance-api.conf.Debian
+++ b/glance/files/newton/glance-api.conf.Debian
@@ -415,7 +415,7 @@
 #
 #  (boolean value)
 #enable_v1_api = true
-enable_v1_api=False
+enable_v1_api=True
 
 #
 # Deploy the v2 OpenStack Images API.
@@ -469,7 +469,7 @@
 #     * enable_v1_api
 #
 #  (boolean value)
-#enable_v1_registry = true
+enable_v1_registry = True
 
 #
 # Deploy the v2 API Registry service.
diff --git a/glance/files/ocata/glance-api-paste.ini b/glance/files/ocata/glance-api-paste.ini
index bbf1120..6568c20 100644
--- a/glance/files/ocata/glance-api-paste.ini
+++ b/glance/files/ocata/glance-api-paste.ini
@@ -9,37 +9,38 @@
 
 # Use this pipeline for caching w/ management interface but no auth
 [pipeline:glance-api-cachemanagement]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage {% if server.audit.enabled %}audit {% endif %}rootapp
+pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler {% if server.audit.enabled %}audit {% endif %}unauthenticated-context cache cachemanage rootapp
 
 # Use this pipeline for keystone auth
 [pipeline:glance-api-keystone]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context {% if server.audit.enabled %}audit {% endif %}rootapp
+pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken {% if server.audit.enabled %}audit {% endif %}context rootapp
 
 # Use this pipeline for keystone auth with image caching
 [pipeline:glance-api-keystone+caching]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache {% if server.audit.enabled %}audit {% endif %}rootapp
+pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken {% if server.audit.enabled %}audit {% endif %}context cache rootapp
 
 # Use this pipeline for keystone auth with caching and cache management
 [pipeline:glance-api-keystone+cachemanagement]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage {% if server.audit.enabled %}audit {% endif %}rootapp
+pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken {% if server.audit.enabled %}audit {% endif %}context cache cachemanage rootapp
 
 # Use this pipeline for authZ only. This means that the registry will treat a
 # user as authenticated without making requests to keystone to reauthenticate
 # the user.
 [pipeline:glance-api-trusted-auth]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler context {% if server.audit.enabled %}audit {% endif %}rootapp
+pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler {% if server.audit.enabled %}audit {% endif %}context rootapp
 
 # Use this pipeline for authZ only. This means that the registry will treat a
 # user as authenticated without making requests to keystone to reauthenticate
 # the user and uses cache management
 [pipeline:glance-api-trusted-auth+cachemanagement]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler context cache cachemanage {% if server.audit.enabled %}audit {% endif %}rootapp
+pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler {% if server.audit.enabled %}audit {% endif %}context cache cachemanage rootapp
 
 [composite:rootapp]
 paste.composite_factory = glance.api:root_app_factory
 /: apiversions
 /v1: apiv1app
 /v2: apiv2app
+/v3: apiv3app
 
 [app:apiversions]
 paste.app_factory = glance.api.versions:create_resource
@@ -50,6 +51,9 @@
 [app:apiv2app]
 paste.app_factory = glance.api.v2.router:API.factory
 
+[app:apiv3app]
+paste.app_factory = glance.api.v3.router:API.factory
+
 [filter:healthcheck]
 paste.filter_factory = oslo_middleware:Healthcheck.factory
 backends = disable_by_file
diff --git a/glance/meta/prometheus.yml b/glance/meta/prometheus.yml
index b72cbbc..4e1a84d 100644
--- a/glance/meta/prometheus.yml
+++ b/glance/meta/prometheus.yml
@@ -14,6 +14,28 @@
         summary: "Endpoint check for '{{ $labels.service }}' is down"
         description: >-
             Endpoint check for '{{ $labels.service }}' is down for 2 minutes
+    GlanceRegistryServiceDown:
+      if: >-
+        http_response_status{service=~"glance-registry"} == 0
+      for: 2m
+      labels:
+        severity: down
+        service: "{{ $labels.service }}"
+      annotations:
+        summary: "HTTP check for '{{ $labels.service }}' down"
+        description: >-
+            The HTTP check for '{{ $labels.service }}' is down on {{ $labels.host }} for 2 minutes.
+    GlanceAPIServiceDown:
+      if: >-
+        http_response_status{service=~"glance-api"} == 0
+      for: 2m
+      labels:
+        severity: down
+        service: "{{ $labels.service }}"
+      annotations:
+        summary: "HTTP check for '{{ $labels.service }}' down"
+        description: >-
+            The HTTP check for '{{ $labels.service }}' is down on {{ $labels.host }} for 2 minutes.
     GlanceErrorLogsTooHigh:
 {%- endraw %}
       {%- set log_threshold = monitoring.error_log_rate|float %}
diff --git a/glance/meta/telegraf.yml b/glance/meta/telegraf.yml
index bdacc59..b686426 100644
--- a/glance/meta/telegraf.yml
+++ b/glance/meta/telegraf.yml
@@ -6,4 +6,7 @@
       glance-api:
         address: "http://{{ server.bind.address|replace('0.0.0.0', '127.0.0.1') }}:{{ server.bind.port }}/"
         expected_code: 300
+      glance-registry:
+        address: "http://{{ server.bind.address|replace('0.0.0.0', '127.0.0.1') }}:{{ server.registry.port }}/"
+        expected_code: 300
 {%- endif %}
\ No newline at end of file