Skip to content

Commit

Permalink
agent: Increase timeout for hotplugged block devices
Browse files Browse the repository at this point in the history
The timeout of 1 second to wait for a block device to be detected
by the agent was too low in case the system was running on a slow
environment (nested and/or under heavy load).

This commit increase the value from 1 to 10 to leave enough time to
block devices to be detected.

Fixes clearcontainers#218

Signed-off-by: Sebastien Boeuf <[email protected]>
  • Loading branch information
Sebastien Boeuf committed Jul 13, 2018
1 parent ad0daee commit 1484fdd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion syscall.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
const mountPerm = os.FileMode(0755)
const devPath = "/dev"
const mntOptions9p = "trans=virtio,version=9p2000.L"
const blockDevDetectionTimeout = 10

// bindMount bind mounts a source in to a destination, with the recursive
// flag if needed.
Expand Down Expand Up @@ -194,7 +195,7 @@ func waitForBlockDevice(deviceName string, isSCSIAddr bool) error {
select {
case <-doneListening:
close(done)
case <-time.After(time.Duration(1) * time.Second):
case <-time.After(time.Duration(blockDevDetectionTimeout) * time.Second):
close(done)
return fmt.Errorf("Timed out waiting for device %s", deviceName)
}
Expand Down

0 comments on commit 1484fdd

Please sign in to comment.