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
This commit is contained in:
Chris Holcombe 2017-07-19 08:56:28 -07:00
parent aa4d62ace1
commit cda014fec7
2 changed files with 16 additions and 6 deletions

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():

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",