From 10f1d577d4c4e66c77046fc3b274d6653af99586 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 27 Sep 2018 08:55:20 -0500 Subject: [PATCH] ceph-volume: adds a 'changed' key to lvm batch --report This will indicate if the command would result in any OSDs being created or not. Other tooling can use that key for idempotency checks. Signed-off-by: Andrew Schoen --- .../ceph_volume/devices/lvm/strategies/filestore.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py b/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py index af08c3108c4..fa7dc6ecb88 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/strategies/filestore.py @@ -99,6 +99,7 @@ class SingleType(object): # chose whichever is the one group we have to compute against devices = self.hdds or self.ssds osds = self.computed['osds'] + used_osds = [] for device in devices: for osd in range(self.osds_per_device): device_size = disk.Size(b=device.sys_api['size']) @@ -106,6 +107,7 @@ class SingleType(object): journal_size = self.journal_size data_size = osd_size - journal_size data_percentage = data_size * 100 / device_size + used_osds.append(device.used_by_ceph) osd = {'data': {}, 'journal': {}, 'used_by_ceph': device.used_by_ceph} osd['data']['path'] = device.abspath osd['data']['size'] = data_size.b.as_int() @@ -118,6 +120,8 @@ class SingleType(object): osd['journal']['human_readable_size'] = str(journal_size) osds.append(osd) + self.computed['changed'] = not any(used_osds) + def execute(self): """ Create vgs/lvs from the incoming set of devices, assign their roles -- 2.47.3