diff --git a/ceilometer/api/controllers/v2/root.py b/ceilometer/api/controllers/v2/root.py index 783e9d60..bedc599b 100644 --- a/ceilometer/api/controllers/v2/root.py +++ b/ceilometer/api/controllers/v2/root.py @@ -156,6 +156,8 @@ class V2Controller(object): def _lookup(self, kind, *remainder): if (kind in ['meters', 'resources', 'samples'] and self.gnocchi_is_enabled): + if kind == 'meters' and pecan.request.method == 'POST': + return meters.MetersController(), remainder gnocchi_abort() elif kind == 'meters': return meters.MetersController(), remainder diff --git a/ceilometer/tests/functional/api/v2/test_api_upgrade.py b/ceilometer/tests/functional/api/v2/test_api_upgrade.py index 047c989e..2e6095d3 100644 --- a/ceilometer/tests/functional/api/v2/test_api_upgrade.py +++ b/ceilometer/tests/functional/api/v2/test_api_upgrade.py @@ -65,6 +65,14 @@ class TestAPIUpgradePath(v2.FunctionalTest): "limit": 3 }, status=410) self.assertIn(b'Gnocchi API', response.body) + self.post_json('/meters/fake_counter', + params=[{ + "counter_type": "gauge", + "counter_name": "fake_counter", + "resource_id": "fake_resource_id", + "counter_unit": "fake_unit", + "counter_volume": "1" + }], status=201) def _do_test_alarm_redirect(self): response = self.app.get(self.PATH_PREFIX + '/alarms',