Browse Source

Fix manual config devices

Set status is blocked when no block devices are found.
Also skip manual config devices if not specified

Change-Id: Ia2910dde612d11f7c697c27fd02789fe8b039488
changes/71/485271/1
Chris Holcombe 2 years ago
parent
commit
cda014fec7
2 changed files with 16 additions and 6 deletions
  1. +4
    -3
      src/lib/charm/gluster/block.py
  2. +12
    -3
      src/reactive/main.py

+ 4
- 3
src/lib/charm/gluster/block.py View File

@@ -652,9 +652,10 @@ def get_manual_bricks() -> Result:
log("Gathering list of manually specified brick devices")
brick_list = []
manual_config_brick_devices = config("brick_devices")
for brick in manual_config_brick_devices.split(" "):
if brick is not None:
brick_list.append(brick)
if manual_config_brick_devices:
for brick in manual_config_brick_devices.split(" "):
if brick is not None:
brick_list.append(brick)
log("List of manual storage brick devices: {}".format(brick_list))
bricks = scan_devices(brick_list)
if bricks.is_err():


+ 12
- 3
src/reactive/main.py View File

@@ -223,6 +223,8 @@ def create_volume(peers: Dict[str, Dict],
log("Got brick list: {}".format(brick_list.value))
log("Creating volume of type {} with brick list {}".format(
cluster_type, [str(b) for b in brick_list.value]), INFO)
if not brick_list.value:
return Err("No block devices detected")

result = None
if cluster_type is VolumeType.Distribute:
@@ -668,9 +670,16 @@ def update_status() -> None:

local_bricks = get_local_bricks(volume_name)
if local_bricks.is_ok():
status_set(workload_state="active",
message="Unit is ready ({} bricks)".format(
len(local_bricks.value)))
if local_bricks.value:
status_set(workload_state="active",
message="Unit is ready ({} bricks)".format(
len(local_bricks.value)))
else:
status_set(
workload_state="blocked",
message='No block devices detected using '
'current configuration')

return
else:
status_set(workload_state="blocked",


Loading…
Cancel
Save