summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libvirt/resource_libvirt_volume.go7
-rw-r--r--libvirt/utils.go2
2 files changed, 5 insertions, 4 deletions
diff --git a/libvirt/resource_libvirt_volume.go b/libvirt/resource_libvirt_volume.go
index ce4bb5ef..fb20196e 100644
--- a/libvirt/resource_libvirt_volume.go
+++ b/libvirt/resource_libvirt_volume.go
@@ -83,10 +83,9 @@ func resourceLibvirtVolumeCreate(d *schema.ResourceData, meta interface{}) error
// Refresh the pool of the volume so that libvirt knows it is
// not longer in use.
- err = pool.Refresh(0)
- if err != nil {
- return fmt.Errorf("Error refreshing pool for volume: %s", err)
- }
+ WaitForSuccess("Error refreshing pool for volume", func() error {
+ return pool.Refresh(0)
+ })
volumeDef := newDefVolume()
diff --git a/libvirt/utils.go b/libvirt/utils.go
index ffaa8ba6..ed645938 100644
--- a/libvirt/utils.go
+++ b/libvirt/utils.go
@@ -3,6 +3,7 @@ package libvirt
import (
"crypto/rand"
"fmt"
+ "log"
"time"
)
@@ -29,6 +30,7 @@ func WaitForSuccess(errorMessage string, f func() error) error {
if err == nil {
return nil
}
+ log.Printf("[DEBUG] %s. Re-trying.\n", err)
time.Sleep(1 * time.Second)
if time.Since(start) > 5*time.Minute {