summaryrefslogtreecommitdiff
path: root/hooks/ceph_hooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/ceph_hooks.py')
-rwxr-xr-xhooks/ceph_hooks.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py
index 47379f0..0eca970 100755
--- a/hooks/ceph_hooks.py
+++ b/hooks/ceph_hooks.py
@@ -93,6 +93,8 @@ from charmhelpers.contrib.storage.linux.utils import (
93from charmhelpers.contrib.charmsupport import nrpe 93from charmhelpers.contrib.charmsupport import nrpe
94from charmhelpers.contrib.hardening.harden import harden 94from charmhelpers.contrib.hardening.harden import harden
95 95
96from charmhelpers.core.unitdata import kv
97
96import charmhelpers.contrib.openstack.vaultlocker as vaultlocker 98import charmhelpers.contrib.openstack.vaultlocker as vaultlocker
97 99
98hooks = Hooks() 100hooks = Hooks()
@@ -426,6 +428,15 @@ def prepare_disks_and_activate():
426 428
427 # pre-flight check of eligible device pristinity 429 # pre-flight check of eligible device pristinity
428 devices = get_devices() 430 devices = get_devices()
431
432 # if a device has been previously touched we need to consider it as
433 # non-pristine. If it needs to be re-processed it has to be zapped
434 # via the respective action which also clears the unitdata entry.
435 db = kv()
436 touched_devices = db.get('osd-devices', [])
437 devices = [dev for dev in devices if dev not in touched_devices]
438 log('Skipping osd devices previously processed by this unit: {}'
439 .format(touched_devices))
429 # filter osd-devices that are file system paths 440 # filter osd-devices that are file system paths
430 devices = [dev for dev in devices if dev.startswith('/dev')] 441 devices = [dev for dev in devices if dev.startswith('/dev')]
431 # filter osd-devices that does not exist on this unit 442 # filter osd-devices that does not exist on this unit
@@ -435,6 +446,7 @@ def prepare_disks_and_activate():
435 # filter osd-devices that are active bluestore devices 446 # filter osd-devices that are active bluestore devices
436 devices = [dev for dev in devices 447 devices = [dev for dev in devices
437 if not ceph.is_active_bluestore_device(dev)] 448 if not ceph.is_active_bluestore_device(dev)]
449
438 log('Checking for pristine devices: "{}"'.format(devices), level=DEBUG) 450 log('Checking for pristine devices: "{}"'.format(devices), level=DEBUG)
439 if not all(ceph.is_pristine_disk(dev) for dev in devices): 451 if not all(ceph.is_pristine_disk(dev) for dev in devices):
440 status_set('blocked', 452 status_set('blocked',