From 4aac6a80a3cd5b026c678dd670bfbe92b9ea7f1a Mon Sep 17 00:00:00 2001 From: edisonxiang Date: Fri, 17 Nov 2017 21:46:14 +0800 Subject: [PATCH] probeAttachedVolume improvement in Cinder --- pkg/volume/cinder/attacher.go | 2 +- pkg/volume/cinder/cinder_util.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/volume/cinder/attacher.go b/pkg/volume/cinder/attacher.go index dab97b9b9c4..1bd25712425 100644 --- a/pkg/volume/cinder/attacher.go +++ b/pkg/volume/cinder/attacher.go @@ -44,7 +44,7 @@ var _ volume.Attacher = &cinderDiskAttacher{} var _ volume.AttachableVolumePlugin = &cinderPlugin{} const ( - checkSleepDuration = 1 * time.Second + checkSleepDuration = 5 * time.Second operationFinishInitDealy = 1 * time.Second operationFinishFactor = 1.1 operationFinishSteps = 10 diff --git a/pkg/volume/cinder/cinder_util.go b/pkg/volume/cinder/cinder_util.go index 661ad3f059c..15758cf31b7 100644 --- a/pkg/volume/cinder/cinder_util.go +++ b/pkg/volume/cinder/cinder_util.go @@ -224,6 +224,18 @@ func probeAttachedVolume() error { scsiHostRescan() executor := exec.New() + + // udevadm settle waits for udevd to process the device creation + // events for all hardware devices, thus ensuring that any device + // nodes have been created successfully before proceeding. + argsSettle := []string{"settle", "--timeout=1"} + cmdSettle := executor.Command("udevadm", argsSettle...) + _, errSettle := cmdSettle.CombinedOutput() + if errSettle != nil { + glog.Errorf("error running udevadm settle %v\n", errSettle) + return errSettle + } + args := []string{"trigger"} cmd := executor.Command("udevadm", args...) _, err := cmd.CombinedOutput()