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 ++++++++++++++++++++++ .../python/python-ceilometer_git.bb | 10 +++--- 2 files changed, 46 insertions(+), 4 deletions(-) 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') 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 + diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb index 8d5b9dc..7ee4e44 100644 --- a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb +++ b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb @@ -10,11 +10,11 @@ SRCNAME = "ceilometer" SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=master \ file://ceilometer.conf \ file://ceilometer.init \ - file://0001-sqlalchemy-Fix-for-get_statistics-with-postgresql.patch \ + file://0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch \ file://fix_ceilometer_memory_leak.patch \ " -SRCREV="a4c7411ac903984c7e7524469f89a417cf9cf97e" +SRCREV="faada69444988c66a09ade812e10fa2ab5a0adae" PV="2014.1.b2+git${SRCPV}" S = "${WORKDIR}/git" @@ -71,7 +71,7 @@ do_install_append() { install -m 0755 ${WORKDIR}/ceilometer-alarm-evaluator.init.sh ${D}${sysconfdir}/init.d/ceilometer-alarm-evaluator fi - cp run-tests.sh ${CEILOMETER_CONF_DIR} + cp setup-test-env.sh ${CEILOMETER_CONF_DIR} } pkg_postinst_${SRCNAME}-setup () { @@ -102,7 +102,7 @@ ALLOW_EMPTY_${SRCNAME}-setup = "1" FILES_${PN} = "${libdir}/*" -FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run-tests.sh" +FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/setup-test-env.sh" FILES_${SRCNAME}-common = "${sysconfdir}/${SRCNAME}/* \ " @@ -183,6 +183,8 @@ RDEPENDS_${PN} += " \ python-pip \ python-pytz \ python-pbr \ + python-croniter \ + python-ipaddr \ " RDEPENDS_${SRCNAME}-controller = "${PN} ${SRCNAME}-common ${SRCNAME}-alarm-notifier ${SRCNAME}-alarm-evaluator \ -- cgit v1.2.3-54-g00ecf