diff --git a/pkg/volume/cinder/cinder_util.go b/pkg/volume/cinder/cinder_util.go index 934006aa72..baefc3e785 100644 --- a/pkg/volume/cinder/cinder_util.go +++ b/pkg/volume/cinder/cinder_util.go @@ -19,6 +19,7 @@ package cinder import ( "errors" "fmt" + "io/ioutil" "os" "strings" "time" @@ -174,6 +175,9 @@ func (util *CinderDiskUtil) CreateVolume(c *cinderVolumeProvisioner) (volumeID s } func probeAttachedVolume() error { + // rescan scsi bus + scsiHostRescan() + executor := exec.New() args := []string{"trigger"} cmd := executor.Command("/usr/bin/udevadm", args...) @@ -185,3 +189,14 @@ func probeAttachedVolume() error { glog.V(4).Infof("Successfully probed all attachments") return nil } + +func scsiHostRescan() { + scsi_path := "/sys/class/scsi_host/" + if dirs, err := ioutil.ReadDir(scsi_path); err == nil { + for _, f := range dirs { + name := scsi_path + f.Name() + "/scan" + data := []byte("- - -") + ioutil.WriteFile(name, data, 0666) + } + } +}