Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Wait for devices before checking that raid exists #424

Merged
merged 1 commit into from
Jul 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions runtime/opt/taupage/init.d/10-prepare-disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ def iterate_mounts(region, config, max_tries=12, wait_time=5):
def handle_ebs_volumes(region, ebs_volumes):
ec2 = ec2_client(region)
for device, name in ebs_volumes.items():
if os.path.exists(device):
# /dev/sda is renamed into /dev/xvda
xv_device = device.replace('/dev/sd', '/dev/xvd')
if os.path.exists(device) or os.path.exists(xv_device):
logging.info("Device already exists %s", device)
else:
attach_volume(ec2, find_volume(ec2, name), device)
Expand All @@ -317,11 +319,7 @@ def create_raid_device(raid_device, raid_config, max_tries=12, wait_time=5):
"--create", raid_device,
"--run",
"--level=" + str(raid_level),
"--raid-devices=" + str(num_devices)]
# Give devices some time to be available in case they were recently attached
for device in devices:
wait_for_device(device)
call.append(device)
"--raid-devices=" + str(num_devices)] + devices

tries = 0
while True:
Expand All @@ -348,6 +346,10 @@ def create_raid_device(raid_device, raid_config, max_tries=12, wait_time=5):

def handle_raid_volumes(raid_volumes):
for raid_device, raid_config in raid_volumes.items():
# Give devices some time to be available in case they were recently attached
for device in raid_config.get("devices", []):
wait_for_device(device)

if raid_device_exists(raid_device):
logging.info("%s already exists", raid_device)
else:
Expand Down