in ebs/libraries/block_device.rb [19:54]
def self.wait_for_logical_volumes(timeout = 300)
sleep_time = 10
time_elapsed = 0
while time_elapsed <= timeout
begin
lvscan = OpsWorks::ShellOut.shellout("lvscan")
if lvscan.gsub(/^$\n/, "").lines.all? { |line| line.include?('ACTIVE') }
Chef::Log.debug("All LVM volume disks seem to be active:\n#{lvscan}")
Chef::Log.info("All LVM volume disks seem to be active")
break
else
Chef::Log.debug("Not all LVM volume disks seem to be active, waiting #{sleep_time} more seconds:\n#{lvscan}")
Chef::Log.info("Not all LVM volume disks seem to be active, waiting #{sleep_time} more seconds")
sleep sleep_time
time_elapsed += sleep_time
begin
vgchange_status = OpsWorks::ShellOut.shellout("vgchange -ay")
Chef::Log.debug("Tried to activate all local volume groups:\n#{vgchange_status}")
Chef::Log.info("Tried to activate all local volume groups")
rescue RuntimeError => e
Chef::Log.debug("Activation of all local volume groups failed: #{e.class} - #{e.message} - #{e.backtrace.join("\n")}")
Chef::Log.info("Activation of all local volume groups failed: #{e.message}")
end
end
rescue RuntimeError => e
Chef::Log.debug("Scanning LVM volume disks failed: #{e.class} - #{e.message} - #{e.backtrace.join("\n")}")
Chef::Log.info("Scanning LVM volume disks failed (retrying in #{sleep_time} seconds): #{e.message}")
sleep sleep_time
time_elapsed += sleep_time
end
end
Chef::Log.info("Waiting for all LVM volume disks becoming active timed out.") if time_elapsed > timeout
end