deb-gnocchi/7bcd2a25.diff

31 lines
1.2 KiB
Diff

From 7bcd2a259be0a35d9387a24329f55250efde3aec Mon Sep 17 00:00:00 2001
From: Mehdi Abaakouk <sileht@redhat.com>
Date: Mon, 12 Sep 2016 19:54:03 +0200
Subject: [PATCH] ceph: Fix metricd start
metricd can be started before api, in that case
metricd fail because the measure object don't yet exists.
Change-Id: Id7822f16718e31d6a8916cec8a6b77194071a31e
---
diff --git a/gnocchi/storage/ceph.py b/gnocchi/storage/ceph.py
index 15e1dad..d2ea4f8 100644
--- a/gnocchi/storage/ceph.py
+++ b/gnocchi/storage/ceph.py
@@ -167,8 +167,12 @@
def _list_object_names_to_process(self, prefix=""):
with rados.ReadOpCtx() as op:
omaps, ret = self.ioctx.get_omap_vals(op, "", prefix, -1)
- self.ioctx.operate_read_op(
- op, self.MEASURE_PREFIX, flag=self.OMAP_READ_FLAGS)
+ try:
+ self.ioctx.operate_read_op(
+ op, self.MEASURE_PREFIX, flag=self.OMAP_READ_FLAGS)
+ except rados.ObjectNotFound:
+ # API have still written nothing
+ return ()
# NOTE(sileht): after reading the libradospy, I'm
# not sure that ret will have the correct value
# get_omap_vals transforms the C int to python int