Remove timeout check for snapshot service

Signed-off-by: Carlisia <carlisia@grokkingtech.io>
This commit is contained in:
Carlisia
2018-10-11 12:54:05 -07:00
committed by Nolan Brubaker
parent 78141e4735
commit c58b602a1d

View File

@@ -17,9 +17,6 @@ limitations under the License.
package cloudprovider
import (
"time"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
)
@@ -50,11 +47,6 @@ type SnapshotService interface {
SetVolumeID(pv runtime.Unstructured, volumeID string) (runtime.Unstructured, error)
}
const (
volumeCreateWaitTimeout = 30 * time.Second
volumeCreatePollInterval = 1 * time.Second
)
type snapshotService struct {
blockStore BlockStore
}
@@ -74,22 +66,7 @@ func (sr *snapshotService) CreateVolumeFromSnapshot(snapshotID string, volumeTyp
return "", err
}
// wait for volume to be ready (up to a maximum time limit)
ticker := time.NewTicker(volumeCreatePollInterval)
defer ticker.Stop()
timeout := time.NewTimer(volumeCreateWaitTimeout)
for {
select {
case <-timeout.C:
return "", errors.Errorf("timeout reached waiting for volume %v to be ready", volumeID)
case <-ticker.C:
if ready, err := sr.blockStore.IsVolumeReady(volumeID, volumeAZ); err == nil && ready {
return volumeID, nil
}
}
}
return volumeID, nil
}
func (sr *snapshotService) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error) {