diff options
author | Thomas Hipp <thipp@suse.de> | 2017-08-07 18:21:37 +0200 |
---|---|---|
committer | Flavio Castelli <flavio@castelli.me> | 2017-08-08 09:26:03 +0200 |
commit | cb499833b53b90c8dd4da2c1ec83c86ecae7e7ea (patch) | |
tree | 3995fd8147917ff85a96aa37e89ca43cf95d7674 | |
parent | 968bf16201a9f13030f84765b027d7e45fdbef57 (diff) | |
download | terraform-provider-libvirt-cb499833b53b90c8dd4da2c1ec83c86ecae7e7ea.tar terraform-provider-libvirt-cb499833b53b90c8dd4da2c1ec83c86ecae7e7ea.tar.gz |
ensure volumes are free'd if there are no errors
Make sure to only then free volumes if there are no errors.
This fixes #151.
Signed-off-by: Thomas Hipp <thipp@suse.de>
-rw-r--r-- | libvirt/resource_libvirt_domain.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index 844b6cf7..975b1b93 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -804,11 +804,11 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error { virVol, err = virPool.LookupStorageVolByName(diskDef.Source.Volume) } - defer virVol.Free() if err != nil { return fmt.Errorf("Error retrieving volume for disk: %s", err) } + defer virVol.Free() virVolKey, err := virVol.GetKey() if err != nil { |