summaryrefslogtreecommitdiff
path: root/libvirt/resource_libvirt_volume.go
diff options
context:
space:
mode:
Diffstat (limited to 'libvirt/resource_libvirt_volume.go')
-rw-r--r--libvirt/resource_libvirt_volume.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libvirt/resource_libvirt_volume.go b/libvirt/resource_libvirt_volume.go
index 3979db1d..375335bd 100644
--- a/libvirt/resource_libvirt_volume.go
+++ b/libvirt/resource_libvirt_volume.go
@@ -349,6 +349,14 @@ func resourceLibvirtVolumeRead(d *schema.ResourceData, meta interface{}) error {
}
defer volPool.Free()
+ active, err := volPool.IsActive()
+ if err != nil {
+ return fmt.Errorf("Error retrieving status of pool %s for volume %s: %s", volPoolName, volId, err)
+ }
+ if active {
+ return fmt.Errorf("Can't retrieve volume %s", d.Id())
+ }
+
err = volPool.Create(0)
if err != nil {
return fmt.Errorf("Error starting pool %s: %s", volPoolName, err)