From 6d229bc5925fbe3c0e3ecb16baf3be57782a7f47 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 7 Apr 2014 16:43:34 -0400 Subject: ceilometer: update to icehouse-rc1 Updating to the icehouse ceilometer, which has more functionality and features than the havana version. Also, we have to fix the resource query for postgres versus mysql. Signed-off-by: Bruce Ashfield --- ...emy-fix-grouping-for-postgresql-databases.patch | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 meta-openstack/recipes-devtools/python/python-ceilometer/0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch (limited to 'meta-openstack/recipes-devtools/python/python-ceilometer/0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch') diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer/0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch b/meta-openstack/recipes-devtools/python/python-ceilometer/0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch new file mode 100644 index 0000000..b2417d7 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-ceilometer/0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch @@ -0,0 +1,40 @@ +From d64999f1eba3db1444f36214bf4be7b8eaffdcb1 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Mon, 7 Apr 2014 16:24:18 -0400 +Subject: [PATCH] sqlalchemy: fix grouping for postgresql databases + +To avoid horizon errors, and avoid the following query issue: + + ProgrammingError: (ProgrammingError) column "meter.unit" must appear in the GROUP BY clause or be used in an aggregate function + +We need to add meter.unit as an explicit group_by attribute + +Signed-off-by: Bruce Ashfield +--- + ceilometer/storage/impl_sqlalchemy.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/ceilometer/storage/impl_sqlalchemy.py b/ceilometer/storage/impl_sqlalchemy.py +index 0e5df7008c5e..697f51136c37 100644 +--- a/ceilometer/storage/impl_sqlalchemy.py ++++ b/ceilometer/storage/impl_sqlalchemy.py +@@ -674,8 +674,14 @@ class Connection(base.Connection): + group_attributes = [getattr(models.Sample, g) for g in groupby] + select.extend(group_attributes) + +- query = session.query(*select).filter( +- models.Meter.id == models.Sample.meter_id) ++ # Group by Meter.unit for postgresql queries ++ # In mysql this doesn't change anything because one meter has one unit ++ ++ # mysql: ++ # query = session.query(*select).filter( ++ # models.Meter.id == models.Sample.meter_id) ++ # postgres: ++ query = session.query(*select).group_by(models.Meter.unit) + + if groupby: + query = query.group_by(*group_attributes) +-- +1.7.10.4 + -- cgit v1.2.3-54-g00ecf