diff options
author | Silvio Moioli <smoioli@suse.de> | 2016-07-13 08:38:41 +0200 |
---|---|---|
committer | Silvio Moioli <smoioli@suse.de> | 2016-07-13 08:38:41 +0200 |
commit | 26fa9e6a5d7e75673bfef8705aa0b8c129cdb93d (patch) | |
tree | d7af10e82429ae6545a1bb109fbf79e7caba45d0 /libvirt/resource_libvirt_volume.go | |
parent | 3dc63b446a3598062bb349e0227d8756000f9bdd (diff) | |
download | terraform-provider-libvirt-26fa9e6a5d7e75673bfef8705aa0b8c129cdb93d.tar terraform-provider-libvirt-26fa9e6a5d7e75673bfef8705aa0b8c129cdb93d.tar.gz |
Don't attempt starting a pool if it is started already
Diffstat (limited to 'libvirt/resource_libvirt_volume.go')
-rw-r--r-- | libvirt/resource_libvirt_volume.go | 8 |
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) |