From 86e8cf948aaa100c78d2fd9378c5c837b3f7304f Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Wed, 12 Jul 2017 13:35:19 -0400 Subject: [PATCH] Revert "Correct RBD Provision stats&fix a perf problem" This reverts commit b907450d7d7500fbcb9e4040efc2d0e42f4a78f9. Even though this approach should perform better, the value it calculates is not what the scheduler expects, we should be returning allocated size. We'll address the performance issue in a follow up patch Change-Id: I01b8fb2302884c3ed398f9553bb8e6a2aeb307c7 --- cinder/volume/drivers/rbd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index ef702f027..82964e3c6 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -360,6 +360,10 @@ class RBDDriver(driver.CloneableImageVD, ports.append(port) return hosts, ports + def _iterate_cb(self, offset, length, exists): + if exists: + self._total_usage += length + def _get_usage_info(self): with RADOSClient(self) as client: for t in self.RBDProxy().list(client.ioctx): @@ -368,7 +372,7 @@ class RBDDriver(driver.CloneableImageVD, # non-default volume_name_template settings. Template # must start with "volume". with RBDVolumeProxy(self, t, read_only=True) as v: - self._total_usage += v.size() + v.diff_iterate(0, v.size(), None, self._iterate_cb) def _update_volume_stats(self): stats = {